drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1 | #!/usr/bin/tclsh |
| 2 | # |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 3 | # Documentation for this script. This may be output to stderr |
| 4 | # if the script is invoked incorrectly. See the [process_options] |
| 5 | # proc below. |
| 6 | # |
| 7 | set ::USAGE_MESSAGE { |
| 8 | This Tcl script is used to test the various configurations required |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 9 | before releasing a new version. Supported command line options (all |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 10 | optional) are: |
| 11 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 12 | --buildonly (Just build testfixture - do not run) |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 13 | --config CONFIGNAME (Run only CONFIGNAME) |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 14 | --dryrun (Print what would have happened) |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 15 | -f|--force (Run even if uncommitted changes) |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 16 | --info (Show diagnostic info) |
dan | e9e1505 | 2015-11-02 20:28:48 +0000 | [diff] [blame] | 17 | --jobs N (Use N processes - default 1) |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 18 | --keep (Delete no files after each test run) |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 19 | --msvc (Use MSVC as the compiler) |
| 20 | --platform PLATFORM (see below) |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 21 | --progress (Show progress messages) |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 22 | --quick (Run "veryquick.test" only) |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 23 | --veryquick (Run "make smoketest" only) |
| 24 | --with-tcl=DIR (Use TCL build at DIR) |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 25 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 26 | The script determines the default value for --platform using the |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 27 | $tcl_platform(os) and $tcl_platform(machine) variables. Supported |
| 28 | platforms are "Linux-x86", "Linux-x86_64", "Darwin-i386", |
| 29 | "Darwin-x86_64", "Windows NT-intel", and "Windows NT-amd64". |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 30 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 31 | Every test begins with a fresh run of the configure script at the top |
| 32 | of the SQLite source tree. |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 33 | } |
| 34 | |
drh | 4380ff8 | 2015-11-03 15:16:21 +0000 | [diff] [blame] | 35 | # Return a timestamp of the form HH:MM:SS |
| 36 | # |
| 37 | proc now {} { |
| 38 | return [clock format [clock seconds] -format %H:%M:%S] |
| 39 | } |
| 40 | |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 41 | # Omit comments (text between # and \n) in a long multi-line string. |
| 42 | # |
| 43 | proc strip_comments {in} { |
| 44 | regsub -all {#[^\n]*\n} $in {} out |
| 45 | return $out |
| 46 | } |
| 47 | |
| 48 | array set ::Configs [strip_comments { |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 49 | "Default" { |
| 50 | -O2 |
drh | edb31cd | 2015-01-08 02:15:11 +0000 | [diff] [blame] | 51 | --disable-amalgamation --disable-shared |
drh | 5e18d40 | 2016-05-03 13:14:18 +0000 | [diff] [blame] | 52 | --enable-session |
dan | 531230d | 2019-02-06 15:23:43 +0000 | [diff] [blame] | 53 | -DSQLITE_ENABLE_DESERIALIZE |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 54 | } |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 55 | "Sanitize" { |
drh | 149735d | 2015-01-01 19:53:10 +0000 | [diff] [blame] | 56 | CC=clang -fsanitize=undefined |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 57 | -DSQLITE_ENABLE_STAT4 |
drh | 5e18d40 | 2016-05-03 13:14:18 +0000 | [diff] [blame] | 58 | --enable-session |
dan | 5608973 | 2011-04-06 12:37:09 +0000 | [diff] [blame] | 59 | } |
drh | 8ef24b8 | 2016-08-01 15:00:00 +0000 | [diff] [blame] | 60 | "Stdcall" { |
| 61 | -DUSE_STDCALL=1 |
| 62 | -O2 |
| 63 | } |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 64 | "Have-Not" { |
| 65 | # The "Have-Not" configuration sets all possible -UHAVE_feature options |
| 66 | # in order to verify that the code works even on platforms that lack |
| 67 | # these support services. |
| 68 | -DHAVE_FDATASYNC=0 |
| 69 | -DHAVE_GMTIME_R=0 |
drh | 8567d40 | 2015-01-10 18:22:06 +0000 | [diff] [blame] | 70 | -DHAVE_ISNAN=0 |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 71 | -DHAVE_LOCALTIME_R=0 |
| 72 | -DHAVE_LOCALTIME_S=0 |
| 73 | -DHAVE_MALLOC_USABLE_SIZE=0 |
| 74 | -DHAVE_STRCHRNUL=0 |
| 75 | -DHAVE_USLEEP=0 |
| 76 | -DHAVE_UTIME=0 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 77 | } |
| 78 | "Unlock-Notify" { |
| 79 | -O2 |
| 80 | -DSQLITE_ENABLE_UNLOCK_NOTIFY |
| 81 | -DSQLITE_THREADSAFE |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 82 | -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 |
dan | 1af016b | 2018-11-28 08:09:08 +0000 | [diff] [blame] | 83 | } |
| 84 | "User-Auth" { |
| 85 | -O2 |
dan | 6705584 | 2018-09-25 13:51:31 +0000 | [diff] [blame] | 86 | -DSQLITE_USER_AUTHENTICATION=1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 87 | } |
| 88 | "Secure-Delete" { |
| 89 | -O2 |
| 90 | -DSQLITE_SECURE_DELETE=1 |
| 91 | -DSQLITE_SOUNDEX=1 |
| 92 | } |
| 93 | "Update-Delete-Limit" { |
| 94 | -O2 |
| 95 | -DSQLITE_DEFAULT_FILE_FORMAT=4 |
| 96 | -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 |
drh | 1a80384 | 2015-01-09 20:00:21 +0000 | [diff] [blame] | 97 | -DSQLITE_ENABLE_STMT_SCANSTATUS |
drh | 7f10579 | 2016-01-04 01:08:50 +0000 | [diff] [blame] | 98 | -DSQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 99 | -DSQLITE_ENABLE_CURSOR_HINTS |
drh | ce1d9f5 | 2015-10-09 12:48:33 +0000 | [diff] [blame] | 100 | --enable-json1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 101 | } |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 102 | "Check-Symbols" { |
| 103 | -DSQLITE_MEMDEBUG=1 |
| 104 | -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 |
| 105 | -DSQLITE_ENABLE_FTS3=1 |
| 106 | -DSQLITE_ENABLE_RTREE=1 |
| 107 | -DSQLITE_ENABLE_MEMSYS5=1 |
| 108 | -DSQLITE_ENABLE_MEMSYS3=1 |
| 109 | -DSQLITE_ENABLE_COLUMN_METADATA=1 |
| 110 | -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 |
| 111 | -DSQLITE_SECURE_DELETE=1 |
| 112 | -DSQLITE_SOUNDEX=1 |
| 113 | -DSQLITE_ENABLE_ATOMIC_WRITE=1 |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 114 | -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 115 | -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 116 | -DSQLITE_ENABLE_STAT4 |
drh | 1a80384 | 2015-01-09 20:00:21 +0000 | [diff] [blame] | 117 | -DSQLITE_ENABLE_STMT_SCANSTATUS |
drh | 5e18d40 | 2016-05-03 13:14:18 +0000 | [diff] [blame] | 118 | --enable-json1 --enable-fts5 --enable-session |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 119 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 120 | "Debug-One" { |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 121 | --disable-shared |
drh | 2acd24d | 2017-09-18 00:18:31 +0000 | [diff] [blame] | 122 | -O2 -funsigned-char |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 123 | -DSQLITE_DEBUG=1 |
| 124 | -DSQLITE_MEMDEBUG=1 |
| 125 | -DSQLITE_MUTEX_NOOP=1 |
| 126 | -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 |
| 127 | -DSQLITE_ENABLE_FTS3=1 |
| 128 | -DSQLITE_ENABLE_RTREE=1 |
| 129 | -DSQLITE_ENABLE_MEMSYS5=1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 130 | -DSQLITE_ENABLE_COLUMN_METADATA=1 |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 131 | -DSQLITE_ENABLE_STAT4 |
drh | 03d69a6 | 2015-11-19 13:53:57 +0000 | [diff] [blame] | 132 | -DSQLITE_ENABLE_HIDDEN_COLUMNS |
drh | edb31cd | 2015-01-08 02:15:11 +0000 | [diff] [blame] | 133 | -DSQLITE_MAX_ATTACHED=125 |
drh | 2f65b2f | 2017-10-02 21:29:51 +0000 | [diff] [blame] | 134 | -DSQLITE_MUTATION_TEST |
dan | 466ea9b | 2018-06-13 11:11:13 +0000 | [diff] [blame] | 135 | --enable-fts5 --enable-json1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 136 | } |
drh | f332071 | 2015-04-25 13:39:29 +0000 | [diff] [blame] | 137 | "Fast-One" { |
| 138 | -O6 |
| 139 | -DSQLITE_ENABLE_FTS4=1 |
| 140 | -DSQLITE_ENABLE_RTREE=1 |
| 141 | -DSQLITE_ENABLE_STAT4 |
drh | cfb8f8d | 2015-07-23 20:44:49 +0000 | [diff] [blame] | 142 | -DSQLITE_ENABLE_RBU |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 143 | -DSQLITE_MAX_ATTACHED=125 |
drh | 51675f2 | 2015-11-06 20:04:08 +0000 | [diff] [blame] | 144 | -DLONGDOUBLE_TYPE=double |
drh | 5e18d40 | 2016-05-03 13:14:18 +0000 | [diff] [blame] | 145 | --enable-session |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 146 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 147 | "Device-One" { |
| 148 | -O2 |
| 149 | -DSQLITE_DEBUG=1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 150 | -DSQLITE_DEFAULT_AUTOVACUUM=1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 151 | -DSQLITE_DEFAULT_CACHE_SIZE=64 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 152 | -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 153 | -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 154 | -DSQLITE_DISABLE_LFS=1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 155 | -DSQLITE_ENABLE_ATOMIC_WRITE=1 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 156 | -DSQLITE_ENABLE_IOTRACE=1 |
| 157 | -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 158 | -DSQLITE_MAX_PAGE_SIZE=4096 |
| 159 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 160 | -DSQLITE_OMIT_PROGRESS_CALLBACK=1 |
| 161 | -DSQLITE_OMIT_VIRTUALTABLE=1 |
drh | 03d69a6 | 2015-11-19 13:53:57 +0000 | [diff] [blame] | 162 | -DSQLITE_ENABLE_HIDDEN_COLUMNS |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 163 | -DSQLITE_TEMP_STORE=3 |
drh | 64db184 | 2015-10-09 13:29:27 +0000 | [diff] [blame] | 164 | --enable-json1 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 165 | } |
| 166 | "Device-Two" { |
| 167 | -DSQLITE_4_BYTE_ALIGNED_MALLOC=1 |
| 168 | -DSQLITE_DEFAULT_AUTOVACUUM=1 |
| 169 | -DSQLITE_DEFAULT_CACHE_SIZE=1000 |
| 170 | -DSQLITE_DEFAULT_LOCKING_MODE=0 |
| 171 | -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
| 172 | -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000 |
| 173 | -DSQLITE_DISABLE_LFS=1 |
| 174 | -DSQLITE_ENABLE_FTS3=1 |
| 175 | -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 176 | -DSQLITE_ENABLE_RTREE=1 |
| 177 | -DSQLITE_MAX_COMPOUND_SELECT=50 |
| 178 | -DSQLITE_MAX_PAGE_SIZE=32768 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 179 | -DSQLITE_OMIT_TRACE=1 |
| 180 | -DSQLITE_TEMP_STORE=3 |
| 181 | -DSQLITE_THREADSAFE=2 |
dan | 3a95c65 | 2018-03-28 20:29:04 +0000 | [diff] [blame] | 182 | -DSQLITE_ENABLE_DESERIALIZE=1 |
drh | 5e18d40 | 2016-05-03 13:14:18 +0000 | [diff] [blame] | 183 | --enable-json1 --enable-fts5 --enable-session |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 184 | } |
| 185 | "Locking-Style" { |
| 186 | -O2 |
| 187 | -DSQLITE_ENABLE_LOCKING_STYLE=1 |
| 188 | } |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 189 | "Apple" { |
drh | 92b7175 | 2017-05-23 19:35:20 +0000 | [diff] [blame] | 190 | -Os |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 191 | -DHAVE_GMTIME_R=1 |
| 192 | -DHAVE_ISNAN=1 |
| 193 | -DHAVE_LOCALTIME_R=1 |
| 194 | -DHAVE_PREAD=1 |
| 195 | -DHAVE_PWRITE=1 |
| 196 | -DHAVE_USLEEP=1 |
| 197 | -DHAVE_USLEEP=1 |
| 198 | -DHAVE_UTIME=1 |
| 199 | -DSQLITE_DEFAULT_CACHE_SIZE=1000 |
| 200 | -DSQLITE_DEFAULT_CKPTFULLFSYNC=1 |
| 201 | -DSQLITE_DEFAULT_MEMSTATUS=1 |
| 202 | -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
| 203 | -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1 |
| 204 | -DSQLITE_ENABLE_API_ARMOR=1 |
| 205 | -DSQLITE_ENABLE_AUTO_PROFILE=1 |
| 206 | -DSQLITE_ENABLE_FLOCKTIMEOUT=1 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 207 | -DSQLITE_ENABLE_FTS3=1 |
| 208 | -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 209 | -DSQLITE_ENABLE_FTS3_TOKENIZER=1 |
| 210 | if:os=="Darwin" -DSQLITE_ENABLE_LOCKING_STYLE=1 |
| 211 | -DSQLITE_ENABLE_PERSIST_WAL=1 |
| 212 | -DSQLITE_ENABLE_PURGEABLE_PCACHE=1 |
| 213 | -DSQLITE_ENABLE_RTREE=1 |
| 214 | -DSQLITE_ENABLE_SNAPSHOT=1 |
| 215 | # -DSQLITE_ENABLE_SQLLOG=1 |
| 216 | -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 217 | -DSQLITE_MAX_LENGTH=2147483645 |
| 218 | -DSQLITE_MAX_VARIABLE_NUMBER=500000 |
drh | 9493caf | 2016-03-17 23:16:37 +0000 | [diff] [blame] | 219 | # -DSQLITE_MEMDEBUG=1 |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 220 | -DSQLITE_NO_SYNC=1 |
| 221 | -DSQLITE_OMIT_AUTORESET=1 |
| 222 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 223 | -DSQLITE_PREFER_PROXY_LOCKING=1 |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 224 | -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 |
| 225 | -DSQLITE_THREADSAFE=2 |
| 226 | -DSQLITE_USE_URI=1 |
| 227 | -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1 |
| 228 | -DUSE_GUARDED_FD=1 |
| 229 | -DUSE_PREAD=1 |
drh | ce1d9f5 | 2015-10-09 12:48:33 +0000 | [diff] [blame] | 230 | --enable-json1 --enable-fts5 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 231 | } |
| 232 | "Extra-Robustness" { |
| 233 | -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 |
dan | 5608973 | 2011-04-06 12:37:09 +0000 | [diff] [blame] | 234 | -DSQLITE_MAX_ATTACHED=62 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 235 | } |
dan | 4dc3d73 | 2012-08-20 17:24:48 +0000 | [diff] [blame] | 236 | "Devkit" { |
| 237 | -DSQLITE_DEFAULT_FILE_FORMAT=4 |
| 238 | -DSQLITE_MAX_ATTACHED=30 |
| 239 | -DSQLITE_ENABLE_COLUMN_METADATA |
| 240 | -DSQLITE_ENABLE_FTS4 |
dan | e82126c | 2016-03-01 16:02:57 +0000 | [diff] [blame] | 241 | -DSQLITE_ENABLE_FTS5 |
dan | 4dc3d73 | 2012-08-20 17:24:48 +0000 | [diff] [blame] | 242 | -DSQLITE_ENABLE_FTS4_PARENTHESIS |
| 243 | -DSQLITE_DISABLE_FTS4_DEFERRED |
| 244 | -DSQLITE_ENABLE_RTREE |
drh | ce1d9f5 | 2015-10-09 12:48:33 +0000 | [diff] [blame] | 245 | --enable-json1 --enable-fts5 |
dan | 4dc3d73 | 2012-08-20 17:24:48 +0000 | [diff] [blame] | 246 | } |
dan | d79d27a | 2014-08-12 14:06:13 +0000 | [diff] [blame] | 247 | "No-lookaside" { |
| 248 | -DSQLITE_TEST_REALLOC_STRESS=1 |
| 249 | -DSQLITE_OMIT_LOOKASIDE=1 |
| 250 | -DHAVE_USLEEP=1 |
| 251 | } |
drh | 8a2a0f5 | 2015-01-07 14:09:41 +0000 | [diff] [blame] | 252 | "Valgrind" { |
| 253 | -DSQLITE_ENABLE_STAT4 |
| 254 | -DSQLITE_ENABLE_FTS4 |
| 255 | -DSQLITE_ENABLE_RTREE |
drh | 03d69a6 | 2015-11-19 13:53:57 +0000 | [diff] [blame] | 256 | -DSQLITE_ENABLE_HIDDEN_COLUMNS |
drh | ce1d9f5 | 2015-10-09 12:48:33 +0000 | [diff] [blame] | 257 | --enable-json1 |
drh | 8a2a0f5 | 2015-01-07 14:09:41 +0000 | [diff] [blame] | 258 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 259 | |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 260 | # The next group of configurations are used only by the |
| 261 | # Failure-Detection platform. They are all the same, but we need |
| 262 | # different names for them all so that they results appear in separate |
| 263 | # subdirectories. |
| 264 | # |
drh | edb31cd | 2015-01-08 02:15:11 +0000 | [diff] [blame] | 265 | Fail0 {-O0} |
| 266 | Fail2 {-O0} |
| 267 | Fail3 {-O0} |
drh | db6bafa | 2015-01-09 21:54:58 +0000 | [diff] [blame] | 268 | Fail4 {-O0} |
drh | 8ea5eca | 2015-04-24 16:53:03 +0000 | [diff] [blame] | 269 | FuzzFail1 {-O0} |
| 270 | FuzzFail2 {-O0} |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 271 | }] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 272 | |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 273 | array set ::Platforms [strip_comments { |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 274 | Linux-x86_64 { |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 275 | "Check-Symbols" checksymbols |
dan | f86ff13 | 2018-09-13 17:11:51 +0000 | [diff] [blame] | 276 | "Fast-One" "fuzztest test" |
drh | bd41d56 | 2014-12-30 20:40:32 +0000 | [diff] [blame] | 277 | "Debug-One" "mptest test" |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 278 | "Have-Not" test |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 279 | "Secure-Delete" test |
| 280 | "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" |
dan | 1af016b | 2018-11-28 08:09:08 +0000 | [diff] [blame] | 281 | "User-Auth" tcltest |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 282 | "Update-Delete-Limit" test |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 283 | "Extra-Robustness" test |
dan | a082cd7 | 2019-07-04 16:05:26 +0000 | [diff] [blame] | 284 | "Device-Two" "threadtest test" |
dan | d79d27a | 2014-08-12 14:06:13 +0000 | [diff] [blame] | 285 | "No-lookaside" test |
dan | 5d510d4 | 2014-10-15 15:28:27 +0000 | [diff] [blame] | 286 | "Devkit" test |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 287 | "Apple" test |
drh | 8a2a0f5 | 2015-01-07 14:09:41 +0000 | [diff] [blame] | 288 | "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 289 | "Device-One" fulltest |
drh | 71258ab | 2015-11-04 16:34:58 +0000 | [diff] [blame] | 290 | "Default" "threadtest fulltest" |
| 291 | "Valgrind" valgrindtest |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 292 | } |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 293 | Linux-i686 { |
dan | 4dc3d73 | 2012-08-20 17:24:48 +0000 | [diff] [blame] | 294 | "Devkit" test |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 295 | "Have-Not" test |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 296 | "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 297 | "Device-One" test |
dan | d38bc1b | 2010-09-13 12:15:36 +0000 | [diff] [blame] | 298 | "Device-Two" test |
| 299 | "Default" "threadtest fulltest" |
dan | 1c22a18 | 2010-09-13 11:29:02 +0000 | [diff] [blame] | 300 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 301 | Darwin-i386 { |
drh | bd41d56 | 2014-12-30 20:40:32 +0000 | [diff] [blame] | 302 | "Locking-Style" "mptest test" |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 303 | "Have-Not" test |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 304 | "Apple" "threadtest fulltest" |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 305 | } |
drh | bcbac68 | 2014-12-31 18:55:09 +0000 | [diff] [blame] | 306 | Darwin-x86_64 { |
| 307 | "Locking-Style" "mptest test" |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 308 | "Have-Not" test |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 309 | "Apple" "threadtest fulltest" |
drh | bcbac68 | 2014-12-31 18:55:09 +0000 | [diff] [blame] | 310 | } |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 311 | "Windows NT-intel" { |
drh | 8ef24b8 | 2016-08-01 15:00:00 +0000 | [diff] [blame] | 312 | "Stdcall" test |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 313 | "Have-Not" test |
drh | 71258ab | 2015-11-04 16:34:58 +0000 | [diff] [blame] | 314 | "Default" "mptest fulltestonly" |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 315 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 316 | "Windows NT-amd64" { |
drh | 8ef24b8 | 2016-08-01 15:00:00 +0000 | [diff] [blame] | 317 | "Stdcall" test |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 318 | "Have-Not" test |
drh | 71258ab | 2015-11-04 16:34:58 +0000 | [diff] [blame] | 319 | "Default" "mptest fulltestonly" |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 320 | } |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 321 | |
| 322 | # The Failure-Detection platform runs various tests that deliberately |
| 323 | # fail. This is used as a test of this script to verify that this script |
| 324 | # correctly identifies failures. |
| 325 | # |
drh | edb31cd | 2015-01-08 02:15:11 +0000 | [diff] [blame] | 326 | Failure-Detection { |
| 327 | Fail0 "TEST_FAILURE=0 test" |
| 328 | Sanitize "TEST_FAILURE=1 test" |
| 329 | Fail2 "TEST_FAILURE=2 valgrindtest" |
| 330 | Fail3 "TEST_FAILURE=3 valgrindtest" |
drh | db6bafa | 2015-01-09 21:54:58 +0000 | [diff] [blame] | 331 | Fail4 "TEST_FAILURE=4 test" |
drh | 8ea5eca | 2015-04-24 16:53:03 +0000 | [diff] [blame] | 332 | FuzzFail1 "TEST_FAILURE=5 test" |
| 333 | FuzzFail2 "TEST_FAILURE=5 valgrindtest" |
drh | edb31cd | 2015-01-08 02:15:11 +0000 | [diff] [blame] | 334 | } |
drh | 6aed1c4 | 2015-01-10 15:21:26 +0000 | [diff] [blame] | 335 | }] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 336 | |
dan | e7152dc | 2011-07-07 08:19:16 +0000 | [diff] [blame] | 337 | |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 338 | # End of configuration section. |
| 339 | ######################################################################### |
| 340 | ######################################################################### |
| 341 | |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 342 | # Configuration verification: Check that each entry in the list of configs |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 343 | # specified for each platforms exists. |
| 344 | # |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 345 | foreach {key value} [array get ::Platforms] { |
| 346 | foreach {v t} $value { |
| 347 | if {0==[info exists ::Configs($v)]} { |
| 348 | puts stderr "No such configuration: \"$v\"" |
| 349 | exit -1 |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 354 | # Output log. Disabled for slave interpreters. |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 355 | # |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 356 | if {[lindex $argv end]!="--slave"} { |
| 357 | set LOG [open releasetest-out.txt w] |
| 358 | proc PUTS {txt} { |
| 359 | puts $txt |
| 360 | puts $::LOG $txt |
| 361 | flush $::LOG |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 362 | } |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 363 | proc PUTSNNL {txt} { |
| 364 | puts -nonewline $txt |
| 365 | puts -nonewline $::LOG $txt |
| 366 | flush $::LOG |
| 367 | } |
| 368 | proc PUTSERR {txt} { |
| 369 | puts stderr $txt |
| 370 | puts $::LOG $txt |
| 371 | flush $::LOG |
| 372 | } |
| 373 | puts $LOG "$argv0 $argv" |
| 374 | set tm0 [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S} -gmt 1] |
| 375 | puts $LOG "start-time: $tm0 UTC" |
| 376 | } else { |
| 377 | proc PUTS {txt} { |
| 378 | puts $txt |
| 379 | } |
| 380 | proc PUTSNNL {txt} { |
| 381 | puts -nonewline $txt |
| 382 | } |
| 383 | proc PUTSERR {txt} { |
| 384 | puts stderr $txt |
| 385 | } |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 386 | } |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 387 | |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 388 | # Open the file $logfile and look for a report on the number of errors |
| 389 | # and the number of test cases run. Add these values to the global |
| 390 | # $::NERRCASE and $::NTESTCASE variables. |
| 391 | # |
| 392 | # If any errors occur, then write into $errmsgVar the text of an appropriate |
| 393 | # one-line error message to show on the output. |
| 394 | # |
| 395 | proc count_tests_and_errors {logfile rcVar errmsgVar} { |
drh | cb281a9 | 2014-12-29 19:54:10 +0000 | [diff] [blame] | 396 | if {$::DRYRUN} return |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 397 | upvar 1 $rcVar rc $errmsgVar errmsg |
| 398 | set fd [open $logfile rb] |
| 399 | set seen 0 |
| 400 | while {![eof $fd]} { |
| 401 | set line [gets $fd] |
drh | bd41d56 | 2014-12-30 20:40:32 +0000 | [diff] [blame] | 402 | if {[regexp {(\d+) errors out of (\d+) tests} $line all nerr ntest]} { |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 403 | incr ::NERRCASE $nerr |
| 404 | incr ::NTESTCASE $ntest |
| 405 | set seen 1 |
| 406 | if {$nerr>0} { |
| 407 | set rc 1 |
| 408 | set errmsg $line |
| 409 | } |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 410 | } |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 411 | if {[regexp {runtime error: +(.*)} $line all msg]} { |
drh | 36c25f7 | 2015-07-29 20:24:39 +0000 | [diff] [blame] | 412 | # skip over "value is outside range" errors |
| 413 | if {[regexp {value .* is outside the range of representable} $line]} { |
| 414 | # noop |
drh | 9a50f4c | 2019-10-02 19:44:42 +0000 | [diff] [blame] | 415 | } elseif {[regexp {overflow: .* cannot be represented} $line]} { |
| 416 | # noop |
drh | 36c25f7 | 2015-07-29 20:24:39 +0000 | [diff] [blame] | 417 | } else { |
| 418 | incr ::NERRCASE |
| 419 | if {$rc==0} { |
| 420 | set rc 1 |
| 421 | set errmsg $msg |
| 422 | } |
drh | 4081d5d | 2015-01-01 23:02:01 +0000 | [diff] [blame] | 423 | } |
| 424 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 425 | if {[regexp {fatal error +(.*)} $line all msg]} { |
| 426 | incr ::NERRCASE |
| 427 | if {$rc==0} { |
| 428 | set rc 1 |
| 429 | set errmsg $msg |
| 430 | } |
| 431 | } |
drh | 8a2a0f5 | 2015-01-07 14:09:41 +0000 | [diff] [blame] | 432 | if {[regexp {ERROR SUMMARY: (\d+) errors.*} $line all cnt] && $cnt>0} { |
| 433 | incr ::NERRCASE |
| 434 | if {$rc==0} { |
| 435 | set rc 1 |
| 436 | set errmsg $all |
| 437 | } |
| 438 | } |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 439 | if {[regexp {^VERSION: 3\.\d+.\d+} $line]} { |
| 440 | set v [string range $line 9 end] |
| 441 | if {$::SQLITE_VERSION eq ""} { |
| 442 | set ::SQLITE_VERSION $v |
| 443 | } elseif {$::SQLITE_VERSION ne $v} { |
| 444 | set rc 1 |
| 445 | set errmsg "version conflict: {$::SQLITE_VERSION} vs. {$v}" |
| 446 | } |
| 447 | } |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 448 | } |
| 449 | close $fd |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 450 | if {$::BUILDONLY} { |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 451 | incr ::NTESTCASE |
| 452 | if {$rc!=0} { |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 453 | set errmsg "Build failed" |
| 454 | } |
| 455 | } elseif {!$seen} { |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 456 | set rc 1 |
| 457 | set errmsg "Test did not complete" |
drh | db6bafa | 2015-01-09 21:54:58 +0000 | [diff] [blame] | 458 | if {[file readable core]} { |
| 459 | append errmsg " - core file exists" |
| 460 | } |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 461 | } |
| 462 | } |
| 463 | |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 464 | #-------------------------------------------------------------------------- |
| 465 | # This command is invoked as the [main] routine for scripts run with the |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 466 | # "--slave" option. |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 467 | # |
| 468 | # For each test (i.e. "configure && make test" execution), the master |
| 469 | # process spawns a process with the --slave option. It writes two lines |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 470 | # to the slaves stdin. The first contains a single boolean value - the |
| 471 | # value of ::TRACE to use in the slave script. The second line contains a |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 472 | # list in the same format as each element of the list passed to the |
| 473 | # [run_all_test_suites] command in the master process. |
| 474 | # |
| 475 | # The slave then runs the "configure && make test" commands specified. It |
| 476 | # exits successfully if the tests passes, or with a non-zero error code |
| 477 | # otherwise. |
| 478 | # |
| 479 | proc run_slave_test {} { |
| 480 | # Read global vars configuration from stdin. |
| 481 | set V [gets stdin] |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 482 | foreach {::TRACE ::MSVC ::DRYRUN ::KEEPFILES} $V {} |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 483 | |
| 484 | # Read the test-suite configuration from stdin. |
| 485 | set T [gets stdin] |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 486 | foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 487 | |
| 488 | # Create and switch to the test directory. |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 489 | set normaldir [file normalize $dir] |
| 490 | set ::env(SQLITE_TMPDIR) $normaldir |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 491 | trace_cmd file mkdir $dir |
| 492 | trace_cmd cd $dir |
| 493 | catch {file delete core} |
| 494 | catch {file delete test.log} |
| 495 | |
| 496 | # Run the "./configure && make" commands. |
| 497 | set rc 0 |
| 498 | set rc [catch [configureCommand $configOpts]] |
| 499 | if {!$rc} { |
mistachkin | 5918943 | 2015-11-02 21:05:56 +0000 | [diff] [blame] | 500 | if {[info exists ::env(TCLSH_CMD)]} { |
| 501 | set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD) |
| 502 | } else { |
| 503 | unset -nocomplain savedEnv(TCLSH_CMD) |
| 504 | } |
| 505 | set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]] |
dan | 112e174 | 2019-04-16 10:51:29 +0000 | [diff] [blame] | 506 | |
| 507 | # Create a file called "makecommand.sh" containing the text of |
| 508 | # the make command line. |
| 509 | catch { |
| 510 | set cmd [makeCommand $testtarget $makeOpts $cflags $opts] |
| 511 | set fd [open makecommand.sh w] |
| 512 | foreach e $cmd { |
| 513 | if {[string first " " $e]>=0} { |
| 514 | puts -nonewline $fd "\"$e\"" |
| 515 | } else { |
| 516 | puts -nonewline $fd $e |
| 517 | } |
| 518 | puts -nonewline $fd " " |
| 519 | } |
| 520 | puts $fd "" |
| 521 | close $fd |
| 522 | } msg |
| 523 | |
| 524 | # Run the make command. |
| 525 | set rc [catch {trace_cmd exec {*}$cmd >>& test.log} msg] |
mistachkin | 5918943 | 2015-11-02 21:05:56 +0000 | [diff] [blame] | 526 | if {[info exists savedEnv(TCLSH_CMD)]} { |
| 527 | set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD) |
| 528 | } else { |
| 529 | unset -nocomplain ::env(TCLSH_CMD) |
| 530 | } |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 531 | } |
| 532 | |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 533 | # Clean up lots of extra files if --keep was not specified. |
| 534 | if {$::KEEPFILES==0} { cleanup $normaldir } |
| 535 | |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 536 | # Exis successfully if the test passed, or with a non-zero error code |
| 537 | # otherwise. |
| 538 | exit $rc |
| 539 | } |
| 540 | |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 541 | # This command is invoked in the master process each time a slave |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 542 | # file-descriptor is readable. |
| 543 | # |
| 544 | proc slave_fileevent {fd T tm1} { |
| 545 | global G |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 546 | foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 547 | |
| 548 | if {[eof $fd]} { |
| 549 | fconfigure $fd -blocking 1 |
| 550 | set rc [catch { close $fd }] |
| 551 | |
| 552 | set errmsg {} |
dan | e9e1505 | 2015-11-02 20:28:48 +0000 | [diff] [blame] | 553 | set logfile [file join $dir test.log] |
| 554 | if {[file exists $logfile]} { |
| 555 | count_tests_and_errors [file join $dir test.log] rc errmsg |
drh | 4380ff8 | 2015-11-03 15:16:21 +0000 | [diff] [blame] | 556 | } elseif {$rc==0 && !$::DRYRUN} { |
dan | e9e1505 | 2015-11-02 20:28:48 +0000 | [diff] [blame] | 557 | set rc 1 |
| 558 | set errmsg "no test.log file..." |
| 559 | } |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 560 | |
| 561 | if {!$::TRACE} { |
| 562 | set tm2 [clock seconds] |
| 563 | set hours [expr {($tm2-$tm1)/3600}] |
| 564 | set minutes [expr {(($tm2-$tm1)/60)%60}] |
| 565 | set seconds [expr {($tm2-$tm1)%60}] |
| 566 | set tm [format (%02d:%02d:%02d) $hours $minutes $seconds] |
| 567 | |
| 568 | if {$rc} { |
| 569 | set status FAIL |
| 570 | incr ::NERR |
| 571 | } else { |
| 572 | set status Ok |
| 573 | } |
| 574 | |
| 575 | set n [string length $title] |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 576 | if {$::PROGRESS_MSGS} { |
| 577 | PUTS "finished: ${title}[string repeat . [expr {53-$n}]] $status $tm" |
| 578 | } else { |
| 579 | PUTS "${title}[string repeat . [expr {63-$n}]] $status $tm" |
| 580 | } |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 581 | if {$errmsg!=""} {PUTS " $errmsg"} |
| 582 | flush stdout |
| 583 | } |
| 584 | |
| 585 | incr G(nJob) -1 |
| 586 | } else { |
| 587 | set line [gets $fd] |
| 588 | if {[string trim $line] != ""} { |
| 589 | puts "Trace : $title - \"$line\"" |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | #-------------------------------------------------------------------------- |
| 595 | # The only argument passed to this function is a list of test-suites to |
| 596 | # run. Each "test-suite" is itself a list consisting of the following |
| 597 | # elements: |
| 598 | # |
| 599 | # * Test title (for display). |
| 600 | # * The name of the directory to run the test in. |
| 601 | # * The argument for [configureCommand] |
| 602 | # * The first argument for [makeCommand] |
| 603 | # * The second argument for [makeCommand] |
| 604 | # * The third argument for [makeCommand] |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 605 | # |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 606 | proc run_all_test_suites {alltests} { |
| 607 | global G |
| 608 | set tests $alltests |
| 609 | |
| 610 | set G(nJob) 0 |
| 611 | |
| 612 | while {[llength $tests]>0 || $G(nJob)>0} { |
| 613 | if {$G(nJob)>=$::JOBS || [llength $tests]==0} { |
| 614 | vwait G(nJob) |
| 615 | } |
| 616 | |
| 617 | if {[llength $tests]>0} { |
| 618 | set T [lindex $tests 0] |
| 619 | set tests [lrange $tests 1 end] |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 620 | foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 621 | if {$::PROGRESS_MSGS && !$::TRACE} { |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 622 | set n [string length $title] |
drh | 4380ff8 | 2015-11-03 15:16:21 +0000 | [diff] [blame] | 623 | PUTS "starting: ${title} at [now]" |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 624 | flush stdout |
| 625 | } |
| 626 | |
| 627 | # Run the job. |
| 628 | # |
| 629 | set tm1 [clock seconds] |
| 630 | incr G(nJob) |
mistachkin | 5918943 | 2015-11-02 21:05:56 +0000 | [diff] [blame] | 631 | set script [file normalize [info script]] |
| 632 | set fd [open "|[info nameofexecutable] $script --slave" r+] |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 633 | fconfigure $fd -blocking 0 |
| 634 | fileevent $fd readable [list slave_fileevent $fd $T $tm1] |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 635 | puts $fd [list $::TRACE $::MSVC $::DRYRUN $::KEEPFILES] |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 636 | puts $fd [list {*}$T] |
| 637 | flush $fd |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | proc add_test_suite {listvar name testtarget config} { |
| 643 | upvar $listvar alltests |
| 644 | |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 645 | # Tcl variable $opts is used to build up the value used to set the |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 646 | # OPTS Makefile variable. Variable $cflags holds the value for |
| 647 | # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but |
| 648 | # CFLAGS is only passed to gcc. |
| 649 | # |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 650 | set makeOpts "" |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 651 | set cflags [expr {$::MSVC ? "-Zi" : "-g"}] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 652 | set opts "" |
drh | a780d8d | 2015-01-03 18:59:17 +0000 | [diff] [blame] | 653 | set title ${name}($testtarget) |
drh | 0ef84d0 | 2015-04-24 17:50:37 +0000 | [diff] [blame] | 654 | set configOpts $::WITHTCL |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 655 | set skip 0 |
drh | a780d8d | 2015-01-03 18:59:17 +0000 | [diff] [blame] | 656 | |
drh | 149735d | 2015-01-01 19:53:10 +0000 | [diff] [blame] | 657 | regsub -all {#[^\n]*\n} $config \n config |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 658 | foreach arg $config { |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 659 | if {$skip} { |
| 660 | set skip 0 |
| 661 | continue |
| 662 | } |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 663 | if {[regexp {^-[UD]} $arg]} { |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 664 | lappend opts $arg |
drh | 0ede9eb | 2015-01-10 16:49:23 +0000 | [diff] [blame] | 665 | } elseif {[regexp {^[A-Z]+=} $arg]} { |
drh | 149735d | 2015-01-01 19:53:10 +0000 | [diff] [blame] | 666 | lappend testtarget $arg |
drh | 790b151 | 2016-03-17 23:00:42 +0000 | [diff] [blame] | 667 | } elseif {[regexp {^if:([a-z]+)(.*)} $arg all key tail]} { |
| 668 | # Arguments of the form 'if:os=="Linux"' will cause the subsequent |
| 669 | # argument to be skipped if the $tcl_platform(os) is not "Linux", for |
| 670 | # example... |
| 671 | set skip [expr !(\$::tcl_platform($key)$tail)] |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 672 | } elseif {[regexp {^--(enable|disable)-} $arg]} { |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 673 | if {$::MSVC} { |
| 674 | if {$arg eq "--disable-amalgamation"} { |
| 675 | lappend makeOpts USE_AMALGAMATION=0 |
| 676 | continue |
| 677 | } |
| 678 | if {$arg eq "--disable-shared"} { |
| 679 | lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0 |
| 680 | continue |
| 681 | } |
| 682 | if {$arg eq "--enable-fts5"} { |
| 683 | lappend opts -DSQLITE_ENABLE_FTS5 |
| 684 | continue |
| 685 | } |
| 686 | if {$arg eq "--enable-json1"} { |
| 687 | lappend opts -DSQLITE_ENABLE_JSON1 |
| 688 | continue |
| 689 | } |
mistachkin | 7d3bfa2 | 2015-11-03 06:23:33 +0000 | [diff] [blame] | 690 | if {$arg eq "--enable-shared"} { |
| 691 | lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1 |
| 692 | continue |
| 693 | } |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 694 | } |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 695 | lappend configOpts $arg |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 696 | } else { |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 697 | if {$::MSVC} { |
| 698 | if {$arg eq "-g"} { |
| 699 | lappend cflags -Zi |
| 700 | continue |
| 701 | } |
| 702 | if {[regexp -- {^-O(\d+)$} $arg all level]} then { |
| 703 | lappend makeOpts OPTIMIZATIONS=$level |
| 704 | continue |
| 705 | } |
| 706 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 707 | lappend cflags $arg |
| 708 | } |
| 709 | } |
| 710 | |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 711 | # Disable sync to make testing faster. |
| 712 | # |
| 713 | lappend opts -DSQLITE_NO_SYNC=1 |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 714 | |
| 715 | # Some configurations already set HAVE_USLEEP; in that case, skip it. |
| 716 | # |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 717 | if {[lsearch -regexp $opts {^-DHAVE_USLEEP(?:=|$)}]==-1} { |
| 718 | lappend opts -DHAVE_USLEEP=1 |
| 719 | } |
| 720 | |
| 721 | # Add the define for this platform. |
| 722 | # |
| 723 | if {$::tcl_platform(platform)=="windows"} { |
| 724 | lappend opts -DSQLITE_OS_WIN=1 |
| 725 | } else { |
| 726 | lappend opts -DSQLITE_OS_UNIX=1 |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 727 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 728 | |
| 729 | # Set the sub-directory to use. |
| 730 | # |
| 731 | set dir [string tolower [string map {- _ " " _} $name]] |
| 732 | |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 733 | # Join option lists into strings, using space as delimiter. |
| 734 | # |
| 735 | set makeOpts [join $makeOpts " "] |
| 736 | set cflags [join $cflags " "] |
| 737 | set opts [join $opts " "] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 738 | |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 739 | lappend alltests [list \ |
| 740 | $title $dir $configOpts $testtarget $makeOpts $cflags $opts] |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 741 | } |
| 742 | |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 743 | # The following procedure returns the "configure" command to be exectued for |
| 744 | # the current platform, which may be Windows (via MinGW, etc). |
| 745 | # |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 746 | proc configureCommand {opts} { |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 747 | if {$::MSVC} return [list]; # This is not needed for MSVC. |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 748 | set result [list trace_cmd exec] |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 749 | if {$::tcl_platform(platform)=="windows"} { |
| 750 | lappend result sh |
| 751 | } |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 752 | lappend result $::SRCDIR/configure --enable-load-extension |
| 753 | foreach x $opts {lappend result $x} |
| 754 | lappend result >& test.log |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | # The following procedure returns the "make" command to be executed for the |
| 758 | # specified targets, compiler flags, and options. |
| 759 | # |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 760 | proc makeCommand { targets makeOpts cflags opts } { |
dan | 112e174 | 2019-04-16 10:51:29 +0000 | [diff] [blame] | 761 | set result [list] |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 762 | if {$::MSVC} { |
| 763 | set nmakeDir [file nativename $::SRCDIR] |
mistachkin | 98fea32 | 2015-11-03 02:47:11 +0000 | [diff] [blame] | 764 | set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]] |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 765 | lappend result nmake /f $nmakeFile TOP=$nmakeDir |
mistachkin | 992fdfc | 2018-01-05 19:27:19 +0000 | [diff] [blame] | 766 | set tclDir [file nativename [file normalize \ |
| 767 | [file dirname [file dirname [info nameofexecutable]]]]] |
| 768 | lappend result "TCLDIR=$tclDir" |
drh | 8ef24b8 | 2016-08-01 15:00:00 +0000 | [diff] [blame] | 769 | if {[regexp {USE_STDCALL=1} $cflags]} { |
| 770 | lappend result USE_STDCALL=1 |
| 771 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 772 | } else { |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 773 | lappend result make |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 774 | } |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 775 | foreach makeOpt $makeOpts { |
| 776 | lappend result $makeOpt |
| 777 | } |
| 778 | lappend result clean |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 779 | foreach target $targets { |
| 780 | lappend result $target |
| 781 | } |
dan | 112e174 | 2019-04-16 10:51:29 +0000 | [diff] [blame] | 782 | lappend result CFLAGS=$cflags OPTS=$opts |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 783 | } |
| 784 | |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 785 | # The following procedure prints its arguments if ::TRACE is true. |
| 786 | # And it executes the command of its arguments in the calling context |
| 787 | # if ::DRYRUN is false. |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 788 | # |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 789 | proc trace_cmd {args} { |
| 790 | if {$::TRACE} { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 791 | PUTS $args |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 792 | } |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 793 | set res "" |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 794 | if {!$::DRYRUN} { |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 795 | set res [uplevel 1 $args] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 796 | } |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 797 | return $res |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | |
| 801 | # This proc processes the command line options passed to this script. |
| 802 | # Currently the only option supported is "-makefile", default |
| 803 | # "releasetest.mk". Set the ::MAKEFILE variable to the value of this |
| 804 | # option. |
| 805 | # |
| 806 | proc process_options {argv} { |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 807 | set ::SRCDIR [file normalize [file dirname [file dirname $::argv0]]] |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 808 | set ::QUICK 0 |
| 809 | set ::MSVC 0 |
| 810 | set ::BUILDONLY 0 |
| 811 | set ::DRYRUN 0 |
| 812 | set ::TRACE 0 |
| 813 | set ::JOBS 1 |
| 814 | set ::PROGRESS_MSGS 0 |
| 815 | set ::WITHTCL {} |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 816 | set ::FORCE 0 |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 817 | set ::KEEPFILES 0 ;# Keep extra files after test run |
drh | 2eeb7ae | 2014-10-10 17:44:03 +0000 | [diff] [blame] | 818 | set config {} |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 819 | set platform $::tcl_platform(os)-$::tcl_platform(machine) |
| 820 | |
| 821 | for {set i 0} {$i < [llength $argv]} {incr i} { |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 822 | set x [lindex $argv $i] |
| 823 | if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]} |
drh | f167a40 | 2015-01-07 18:44:59 +0000 | [diff] [blame] | 824 | switch -glob -- $x { |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 825 | -slave { |
| 826 | run_slave_test |
| 827 | exit |
| 828 | } |
| 829 | |
drh | fe37658 | 2016-09-09 13:23:36 +0000 | [diff] [blame] | 830 | # Undocumented legacy option: --srcdir DIRECTORY |
| 831 | # |
| 832 | # DIRECTORY is the root of the SQLite checkout. This sets the |
| 833 | # SRCDIR global variable. But that variable is already set |
| 834 | # automatically so there really is no reason to have this option. |
| 835 | # |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 836 | -srcdir { |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 837 | incr i |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 838 | set ::SRCDIR [file normalize [lindex $argv $i]] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 839 | } |
| 840 | |
| 841 | -platform { |
| 842 | incr i |
| 843 | set platform [lindex $argv $i] |
| 844 | } |
| 845 | |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 846 | -jobs { |
| 847 | incr i |
| 848 | set ::JOBS [lindex $argv $i] |
| 849 | } |
| 850 | |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 851 | -progress { |
| 852 | set ::PROGRESS_MSGS 1 |
| 853 | } |
| 854 | |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 855 | -quick { |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 856 | set ::QUICK 1 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 857 | } |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 858 | -veryquick { |
| 859 | set ::QUICK 2 |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 860 | } |
drh | 2eeb7ae | 2014-10-10 17:44:03 +0000 | [diff] [blame] | 861 | |
| 862 | -config { |
| 863 | incr i |
| 864 | set config [lindex $argv $i] |
| 865 | } |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 866 | |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 867 | -msvc { |
| 868 | set ::MSVC 1 |
| 869 | } |
| 870 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 871 | -buildonly { |
| 872 | set ::BUILDONLY 1 |
| 873 | } |
| 874 | |
| 875 | -dryrun { |
| 876 | set ::DRYRUN 1 |
| 877 | } |
| 878 | |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 879 | -force - |
| 880 | -f { |
| 881 | set ::FORCE 1 |
| 882 | } |
| 883 | |
drh | 8f45555 | 2015-01-07 14:41:18 +0000 | [diff] [blame] | 884 | -trace { |
| 885 | set ::TRACE 1 |
| 886 | } |
| 887 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 888 | -info { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 889 | PUTS "Command-line Options:" |
| 890 | PUTS " --srcdir $::SRCDIR" |
| 891 | PUTS " --platform [list $platform]" |
| 892 | PUTS " --config [list $config]" |
drh | 905da63 | 2015-06-10 18:53:09 +0000 | [diff] [blame] | 893 | if {$::QUICK} { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 894 | if {$::QUICK==1} {PUTS " --quick"} |
| 895 | if {$::QUICK==2} {PUTS " --veryquick"} |
drh | 905da63 | 2015-06-10 18:53:09 +0000 | [diff] [blame] | 896 | } |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 897 | if {$::MSVC} {PUTS " --msvc"} |
| 898 | if {$::BUILDONLY} {PUTS " --buildonly"} |
| 899 | if {$::DRYRUN} {PUTS " --dryrun"} |
| 900 | if {$::TRACE} {PUTS " --trace"} |
| 901 | PUTS "\nAvailable --platform options:" |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 902 | foreach y [lsort [array names ::Platforms]] { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 903 | PUTS " [list $y]" |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 904 | } |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 905 | PUTS "\nAvailable --config options:" |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 906 | foreach y [lsort [array names ::Configs]] { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 907 | PUTS " [list $y]" |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 908 | } |
| 909 | exit |
| 910 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 911 | |
| 912 | -g { |
mistachkin | da9da56 | 2015-11-02 23:29:58 +0000 | [diff] [blame] | 913 | lappend ::EXTRACONFIG [lindex $argv $i] |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 914 | } |
| 915 | |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 916 | -keep { |
| 917 | set ::KEEPFILES 1 |
| 918 | } |
| 919 | |
drh | 0ef84d0 | 2015-04-24 17:50:37 +0000 | [diff] [blame] | 920 | -with-tcl=* { |
| 921 | set ::WITHTCL -$x |
| 922 | } |
| 923 | |
drh | f167a40 | 2015-01-07 18:44:59 +0000 | [diff] [blame] | 924 | -D* - |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 925 | -O* - |
drh | f167a40 | 2015-01-07 18:44:59 +0000 | [diff] [blame] | 926 | -enable-* - |
| 927 | -disable-* - |
| 928 | *=* { |
| 929 | lappend ::EXTRACONFIG [lindex $argv $i] |
| 930 | } |
mistachkin | 7284056 | 2014-12-23 20:22:57 +0000 | [diff] [blame] | 931 | |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 932 | default { |
drh | 573d88e | 2016-01-03 11:17:04 +0000 | [diff] [blame] | 933 | PUTSERR "" |
| 934 | PUTSERR [string trim $::USAGE_MESSAGE] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 935 | exit -1 |
| 936 | } |
| 937 | } |
| 938 | } |
| 939 | |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 940 | if {0==[info exists ::Platforms($platform)]} { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 941 | PUTS "Unknown platform: $platform" |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 942 | PUTSNNL "Set the -platform option to " |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 943 | set print [list] |
| 944 | foreach p [array names ::Platforms] { |
| 945 | lappend print "\"$p\"" |
| 946 | } |
| 947 | lset print end "or [lindex $print end]" |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 948 | PUTS "[join $print {, }]." |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 949 | exit |
| 950 | } |
| 951 | |
drh | 2eeb7ae | 2014-10-10 17:44:03 +0000 | [diff] [blame] | 952 | if {$config!=""} { |
drh | e35626f | 2014-10-10 17:47:00 +0000 | [diff] [blame] | 953 | if {[llength $config]==1} {lappend config fulltest} |
drh | 2eeb7ae | 2014-10-10 17:44:03 +0000 | [diff] [blame] | 954 | set ::CONFIGLIST $config |
| 955 | } else { |
drh | 71258ab | 2015-11-04 16:34:58 +0000 | [diff] [blame] | 956 | if {$::JOBS>1} { |
| 957 | set ::CONFIGLIST {} |
| 958 | foreach {target zConfig} [lreverse $::Platforms($platform)] { |
| 959 | append ::CONFIGLIST [format " %-25s %s\n" \ |
| 960 | [list $zConfig] [list $target]] |
| 961 | } |
| 962 | } else { |
| 963 | set ::CONFIGLIST $::Platforms($platform) |
| 964 | } |
drh | 2eeb7ae | 2014-10-10 17:44:03 +0000 | [diff] [blame] | 965 | } |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 966 | PUTS "Running the following test configurations for $platform:" |
| 967 | PUTS " [string trim $::CONFIGLIST]" |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 968 | PUTSNNL "Flags:" |
| 969 | if {$::PROGRESS_MSGS} {PUTSNNL " --progress"} |
| 970 | if {$::DRYRUN} {PUTSNNL " --dryrun"} |
| 971 | if {$::BUILDONLY} {PUTSNNL " --buildonly"} |
| 972 | if {$::MSVC} {PUTSNNL " --msvc"} |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 973 | switch -- $::QUICK { |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 974 | 1 {PUTSNNL " --quick"} |
| 975 | 2 {PUTSNNL " --veryquick"} |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 976 | } |
drh | d63fbb7 | 2015-11-13 12:52:34 +0000 | [diff] [blame] | 977 | if {$::JOBS>1} {PUTSNNL " --jobs $::JOBS"} |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 978 | PUTS "" |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 979 | } |
| 980 | |
drh | 2c33183 | 2016-09-09 13:17:26 +0000 | [diff] [blame] | 981 | # Check to see if there are uncommitted changes in the SQLite source |
| 982 | # checkout. Exit if there are. Except: Do nothing if the --force |
| 983 | # flag is used. Also, ignore this test if the fossil binary is |
| 984 | # unavailable, or if the source tree is not a valid fossil checkout. |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 985 | # |
| 986 | proc check_uncommitted {} { |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 987 | if {$::FORCE} return |
| 988 | set pwd [pwd] |
| 989 | cd $::SRCDIR |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 990 | if {[catch {exec fossil changes} res]==0 && [string trim $res]!=""} { |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 991 | puts "ERROR: The check-out contains uncommitted changes:" |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 992 | puts $res |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 993 | puts "Use the -f or --force options to override" |
| 994 | exit 1 |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 995 | } |
drh | eedeb92 | 2016-09-09 12:29:57 +0000 | [diff] [blame] | 996 | cd $pwd |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 997 | } |
| 998 | |
dan | d562ec2 | 2016-09-12 09:28:21 +0000 | [diff] [blame] | 999 | # A test run has just finished in directory $dir. This command deletes all |
| 1000 | # non-essential files from the directory. Specifically, everything except |
| 1001 | # |
| 1002 | # * The "testfixture" and "sqlite3" binaries, |
| 1003 | # * The "test-out.log" and "test.log" log files. |
| 1004 | # |
| 1005 | proc cleanup {dir} { |
| 1006 | set K(testfixture) 1 |
| 1007 | set K(testfixture.exe) 1 |
| 1008 | set K(sqlite3) 1 |
| 1009 | set K(sqlite3.exe) 1 |
| 1010 | set K(test-out.txt) 1 |
| 1011 | set K(test.log) 1 |
| 1012 | |
| 1013 | foreach f [glob -nocomplain [file join $dir *]] { |
| 1014 | set tail [file tail $f] |
| 1015 | if {[info exists K($tail)]==0} { |
| 1016 | file delete -force $f |
| 1017 | } |
| 1018 | } |
| 1019 | } |
| 1020 | |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 1021 | |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1022 | # Main routine. |
| 1023 | # |
| 1024 | proc main {argv} { |
| 1025 | |
| 1026 | # Process any command line options. |
drh | f167a40 | 2015-01-07 18:44:59 +0000 | [diff] [blame] | 1027 | set ::EXTRACONFIG {} |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1028 | process_options $argv |
drh | 1fbd008 | 2016-09-08 23:12:08 +0000 | [diff] [blame] | 1029 | if {!$::DRYRUN} check_uncommitted |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 1030 | PUTS [string repeat * 79] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1031 | |
drh | 97876ee | 2014-12-24 23:35:36 +0000 | [diff] [blame] | 1032 | set ::NERR 0 |
| 1033 | set ::NTEST 0 |
drh | 277b4e4 | 2014-12-29 02:55:58 +0000 | [diff] [blame] | 1034 | set ::NTESTCASE 0 |
| 1035 | set ::NERRCASE 0 |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1036 | set ::SQLITE_VERSION {} |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1037 | set STARTTIME [clock seconds] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1038 | foreach {zConfig target} $::CONFIGLIST { |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 1039 | if {$::MSVC && ($zConfig eq "Sanitize" || "checksymbols" in $target |
| 1040 | || "valgrindtest" in $target)} { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 1041 | PUTS "Skipping $zConfig / $target for MSVC..." |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 1042 | continue |
| 1043 | } |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1044 | if {$target ne "checksymbols"} { |
| 1045 | switch -- $::QUICK { |
drh | 905da63 | 2015-06-10 18:53:09 +0000 | [diff] [blame] | 1046 | 1 {set target quicktest} |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1047 | 2 {set target smoketest} |
| 1048 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 1049 | if {$::BUILDONLY} { |
| 1050 | set target testfixture |
drh | 7f8a93d | 2015-11-03 15:39:29 +0000 | [diff] [blame] | 1051 | if {$::tcl_platform(platform)=="windows"} { |
| 1052 | append target .exe |
| 1053 | } |
mistachkin | 00eb70d | 2015-04-04 00:02:07 +0000 | [diff] [blame] | 1054 | } |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1055 | } |
drh | f167a40 | 2015-01-07 18:44:59 +0000 | [diff] [blame] | 1056 | set config_options [concat $::Configs($zConfig) $::EXTRACONFIG] |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1057 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1058 | incr NTEST |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 1059 | add_test_suite all $zConfig $target $config_options |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1060 | |
| 1061 | # If the configuration included the SQLITE_DEBUG option, then remove |
| 1062 | # it and run veryquick.test. If it did not include the SQLITE_DEBUG option |
| 1063 | # add it and run veryquick.test. |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1064 | if {$target!="checksymbols" && $target!="valgrindtest" |
drh | f332071 | 2015-04-25 13:39:29 +0000 | [diff] [blame] | 1065 | && $target!="fuzzoomtest" && !$::BUILDONLY && $::QUICK<2} { |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 1066 | set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] |
drh | bd41d56 | 2014-12-30 20:40:32 +0000 | [diff] [blame] | 1067 | set xtarget $target |
drh | af700b3 | 2014-12-31 20:35:11 +0000 | [diff] [blame] | 1068 | regsub -all {fulltest[a-z]*} $xtarget test xtarget |
drh | f332071 | 2015-04-25 13:39:29 +0000 | [diff] [blame] | 1069 | regsub -all {fuzzoomtest} $xtarget fuzztest xtarget |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 1070 | if {$debug_idx < 0} { |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1071 | incr NTEST |
drh | dc6de47 | 2017-05-25 11:39:50 +0000 | [diff] [blame] | 1072 | append config_options " -DSQLITE_DEBUG=1 -DSQLITE_EXTRA_IFNULLROW=1" |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 1073 | add_test_suite all "${zConfig}_debug" $xtarget $config_options |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 1074 | } else { |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1075 | incr NTEST |
drh | bd41d56 | 2014-12-30 20:40:32 +0000 | [diff] [blame] | 1076 | regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $config_options { } config_options |
| 1077 | regsub { *-DSQLITE_DEBUG[^ ]* *} $config_options { } config_options |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 1078 | add_test_suite all "${zConfig}_ndebug" $xtarget $config_options |
dan | b136e90 | 2012-12-10 10:22:48 +0000 | [diff] [blame] | 1079 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1080 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1081 | } |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1082 | |
dan | a7f6597 | 2015-11-02 18:32:00 +0000 | [diff] [blame] | 1083 | run_all_test_suites $all |
| 1084 | |
drh | d477eee | 2014-12-23 19:40:51 +0000 | [diff] [blame] | 1085 | set elapsetime [expr {[clock seconds]-$STARTTIME}] |
drh | 97876ee | 2014-12-24 23:35:36 +0000 | [diff] [blame] | 1086 | set hr [expr {$elapsetime/3600}] |
| 1087 | set min [expr {($elapsetime/60)%60}] |
| 1088 | set sec [expr {$elapsetime%60}] |
| 1089 | set etime [format (%02d:%02d:%02d) $hr $min $sec] |
drh | 573d88e | 2016-01-03 11:17:04 +0000 | [diff] [blame] | 1090 | if {$::JOBS>1} {append etime " $::JOBS cores"} |
| 1091 | if {[catch {exec hostname} HNAME]==0} {append etime " on $HNAME"} |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 1092 | PUTS [string repeat * 79] |
drh | b1031f0 | 2015-09-10 15:20:49 +0000 | [diff] [blame] | 1093 | incr ::NERRCASE $::NERR |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 1094 | PUTS "$::NERRCASE failures out of $::NTESTCASE tests in $etime" |
drh | 5bfff9d | 2015-01-08 01:05:42 +0000 | [diff] [blame] | 1095 | if {$::SQLITE_VERSION ne ""} { |
drh | e31dc59 | 2015-08-14 12:53:37 +0000 | [diff] [blame] | 1096 | PUTS "SQLite $::SQLITE_VERSION" |
drh | 96110de | 2010-09-06 18:44:14 +0000 | [diff] [blame] | 1097 | } |
| 1098 | } |
| 1099 | |
| 1100 | main $argv |