@@ -19,14 +19,11 @@ memsubsys2-4.1 SQLite3MC's cipher tables stay allocated between sqlite
1919memsubsys2-4.3 SQLite3MC's cipher tables stay allocated between sqlite3_initialize and sqlite3_shutdown
2020memsubsys2-4.4 SQLite3MC's cipher tables stay allocated between sqlite3_initialize and sqlite3_shutdown
2121memsubsys2-4.11 SQLite3MC's cipher tables stay allocated between sqlite3_initialize and sqlite3_shutdown
22- backup2-10 mcIoRead drops read errors of the real file, fixed by SQLite3MC pull request 272 after 2.5.1
2322EOF
2423)
2524# SQLite test files that crash through a named SQLite3MC defect, each with its reason.
2625EXPECTED_CRASHES=$( cat << 'EOF '
27- init sqlite3mcRegisterCipher writes through an unchecked sqlite3_malloc when an allocation fails
28- quota sqlite3mcCloneCodecParameterTable writes through an unchecked sqlite3_malloc when an allocation fails
29- multiplex sqlite3mcCloneCodecParameterTable writes through an unchecked sqlite3_malloc when an allocation fails
26+ shared9 2.6.0's temp-file encryption stores the opening connection in the shared pager, which outlives that connection
3027EOF
3128)
3229# SQLite test files not run, each with its reason.
@@ -45,6 +42,9 @@ if [ -n "${SANITIZE:-}" ]; then
4542crash8 its simulated crashes end child processes holding memory, which LeakSanitizer reports on SQLite alone too
4643EOF
4744)
45+ # Plain builds read shared9's freed connection handle there without faulting.
46+ EXPECTED_CRASHES=$( printf ' %s\n%s' " $EXPECTED_CRASHES " \
47+ " vtab_shared reads shared9's freed connection handle, which only the sanitizer catches" )
4848fi
4949
5050# A clean sanitizer run only counts if the binary is really instrumented.
@@ -76,9 +76,11 @@ git -C "$WORK/mc" fetch --quiet --depth 1 https://github.com/utelle/SQLite3Multi
7676git -C " $WORK /mc" archive " $commit " test | tar x -C " $WORK /mc"
7777failed=" "
7878# Upstream never checks the output, so its results, without the echoed script lines, are compared here.
79+ # Their mc_* information pragmas name the host CPU's features, so their lines are dropped from each script.
7980while read -r name db script; do
8081 echo " == $name "
81- (cd " $WORK /mc" && " $WORK /sqlite3mc" " $db " " .read test/$script " 2>&1 | grep -vxF -f " test/$script " ) || true
82+ grep -viE ' ^pragma mc_(aes_info|chacha20_hwaccel|cpu_info)\b' " $WORK /mc/test/$script " > " $WORK /mc/test/host-free.sql"
83+ (cd " $WORK /mc" && " $WORK /sqlite3mc" " $db " " .read test/host-free.sql" 2>&1 | grep -vxF -f test/host-free.sql) || true
8284done > " $WORK /sqlite3mc.out" << 'EOF '
8385test1 test1.db3 test1.sql
8486test2 test2.db3 test2.sql
@@ -151,27 +153,20 @@ awk '$1 == "F" { print $3 " *" $2; print "file " $2 }' manifest | sort | cmp -s
151153# TCL_LIB names the tclConfig.sh directory when configure cannot find it.
152154CC=" $CC " ./configure ${TCL_LIB: +--with-tcl=" $TCL_LIB " } > configure.log
153155make sqlite3.c > make.log
154- # testfixture reaches SQLite internals through -DSQLITE_PRIVATE="", which the shipped amalgamation rejects by
155- # defining sqlite3mcCodecAttach static against its SQLITE_PRIVATE declaration. The copy drops that one static,
156- # as SQLite3MC pull request 276 proposes, and the run stops once a release no longer carries it.
157- line=$( grep -n -x ' sqlite3mcCodecAttach(sqlite3\* db, int nDb, const char\* zPath, const void\* zKey, int nKey)' " $SHIPPED " | cut -d: -f1)
158- if [ -z " $line " ] || [ " $( sed -n " $(( line - 1 )) p" " $SHIPPED " ) " != " static int" ]; then
159- echo " sqlite3mcCodecAttach is no longer defined static, so drop its edit from suite/run.sh" >&2
160- exit 1
161- fi
162- sed " $(( line - 1 )) s/^static int$/SQLITE_PRIVATE int/" " $SHIPPED " > sqlite3.c
163- [ " $( diff " $SHIPPED " sqlite3.c | grep -c ' ^[<>]' ) " -eq 2 ] || { echo " the testfixture copy differs by more than one line" >&2 ; exit 1; }
164- make testfixture CC=" $CC " CFLAGS=" $OPT " LDFLAGS=" ${SANITIZE: +$OPT } " > testfixture.log 2>&1
156+ cp " $SHIPPED " sqlite3.c
157+ # The test sources fit their temp-store expectations to the compile-time SQLITE_TEMP_STORE, so they see the amalgamation's.
158+ temp_store=$( awk ' /^#ifndef SQLITE_TEMP_STORE$/{getline; print $3; exit}' " $SHIPPED " )
159+ make testfixture CC=" $CC " CFLAGS=" $OPT ${temp_store: +-DSQLITE_TEMP_STORE=$temp_store } " LDFLAGS=" ${SANITIZE: +$OPT } " > testfixture.log 2>&1
165160instrumented testfixture
166161printf ' sqlite3 db :memory:\nputs [db one {SELECT sqlite3mc_version()}]\n' > probe.tcl
167162# A testfixture that cannot open a database runs no test, so its own report ends the run.
168163tested=$( ./testfixture probe.tcl) || { echo " Failed:$failed testfixture" >&2 ; exit 1; }
169164echo " Testing $tested with SQLite's veryquick suite"
170165
171166skips=$( echo " $SKIP_FILES " | awk ' NF { printf " ~%s.test", $1 }' )
167+ # The testrunner exits nonzero when any file does, and the cipher tables make every file exit nonzero, so verdict.awk judges.
172168# shellcheck disable=SC2086
173- ./testfixture test/testrunner.tcl veryquick --jobs " $( nproc) " $skips > testrunner.out 2>&1 ||
174- { tail -n 40 testrunner.out; echo " Failed:$failed testrunner" >&2 ; exit 1; }
169+ ./testfixture test/testrunner.tcl veryquick --jobs " $( nproc) " $skips > testrunner.out 2>&1 || true
175170for name in $( echo " $SKIP_FILES " | awk ' { print $1 }' ) ; do echo " skip $name " ; done
176171awk -v failures=" $( echo " $EXPECTED_FAILURES " | awk ' { print $1 }' ) " \
177172 -v crashes=" $( echo " $EXPECTED_CRASHES " | awk ' { print $1 }' ) " \
0 commit comments