1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Simplify .import leak plug and arrange for CLI to be run under valgrind.

FossilOrigin-Name: 0d3e2380197aa3e725591266acaeb0d43a7e794ca9153e6c56253cdcf60720b1
This commit is contained in:
larrybr
2022-05-09 12:29:47 +00:00
parent fa5dfa8910
commit 2f5f674066
9 changed files with 64 additions and 39 deletions

View File

@ -2478,7 +2478,7 @@ proc test_find_binary {nm} {
}
# Find the name of the 'shell' executable (e.g. "sqlite3.exe") to use for
# the tests in shell[1-5].test. If no such executable can be found, invoke
# the tests in shell*.test. If no such executable can be found, invoke
# [finish_test ; return] in the callers context.
#
proc test_find_cli {} {
@ -2487,6 +2487,32 @@ proc test_find_cli {} {
return $prog
}
# Find invocation of the 'shell' executable (e.g. "sqlite3.exe") to use
# for the tests in shell*.test with optional valgrind prefix when the
# environment variable SQLITE_CLI_VALGRIND_OPT is set. The set value
# operates as follows:
# empty or 0 => no valgrind prefix;
# 1 => valgrind options for memory leak check;
# other => use value as valgrind options.
# If shell not found, invoke [finish_test ; return] in callers context.
#
proc test_cli_invocation {} {
set prog [test_find_binary sqlite3]
if {$prog==""} { return -code return }
if {[info exists ::env(SQLITE_CLI_VALGRIND_OPT)]} {
set vgo $::env(SQLITE_CLI_VALGRIND_OPT)
if {$vgo == 0 || $vgo eq ""} {
return $prog
} elseif {$vgo == 1} {
return "valgrind -q --leak-check=yes $prog"
} else {
return "valgrind $vgo $prog"
}
} else {
return $prog
}
}
# Find the name of the 'sqldiff' executable (e.g. "sqlite3.exe") to use for
# the tests in sqldiff tests. If no such executable can be found, invoke
# [finish_test ; return] in the callers context.