From: larrybr Date: Mon, 8 Mar 2021 01:31:53 +0000 (+0000) Subject: Add tests for sqlite3 shell with -append flag. X-Git-Tag: version-3.35.0~32^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5777380d1907db6dfece8934ce18b45e2f029003;p=thirdparty%2Fsqlite.git Add tests for sqlite3 shell with -append flag. FossilOrigin-Name: d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f --- diff --git a/manifest b/manifest index 6447ce8b9f..1e949582e2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sgrow/shrink\stests.\sFix\struncate\sbug.\sMake\sappendvfs.c\seasier\sto\sinspect. -D 2021-03-07T18:55:25.654 +C Add\stests\sfor\ssqlite3\sshell\swith\s-append\sflag. +D 2021-03-08T01:31:53.568 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -699,7 +699,7 @@ F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf F test/autoindex5.test a5d72fe8c217cc0ea356dc6fa06a282a8a3fc53aa807709d79dba07a8f248102 F test/autovacuum.test 0831cd34e14695d297187f7f6519265e3121c5b0a1720e548e86829e796129e9 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 -F test/avfs.test 243f1d2794b1c411e203cb5ec6f57875c405680aee393fe653dfb7e4a5e29703 +F test/avfs.test fcef698d4363182e54f4288c09799313c7b8074db81804a8e0680d4739607ff0 F test/avtrans.test b7dc25459ecbd86c6fa9c606ee3068f59d81e225118617dcf2bbb6ded2ade89e F test/backcompat.test 3e64cedda754c778ef6bbe417b6e7a295e662a4d F test/backup.test dd4a5ff756e3df3931dacb1791db0584d4bad989 @@ -1910,7 +1910,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 729117cdfa2d6ff24b66656e9ccc380199606b830fc338286e4dd10e8e787597 -R 4ca236c48800b688829480b8bceb70c7 +P c9521fa55620d0cb3cec20db7b42bc5f18876b42dca07811d1cd0f4b2907eab2 +R 23f68eed98007d707ef4373f281e795f U larrybr -Z e10dee79bfa99113490b8465597823aa +Z 8c93033ed5f0b875a3a05a4dccf1c0c4 diff --git a/manifest.uuid b/manifest.uuid index 65e0ebe948..a953a68833 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c9521fa55620d0cb3cec20db7b42bc5f18876b42dca07811d1cd0f4b2907eab2 \ No newline at end of file +d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f \ No newline at end of file diff --git a/test/avfs.test b/test/avfs.test index 1f292ee9c3..bf647990ee 100644 --- a/test/avfs.test +++ b/test/avfs.test @@ -19,12 +19,18 @@ # avfs-2.1. Test that the simple text file retains its initial text. # avfs-3.1. Test that the appendvfs can grow and shrink, remaining intact. # avfs-3.2. Test that appendvfs is intact after grow/shrink/close/reopen. +# avfs-4.1. Test shell's ability to append to a non-appendvfs file. +# avfs-4.2. Test shell's ability to append to empty or nonexistent file. +# avfs-4.3. Test shell's ability to reopen and alter an appendvfs file. # ... # (more to come) set testdir [file dirname $argv0] source $testdir/tester.tcl set ::testprefix avfs +set CLI [test_find_cli] +db close +forcedelete test.db load_static_extension db appendvfs @@ -188,8 +194,62 @@ do_test 3.2 { set ::result [join $results " | "] } {ok} -#forcedelete $::fa $::fd +do_test 4.1 { + set shdo "sh_app1.sql" + set shod "sh_app1.adb" + forcedelete $shdo $shod + set ofd [open $shdo w] + puts $ofd ".ar -c" + puts $ofd ".tables" + puts $ofd ".q" + close $ofd + set ofd [open $shod wb] + puts $ofd "Some text." + close $ofd + set res [catchcmd "-append -batch -init $shdo $shod" ""] + lappend res [fosAvfs $shod] + forcedelete $shdo $shod + set ::result [join $res " | "] +} {0 | sqlar | 4096} + +do_test 4.2 { + set shdo "sh_app1.sql" + set shod "sh_app1.adb" + forcedelete $shdo $shod + set ofd [open $shdo w] + puts $ofd ".ar -c" + puts $ofd ".tables" + puts $ofd ".q" + close $ofd + set ofd [open $shod wb] + close $ofd + set res [catchcmd "-append -batch -init $shdo $shod" ""] + lappend res [fosAvfs $shod] + forcedelete $shdo ; # Leave $shod for next test. + set ::result [join $res " | "] +} {0 | sqlar | 0} + +do_test 4.3 { + set shdo "sh_app1.sql" + set shod "sh_app1.adb" ; # Same as test 4.2, reusing ADB. + forcedelete $shdo + set ofd [open $shdo w] + puts $ofd ".ar -u $shdo" + puts $ofd "select count(*) from sqlar where name = '$shdo';" + puts $ofd ".q" + close $ofd + set res [catchcmd "-append -batch -init $shdo $shod" ""] + sqlite3 adb "file:$shod?mode=rw$::vf" -uri 1 + adb eval { + SELECT count(*) as n FROM sqlar + } { lappend res $n } + adb close + forcedelete $shdo $shod; + set ::result [join $res " | "] +} {0 | 1 | 1} + +forcedelete $::fa $::fza -#unset ::fa ::fd ::tlo ::result ::randints +unset -nocomplain ::fa ::fza ::tlo ::result ::randints finish_test