/ Check-in [3f621545]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a few more zipfile tests. No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3f621545879ea39502cfaf2b61883f92c077070274b4fdf45524ded81cac3e63
User & Date: dan 2018-02-01 20:42:23
Context
2018-02-02
16:20
Remove the time() dependency from the zipfile extension. Use SQLite VFS methods instead. check-in: 0702fb56 user: dan tags: trunk
2018-02-01
20:42
Add a few more zipfile tests. No changes to code. check-in: 3f621545 user: dan tags: trunk
19:41
Fix a problem triggered when a zipfile virtual table is created and written to within the same transaction. And add other zipfile tests. check-in: 48f1c556 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/zipfile.test.

   436    436   } {
   437    437     do_catchsql_test 4.5.$tn {
   438    438       WITH m(m) AS ( SELECT $mode)
   439    439       SELECT zipfile('a.txt', m, 1000, 'xyz') FROM m
   440    440     } [list 1 "zipfile: parse error in mode: $mode"]
   441    441   }
   442    442   
          443  +do_catchsql_test 4.6 {
          444  +  WITH c(name,data) AS ( SELECT 'a.txt', 'abc')
          445  +  SELECT zipfile(name) FROM c
          446  +} {1 {wrong number of arguments to function zipfile()}}
          447  +
          448  +do_catchsql_test 4.7 {
          449  +  WITH c(name,data) AS ( 
          450  +    SELECT 'a.txt', 'abc' UNION ALL
          451  +    SELECT NULL, 'def'
          452  +  )
          453  +  SELECT zipfile(name,data) FROM c
          454  +} {1 {first argument to zipfile() must be non-NULL}}
          455  +
          456  +do_catchsql_test 4.7 {
          457  +  WITH c(name,data,method) AS ( 
          458  +    SELECT 'a.txt', 'abc', 0
          459  +    UNION SELECT 'b.txt', 'def', 8
          460  +    UNION SELECT 'c.txt', 'ghi', 16
          461  +  )
          462  +  SELECT zipfile(name,NULL,NULL,data,method) FROM c
          463  +} {1 {illegal method value: 16}}
          464  +
          465  +do_catchsql_test 4.8 {
          466  +  WITH c(name,data) AS ( 
          467  +    SELECT 'a.txt', 'abc'
          468  +    UNION SELECT 'b.txt', 'def'
          469  +    UNION SELECT 'c.txt/', 'ghi'
          470  +  )
          471  +  SELECT zipfile(name,NULL,NULL,data) FROM c
          472  +} {1 {non-directory name must not end with /}}
          473  +
   443    474   #--------------------------------------------------------------------------
   444    475   
   445    476   db func rt remove_timestamps
   446    477   do_execsql_test 5.0 {
   447    478     WITH c(name,mtime,data) AS (
   448    479       SELECT 'a.txt', 946684800, 'abc'
   449    480     )
   450    481     SELECT name,mtime,data FROM zipfile(
   451         -    ( SELECT rt( zipfile(name,NULL,mtime,data) ) FROM c )
          482  +    ( SELECT rt( zipfile(name,NULL,mtime,data,NULL) ) FROM c )
   452    483     )
   453    484   } {
   454    485     a.txt 946684800 abc
   455    486   }
   456    487   
   457    488   if {[info vars ::UNZIP]!=""} { 
   458    489   ifcapable datetime {
................................................................................
   588    619   do_execsql_test 8.3.1 {
   589    620     BEGIN;
   590    621       CREATE VIRTUAL TABLE ok USING zipfile('test.zip');
   591    622       INSERT INTO ok(name, data) VALUES ('sqlite3', 'elf');
   592    623     COMMIT;
   593    624   }
   594    625   
          626  +#-------------------------------------------------------------------------
          627  +# Test that the zipfile aggregate correctly adds and removes "/" from
          628  +# the ends of directory file names.
          629  +do_execsql_test 9.0 {
          630  +  WITH src(nm) AS (
          631  +    VALUES('dir1') UNION ALL
          632  +    VALUES('dir2/') UNION ALL
          633  +    VALUES('dir3//') UNION ALL
          634  +    VALUES('dir4///') UNION ALL
          635  +    VALUES('/') 
          636  +  )
          637  +  SELECT name FROM zipfile((SELECT zipfile(nm, NULL) FROM src))
          638  +} {dir1/ dir2/ dir3/ dir4/ /}
   595    639   finish_test
   596    640   

Changes to test/zipfilefault.test.

    80     80       );
    81     81     }
    82     82   } -test {
    83     83     faultsim_test_result {0 {1 aaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb}}
    84     84   }
    85     85   
    86     86   reset_db
           87  +sqlite3_db_config_lookaside db 0 0 0
    87     88   load_static_extension db zipfile
    88     89   
    89     90   do_execsql_test 5.0 {
    90     91     CREATE VIRTUAL TABLE setup USING zipfile('test.zip') 
    91     92   }
    92     93   
    93     94   do_faultsim_test 5.1 -faults oom* -prep {
................................................................................
   122    123     execsql {
   123    124       INSERT INTO setup(name, data) VALUES('dir', NULL)
   124    125     }
   125    126   } -test {
   126    127     catchsql { COMMIT }
   127    128     faultsim_test_result {0 {}}
   128    129   }
          130  +
          131  +do_faultsim_test 6.1 -faults oom* -body {
          132  +  execsql {
          133  +    WITH c(n, d) AS (
          134  +      VALUES('a.txt', '1234567890') UNION ALL
          135  +      VALUES('dir', NULL)
          136  +    )
          137  +    SELECT zipfile(n, d) IS NULL FROM c;
          138  +  }
          139  +} -test {
          140  +  faultsim_test_result {0 0}
          141  +}
          142  +
          143  +set big [string repeat 0123456789 1000]
          144  +do_faultsim_test 6.2 -faults oom* -body {
          145  +  execsql {
          146  +    WITH c(n, d) AS (
          147  +      VALUES('a.txt', $big)
          148  +    )
          149  +    SELECT zipfile(n, NULL, NULL, d, 0) IS NULL FROM c;
          150  +  }
          151  +} -test {
          152  +  faultsim_test_result {0 0}
          153  +}
          154  +
          155  +do_faultsim_test 7.0 -faults oom* -prep {
          156  +  catch { db close }
          157  +  sqlite3 db ""
          158  +} -body {
          159  +  load_static_extension db zipfile
          160  +} -test {
          161  +}
   129    162   
   130    163   
   131    164   finish_test
   132    165