2006-01-26 13:11:36 +00:00
# Documentation for this script. This may be output to stderr
# if the script is invoked incorrectly.
set : : USAGE_MESSAGE {
This Tcl script is used to test the various compile time options
available for omitting code ( the SQLITE_OMIT_xxx options) . It
should be invoked as follows:
2011-04-06 17:54:31 +00:00
< script > ? test-symbol? ? - makefile PATH-TO-MAKEFILE? ? - skip_run?
2006-01-26 13:11:36 +00:00
The default value for : : MAKEFILE is " . . / M a k e f i l e . l i n u x . g c c " .
2011-02-09 19:55:20 +00:00
If - skip_run option is given then only the compile part is attempted.
2006-01-26 13:11:36 +00:00
This script builds the testfixture program and runs the SQLite test suite
once with each SQLITE_OMIT_ option defined and then once with all options
defined together. Each run is performed in a seperate directory created
as a sub-directory of the current directory by the script. The output
of the build is saved in < sub-directory> / build.log. The output of the
test-suite is saved in < sub-directory> / test.log.
Almost any SQLite makefile ( except those generated by configure - see below)
should work. The following properties are required:
* The makefile should support the " t e s t f i x t u r e " target.
* The makefile should support the " t e s t " target.
* The makefile should support the variable " O P T S " as a way to pass
options from the make command line to lemon and the C compiler.
More precisely, the following two invocations must be supported:
2011-06-22 20:14:09 +00:00
$::MAKEBIN -f $::MAKEFILE testfixture OPTS= " - D S Q L I T E _ O M I T _ A L T E R T A B L E = 1 "
$::MAKEBIN -f $::MAKEFILE test
2006-01-26 13:11:36 +00:00
Makefiles generated by the sqlite configure program cannot be used as
they do not respect the OPTS variable.
}
# Build a testfixture executable and run quick.test using it. The first
# parameter is the name of the directory to create and use to run the
# test in. The second parameter is a list of OMIT symbols to define
# when doing so. For example:
#
# run_quick_test /tmp/testdir {SQLITE_OMIT_TRIGGER SQLITE_OMIT_VIEW}
#
#
proc run_quick_test { dir omit_symbol_list} {
# Compile the value of the OPTS Makefile variable.
2011-10-20 00:55:54 +00:00
set opts " "
2008-07-31 02:43:34 +00:00
if { $::tcl_platform ( platform ) == " w i n d o w s " } {
2011-10-20 00:55:54 +00:00
append opts " O P T S + = - D S Q L I T E _ O S _ W I N = 1 \n "
2011-02-09 19:55:20 +00:00
set target " t e s t f i x t u r e . e x e "
2008-07-31 02:43:34 +00:00
} else {
2011-10-20 00:55:54 +00:00
append opts " O P T S + = - D S Q L I T E _ O S _ U N I X = 1 \n "
2008-07-31 02:43:34 +00:00
}
2006-01-26 13:11:36 +00:00
foreach sym $omit_symbol_list {
2011-10-20 00:55:54 +00:00
append opts " O P T S + = - D $ { s y m } = 1 \n "
2006-01-26 13:11:36 +00:00
}
# Create the directory and do the build. If an error occurs return
# early without attempting to run the test suite.
file mkdir $dir
puts - nonewline " B u i l d i n g $ d i r . . . "
flush stdout
2011-10-20 00:55:54 +00:00
catch {
file copy - force ./ config.h $dir
file copy - force ./ libtool $dir
}
set fd [ open $::MAKEFILE ]
set mkfile [ read $fd ]
close $fd
regsub { \ ninclude } $mkfile " \n $ o p t s \n i n c l u d e " mkfile
set fd [ open $dir / makefile w]
puts $fd $mkfile
close $fd
2006-01-26 13:11:36 +00:00
set rc [ catch {
2011-10-20 00:55:54 +00:00
exec $::MAKEBIN - C $dir - f makefile clean $::TARGET > & $dir / build.log
2006-01-26 13:11:36 +00:00
} ]
if { $rc } {
puts " N o g o o d . S e e $ d i r / b u i l d . l o g . "
return
} else {
puts " O k "
}
# Create an empty file "$dir/sqlite3". This is to trick the makefile out
# of trying to build the sqlite shell. The sqlite shell won't build
# with some of the OMIT options (i.e OMIT_COMPLETE).
2008-07-31 02:43:34 +00:00
set sqlite3_dummy $dir / sqlite3
2012-06-21 15:09:20 +00:00
if { $::tcl_platform ( platform ) == " w i n d o w s " } {
2008-07-31 02:43:34 +00:00
append sqlite3_dummy " . e x e "
}
if { ! [ file exists $sqlite3_dummy ] } {
set wr [ open $sqlite3_dummy w]
2006-01-26 13:11:36 +00:00
puts $wr " d u m m y "
close $wr
}
2011-02-09 19:55:20 +00:00
if { $::SKIP_RUN } {
2020-01-17 19:14:08 +00:00
# puts "Skip testing $dir."
2006-01-26 13:11:36 +00:00
} else {
2011-02-09 19:55:20 +00:00
# Run the test suite.
puts - nonewline " T e s t i n g $ d i r . . . "
flush stdout
set rc [ catch {
2011-10-20 00:55:54 +00:00
exec $::MAKEBIN - C $dir - f makefile test > & $dir / test.log
2011-02-09 19:55:20 +00:00
} ]
if { $rc } {
puts " N o g o o d . S e e $ d i r / t e s t . l o g . "
} else {
puts " O k "
}
2006-01-26 13:11:36 +00:00
}
}
# This proc processes the command line options passed to this script.
# Currently the only option supported is "-makefile", default
# "../Makefile.linux-gcc". Set the ::MAKEFILE variable to the value of this
# option.
#
proc process_options { argv } {
2011-06-22 20:14:09 +00:00
set : : MAKEBIN make ; # Default value
2012-06-21 15:09:20 +00:00
if { $::tcl_platform ( platform ) == " w i n d o w s " } {
set : : MAKEFILE ./ Makefile ; # Default value on Windows
2008-07-31 02:43:34 +00:00
} else {
2011-04-06 17:54:31 +00:00
set : : MAKEFILE ./ Makefile.linux-gcc ; # Default value
2008-07-31 02:43:34 +00:00
}
2020-01-17 19:14:08 +00:00
set : : SKIP_RUN 1 ; # Default to attempt test
2011-10-20 00:55:54 +00:00
set : : TARGET testfixture ; # Default thing to build
2011-02-09 19:55:20 +00:00
2006-01-26 13:11:36 +00:00
for { set i 0 } { $i < [ llength $argv ] } { incr i} {
2017-05-15 15:05:48 +00:00
switch - regexp - - [ lindex $argv $i ] {
- { 1 , 2 } makefile {
2006-01-26 13:11:36 +00:00
incr i
set : : MAKEFILE [ lindex $argv $i ]
}
2017-05-15 15:05:48 +00:00
- { 1 , 2 } nmake {
2011-06-22 20:14:09 +00:00
set : : MAKEBIN nmake
set : : MAKEFILE ./ Makefile.msc
}
2017-05-15 15:05:48 +00:00
- { 1 , 2 } target {
2011-10-20 00:55:54 +00:00
incr i
set : : TARGET [ lindex $argv $i ]
}
2017-05-15 15:05:48 +00:00
- { 1 , 2 } skip_run {
2011-02-09 19:55:20 +00:00
set : : SKIP_RUN 1
}
2020-01-17 19:14:08 +00:00
- { 1 , 2 } run {
set : : SKIP_RUN 0
}
2011-02-09 19:55:20 +00:00
2017-05-15 15:05:48 +00:00
- { 1 , 2 } help {
puts $::USAGE_MESSAGE
exit
}
-. * {
puts stderr " U n k n o w n o p t i o n : [ l i n d e x $ a r g v i ] "
puts stderr $::USAGE_MESSAGE
exit 1
}
2006-01-26 13:11:36 +00:00
default {
2011-04-06 17:54:31 +00:00
if { [ info exists : : SYMBOL] } {
puts stderr [ string trim $::USAGE_MESSAGE ]
exit - 1
}
set : : SYMBOL [ lindex $argv $i ]
2006-01-26 13:11:36 +00:00
}
}
set : : MAKEFILE [ file normalize $::MAKEFILE ]
}
}
# Main routine.
#
2006-06-20 11:01:07 +00:00
2006-01-26 13:11:36 +00:00
proc main { argv } {
# List of SQLITE_OMIT_XXX symbols supported by SQLite.
2011-02-09 19:55:20 +00:00
set : : OMIT_SYMBOLS [ list \
SQLITE_OMIT_ALTERTABLE \
SQLITE_OMIT_ANALYZE \
SQLITE_OMIT_ATTACH \
SQLITE_OMIT_AUTHORIZATION \
SQLITE_OMIT_AUTOINCREMENT \
SQLITE_OMIT_AUTOINIT \
SQLITE_OMIT_AUTOMATIC_INDEX \
SQLITE_OMIT_AUTORESET \
SQLITE_OMIT_AUTOVACUUM \
2023-05-05 14:16:31 +00:00
SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_BETWEEN_OPTIMIZATION \
SQLITE_OMIT_BLOB_LITERAL \
2020-01-17 19:14:08 +00:00
SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_CAST \
SQLITE_OMIT_CHECK \
SQLITE_OMIT_COMPILEOPTION_DIAGS \
SQLITE_OMIT_COMPLETE \
SQLITE_OMIT_COMPOUND_SELECT \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_CONFLICT_CLAUSE \
2014-01-25 12:16:53 +00:00
SQLITE_OMIT_CTE \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_DATETIME_FUNCS \
SQLITE_OMIT_DECLTYPE \
SQLITE_OMIT_DEPRECATED \
2021-05-08 17:18:23 +00:00
SQLITE_OMIT_DESERIALIZE \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_DISKIO \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_EXPLAIN \
SQLITE_OMIT_FLAG_PRAGMAS \
SQLITE_OMIT_FLOATING_POINT \
SQLITE_OMIT_FOREIGN_KEY \
2020-01-17 19:14:08 +00:00
SQLITE_OMIT_GENERATED_COLUMNS \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_GET_TABLE \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_HEX_INTEGER \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_INCRBLOB \
SQLITE_OMIT_INTEGRITY_CHECK \
2020-01-17 19:14:08 +00:00
SQLITE_OMIT_INTROSPECTION_PRAGMAS \
2022-02-21 13:02:23 +00:00
SQLITE_OMIT_JSON \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_LIKE_OPTIMIZATION \
SQLITE_OMIT_LOAD_EXTENSION \
SQLITE_OMIT_LOCALTIME \
SQLITE_OMIT_LOOKASIDE \
SQLITE_OMIT_MEMORYDB \
SQLITE_OMIT_OR_OPTIMIZATION \
2023-05-05 14:16:31 +00:00
SQLITE_OMIT_PAGER_PRAGMAS \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_PARSER_TRACE \
SQLITE_OMIT_POPEN \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_PRAGMA \
SQLITE_OMIT_PROGRESS_CALLBACK \
SQLITE_OMIT_QUICKBALANCE \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_RANDOMNESS \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_REINDEX \
SQLITE_OMIT_SCHEMA_PRAGMAS \
2006-01-26 13:11:36 +00:00
SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_SHARED_CACHE \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_SHUTDOWN_DIRECTORIES \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_SUBQUERY \
SQLITE_OMIT_TCL_VARIABLE \
SQLITE_OMIT_TEMPDB \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_TEST_CONTROL \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_TRACE \
SQLITE_OMIT_TRIGGER \
SQLITE_OMIT_TRUNCATE_OPTIMIZATION \
2023-05-05 14:16:31 +00:00
SQLITE_OMIT_TWOSIZE_LOOKASIDE \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_UPSERT \
2023-05-05 14:16:31 +00:00
SQLITE_OMIT_UTF \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_VACUUM \
SQLITE_OMIT_VIEW \
SQLITE_OMIT_VIRTUALTABLE \
SQLITE_OMIT_WAL \
2019-04-10 18:29:40 +00:00
SQLITE_OMIT_WINDOWFUNC \
2011-02-09 19:55:20 +00:00
SQLITE_OMIT_WSD \
SQLITE_OMIT_XFER_OPT \
]
set : : ENABLE_SYMBOLS [ list \
2021-04-07 18:08:23 +00:00
SQLITE_ALLOW_ROWID_IN_VIEW \
2011-02-09 19:55:20 +00:00
SQLITE_DISABLE_DIRSYNC \
2023-05-05 14:16:31 +00:00
SQLITE_DISABLE_FTS \
SQLITE_DISABLE_INTRINSIC \
2011-02-09 19:55:20 +00:00
SQLITE_DISABLE_LFS \
2023-05-05 14:16:31 +00:00
SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS \
SQLITE_DISABLE_SKIPAHEAD_DISTINCT \
SQLITE_ENABLE_API_ARMOR \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_ATOMIC_WRITE \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_BATCH_ATOMIC_WRITE \
SQLITE_ENABLE_BYTECODE_VTAB \
SQLITE_ENABLE_CEROD \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_COLUMN_METADATA \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_COLUMN_USED_MASK \
SQLITE_ENABLE_COMMENTS \
SQLITE_ENABLE_CORRUPT_PGNO \
SQLITE_ENABLE_COSTMULT \
SQLITE_ENABLE_CURSOR_HINTS \
SQLITE_ENABLE_DBPAGE_VTAB \
SQLITE_ENABLE_DBSTAT_VTAB \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_EXPENSIVE_ASSERT \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_EXPLAIN_COMMENTS \
SQLITE_ENABLE_FTS \
SQLITE_ENABLE_GEOPOLY \
SQLITE_ENABLE_HIDDEN_COLUMNS \
SQLITE_ENABLE_ICU \
SQLITE_ENABLE_ICU_COLLATIONS \
SQLITE_ENABLE_INTERNAL_FUNCTIONS \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_IOTRACE \
SQLITE_ENABLE_LOAD_EXTENSION \
SQLITE_ENABLE_LOCKING_STYLE \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_MATH_FUNCTIONS \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_MEMORY_MANAGEMENT \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_MEMSYS \
SQLITE_ENABLE_MODULE_COMMENTS \
SQLITE_ENABLE_MULTIPLEX \
SQLITE_ENABLE_MULTITHREADED_CHECKS \
SQLITE_ENABLE_NORMALIZE \
SQLITE_ENABLE_NULL_TRIM \
SQLITE_ENABLE_OFFSET_SQL_FUNC \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_OVERSIZE_CELL_CHECK \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_PREUPDATE_HOOK \
SQLITE_ENABLE_QPSG \
SQLITE_ENABLE_RBU \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_RTREE \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_SELECTTRACE \
SQLITE_ENABLE_SESSION \
SQLITE_ENABLE_SETLK_TIMEOUT \
SQLITE_ENABLE_SNAPSHOT \
SQLITE_ENABLE_SORTER_MMAP \
SQLITE_ENABLE_SORTER_REFERENCE \
SQLITE_ENABLE_SORTER_REFERENCES \
SQLITE_ENABLE_SQLLOG \
SQLITE_ENABLE_STAT \
SQLITE_ENABLE_STMT_SCANSTATUS \
SQLITE_ENABLE_STMTVTAB \
SQLITE_ENABLE_TREETRACE \
SQLITE_ENABLE_UNKNOWN_FUNCTION \
SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
2011-02-09 19:55:20 +00:00
SQLITE_ENABLE_UNLOCK_NOTIFY \
SQLITE_ENABLE_UPDATE_DELETE_LIMIT \
2023-05-05 14:16:31 +00:00
SQLITE_ENABLE_URI_00_ERROR \
SQLITE_ENABLE_VFSTRACE \
SQLITE_ENABLE_WHERETRACE \
SQLITE_ENABLE_ZIPVFS \
2006-01-26 13:11:36 +00:00
]
# Process any command line options.
process_options $argv
2011-02-09 19:55:20 +00:00
2011-04-06 17:54:31 +00:00
if { [ info exists : : SYMBOL] } {
set sym $::SYMBOL
2008-07-31 02:43:34 +00:00
2011-04-06 17:54:31 +00:00
if { [ lsearch $::OMIT_SYMBOLS $sym ] < 0 && [ lsearch $::ENABLE_SYMBOLS $sym ] < 0 } {
puts stderr " N o s u c h s y m b o l : $ s y m "
exit - 1
}
2011-02-09 19:55:20 +00:00
2011-06-22 20:14:09 +00:00
set dirname " t e s t _ [ r e g s u b - n o c a s e { ^ x * S Q L I T E _ } $ s y m { } ] "
2006-01-26 13:11:36 +00:00
run_quick_test $dirname $sym
2011-04-06 17:54:31 +00:00
} else {
# First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT
# and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults)
# and the latter is currently incompatible with the test suite (this should
# be fixed, but it will be a lot of work).
set allsyms [ list ]
foreach s $::OMIT_SYMBOLS {
if { $s != " S Q L I T E _ O M I T _ F L O A T I N G _ P O I N T " && $s != " S Q L I T E _ O M I T _ P R A G M A " } {
lappend allsyms $s
}
}
run_quick_test test_OMIT_EVERYTHING $allsyms
# Now try one quick.test with each of the OMIT symbols defined. Included
# are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we
# know they will fail. It's good to be reminded of this from time to time.
foreach sym $::OMIT_SYMBOLS {
2011-06-22 20:14:09 +00:00
set dirname " t e s t _ [ r e g s u b - n o c a s e { ^ x * S Q L I T E _ } $ s y m { } ] "
2011-04-06 17:54:31 +00:00
run_quick_test $dirname $sym
}
# Try the ENABLE/DISABLE symbols one at a time.
# We don't do them all at once since some are conflicting.
foreach sym $::ENABLE_SYMBOLS {
2011-06-22 20:14:09 +00:00
set dirname " t e s t _ [ r e g s u b - n o c a s e { ^ x * S Q L I T E _ } $ s y m { } ] "
2011-04-06 17:54:31 +00:00
run_quick_test $dirname $sym
}
2006-01-26 13:11:36 +00:00
}
}
main $argv