Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Side by Side Diff: third_party/sqlite/src/tool/omittest.tcl

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/tool/offsets.c ('k') | third_party/sqlite/src/tool/pagesig.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 set rcsid {$Id: omittest.tcl,v 1.8 2008/10/13 15:35:09 drh Exp $} 2 set rcsid {$Id: omittest.tcl,v 1.8 2008/10/13 15:35:09 drh Exp $}
3 3
4 # Documentation for this script. This may be output to stderr 4 # Documentation for this script. This may be output to stderr
5 # if the script is invoked incorrectly. 5 # if the script is invoked incorrectly.
6 set ::USAGE_MESSAGE { 6 set ::USAGE_MESSAGE {
7 This Tcl script is used to test the various compile time options 7 This Tcl script is used to test the various compile time options
8 available for omitting code (the SQLITE_OMIT_xxx options). It 8 available for omitting code (the SQLITE_OMIT_xxx options). It
9 should be invoked as follows: 9 should be invoked as follows:
10 10
(...skipping 13 matching lines...) Expand all
24 Almost any SQLite makefile (except those generated by configure - see below) 24 Almost any SQLite makefile (except those generated by configure - see below)
25 should work. The following properties are required: 25 should work. The following properties are required:
26 26
27 * The makefile should support the "testfixture" target. 27 * The makefile should support the "testfixture" target.
28 * The makefile should support the "test" target. 28 * The makefile should support the "test" target.
29 * The makefile should support the variable "OPTS" as a way to pass 29 * The makefile should support the variable "OPTS" as a way to pass
30 options from the make command line to lemon and the C compiler. 30 options from the make command line to lemon and the C compiler.
31 31
32 More precisely, the following two invocations must be supported: 32 More precisely, the following two invocations must be supported:
33 33
34 make -f $::MAKEFILE testfixture OPTS="-DSQLITE_OMIT_ALTERTABLE=1" 34 $::MAKEBIN -f $::MAKEFILE testfixture OPTS="-DSQLITE_OMIT_ALTERTABLE=1"
35 make -f $::MAKEFILE test 35 $::MAKEBIN -f $::MAKEFILE test
36 36
37 Makefiles generated by the sqlite configure program cannot be used as 37 Makefiles generated by the sqlite configure program cannot be used as
38 they do not respect the OPTS variable. 38 they do not respect the OPTS variable.
39 } 39 }
40 40
41 41
42 # Build a testfixture executable and run quick.test using it. The first 42 # Build a testfixture executable and run quick.test using it. The first
43 # parameter is the name of the directory to create and use to run the 43 # parameter is the name of the directory to create and use to run the
44 # test in. The second parameter is a list of OMIT symbols to define 44 # test in. The second parameter is a list of OMIT symbols to define
45 # when doing so. For example: 45 # when doing so. For example:
46 # 46 #
47 # run_quick_test /tmp/testdir {SQLITE_OMIT_TRIGGER SQLITE_OMIT_VIEW} 47 # run_quick_test /tmp/testdir {SQLITE_OMIT_TRIGGER SQLITE_OMIT_VIEW}
48 # 48 #
49 # 49 #
50 proc run_quick_test {dir omit_symbol_list} { 50 proc run_quick_test {dir omit_symbol_list} {
51 set target "testfixture"
52 # Compile the value of the OPTS Makefile variable. 51 # Compile the value of the OPTS Makefile variable.
53 set opts "-DSQLITE_MEMDEBUG -DSQLITE_DEBUG -DSQLITE_NO_SYNC" 52 set opts ""
54 if {$::tcl_platform(platform)=="windows"} { 53 if {$::tcl_platform(platform)=="windows"} {
55 append opts " -DSQLITE_OS_WIN=1" 54 append opts "OPTS += -DSQLITE_OS_WIN=1\n"
56 set target "testfixture.exe" 55 set target "testfixture.exe"
57 } elseif {$::tcl_platform(platform)=="os2"} {
58 append opts " -DSQLITE_OS_OS2=1"
59 } else { 56 } else {
60 append opts " -DSQLITE_OS_UNIX=1" 57 append opts "OPTS += -DSQLITE_OS_UNIX=1\n"
61 } 58 }
62 foreach sym $omit_symbol_list { 59 foreach sym $omit_symbol_list {
63 append opts " -D${sym}=1" 60 append opts "OPTS += -D${sym}=1\n"
64 } 61 }
65 62
66 # Create the directory and do the build. If an error occurs return 63 # Create the directory and do the build. If an error occurs return
67 # early without attempting to run the test suite. 64 # early without attempting to run the test suite.
68 file mkdir $dir 65 file mkdir $dir
69 puts -nonewline "Building $dir..." 66 puts -nonewline "Building $dir..."
70 flush stdout 67 flush stdout
71 catch { 68 catch {
72 file copy -force ./config.h $dir 69 file copy -force ./config.h $dir
73 file copy -force ./libtool $dir 70 file copy -force ./libtool $dir
74 } 71 }
72 set fd [open $::MAKEFILE]
73 set mkfile [read $fd]
74 close $fd
75 regsub {\ninclude} $mkfile "\n$opts\ninclude" mkfile
76 set fd [open $dir/makefile w]
77 puts $fd $mkfile
78 close $fd
79
75 set rc [catch { 80 set rc [catch {
76 exec make -C $dir -f $::MAKEFILE $target OPTS=$opts >& $dir/build.log 81 exec $::MAKEBIN -C $dir -f makefile clean $::TARGET >& $dir/build.log
77 }] 82 }]
78 if {$rc} { 83 if {$rc} {
79 puts "No good. See $dir/build.log." 84 puts "No good. See $dir/build.log."
80 return 85 return
81 } else { 86 } else {
82 puts "Ok" 87 puts "Ok"
83 } 88 }
84 89
85 # Create an empty file "$dir/sqlite3". This is to trick the makefile out 90 # Create an empty file "$dir/sqlite3". This is to trick the makefile out
86 # of trying to build the sqlite shell. The sqlite shell won't build 91 # of trying to build the sqlite shell. The sqlite shell won't build
87 # with some of the OMIT options (i.e OMIT_COMPLETE). 92 # with some of the OMIT options (i.e OMIT_COMPLETE).
88 set sqlite3_dummy $dir/sqlite3 93 set sqlite3_dummy $dir/sqlite3
89 if {$::tcl_platform(platform)=="windows" || $::tcl_platform(platform)=="os2"} { 94 if {$::tcl_platform(platform)=="windows"} {
90 append sqlite3_dummy ".exe" 95 append sqlite3_dummy ".exe"
91 } 96 }
92 if {![file exists $sqlite3_dummy]} { 97 if {![file exists $sqlite3_dummy]} {
93 set wr [open $sqlite3_dummy w] 98 set wr [open $sqlite3_dummy w]
94 puts $wr "dummy" 99 puts $wr "dummy"
95 close $wr 100 close $wr
96 } 101 }
97 102
98 if {$::SKIP_RUN} { 103 if {$::SKIP_RUN} {
99 puts "Skip testing $dir." 104 puts "Skip testing $dir."
100 } else { 105 } else {
101 # Run the test suite. 106 # Run the test suite.
102 puts -nonewline "Testing $dir..." 107 puts -nonewline "Testing $dir..."
103 flush stdout 108 flush stdout
104 set rc [catch { 109 set rc [catch {
105 exec make -C $dir -f $::MAKEFILE test OPTS=$opts >& $dir/test.log 110 exec $::MAKEBIN -C $dir -f makefile test >& $dir/test.log
106 }] 111 }]
107 if {$rc} { 112 if {$rc} {
108 puts "No good. See $dir/test.log." 113 puts "No good. See $dir/test.log."
109 } else { 114 } else {
110 puts "Ok" 115 puts "Ok"
111 } 116 }
112 } 117 }
113 } 118 }
114 119
115 120
116 # This proc processes the command line options passed to this script. 121 # This proc processes the command line options passed to this script.
117 # Currently the only option supported is "-makefile", default 122 # Currently the only option supported is "-makefile", default
118 # "../Makefile.linux-gcc". Set the ::MAKEFILE variable to the value of this 123 # "../Makefile.linux-gcc". Set the ::MAKEFILE variable to the value of this
119 # option. 124 # option.
120 # 125 #
121 proc process_options {argv} { 126 proc process_options {argv} {
122 if {$::tcl_platform(platform)=="windows" || $::tcl_platform(platform)=="os2"} { 127 set ::MAKEBIN make ;# Default value
123 set ::MAKEFILE ./Makefile ;# Default value 128 if {$::tcl_platform(platform)=="windows"} {
129 set ::MAKEFILE ./Makefile ;# Default value on Windows
124 } else { 130 } else {
125 set ::MAKEFILE ./Makefile.linux-gcc ;# Default value 131 set ::MAKEFILE ./Makefile.linux-gcc ;# Default value
126 } 132 }
127 set ::SKIP_RUN 0 ;# Default to attempt test 133 set ::SKIP_RUN 0 ;# Default to attempt test
134 set ::TARGET testfixture ;# Default thing to build
128 135
129 for {set i 0} {$i < [llength $argv]} {incr i} { 136 for {set i 0} {$i < [llength $argv]} {incr i} {
130 switch -- [lindex $argv $i] { 137 switch -- [lindex $argv $i] {
131 -makefile { 138 -makefile {
132 incr i 139 incr i
133 set ::MAKEFILE [lindex $argv $i] 140 set ::MAKEFILE [lindex $argv $i]
134 } 141 }
135 142
143 -nmake {
144 set ::MAKEBIN nmake
145 set ::MAKEFILE ./Makefile.msc
146 }
147
148 -target {
149 incr i
150 set ::TARGET [lindex $argv $i]
151 }
152
136 -skip_run { 153 -skip_run {
137 set ::SKIP_RUN 1 154 set ::SKIP_RUN 1
138 } 155 }
139 156
140 default { 157 default {
141 if {[info exists ::SYMBOL]} { 158 if {[info exists ::SYMBOL]} {
142 puts stderr [string trim $::USAGE_MESSAGE] 159 puts stderr [string trim $::USAGE_MESSAGE]
143 exit -1 160 exit -1
144 } 161 }
145 set ::SYMBOL [lindex $argv $i] 162 set ::SYMBOL [lindex $argv $i]
(...skipping 20 matching lines...) Expand all
166 SQLITE_OMIT_AUTOVACUUM \ 183 SQLITE_OMIT_AUTOVACUUM \
167 SQLITE_OMIT_BETWEEN_OPTIMIZATION \ 184 SQLITE_OMIT_BETWEEN_OPTIMIZATION \
168 SQLITE_OMIT_BLOB_LITERAL \ 185 SQLITE_OMIT_BLOB_LITERAL \
169 SQLITE_OMIT_BTREECOUNT \ 186 SQLITE_OMIT_BTREECOUNT \
170 SQLITE_OMIT_BUILTIN_TEST \ 187 SQLITE_OMIT_BUILTIN_TEST \
171 SQLITE_OMIT_CAST \ 188 SQLITE_OMIT_CAST \
172 SQLITE_OMIT_CHECK \ 189 SQLITE_OMIT_CHECK \
173 SQLITE_OMIT_COMPILEOPTION_DIAGS \ 190 SQLITE_OMIT_COMPILEOPTION_DIAGS \
174 SQLITE_OMIT_COMPLETE \ 191 SQLITE_OMIT_COMPLETE \
175 SQLITE_OMIT_COMPOUND_SELECT \ 192 SQLITE_OMIT_COMPOUND_SELECT \
193 SQLITE_OMIT_CTE \
176 SQLITE_OMIT_DATETIME_FUNCS \ 194 SQLITE_OMIT_DATETIME_FUNCS \
177 SQLITE_OMIT_DECLTYPE \ 195 SQLITE_OMIT_DECLTYPE \
178 SQLITE_OMIT_DEPRECATED \ 196 SQLITE_OMIT_DEPRECATED \
179 xxxSQLITE_OMIT_DISKIO \
180 SQLITE_OMIT_EXPLAIN \ 197 SQLITE_OMIT_EXPLAIN \
181 SQLITE_OMIT_FLAG_PRAGMAS \ 198 SQLITE_OMIT_FLAG_PRAGMAS \
182 SQLITE_OMIT_FLOATING_POINT \ 199 SQLITE_OMIT_FLOATING_POINT \
183 SQLITE_OMIT_FOREIGN_KEY \ 200 SQLITE_OMIT_FOREIGN_KEY \
184 SQLITE_OMIT_GET_TABLE \ 201 SQLITE_OMIT_GET_TABLE \
185 SQLITE_OMIT_INCRBLOB \ 202 SQLITE_OMIT_INCRBLOB \
186 SQLITE_OMIT_INTEGRITY_CHECK \ 203 SQLITE_OMIT_INTEGRITY_CHECK \
187 SQLITE_OMIT_LIKE_OPTIMIZATION \ 204 SQLITE_OMIT_LIKE_OPTIMIZATION \
188 SQLITE_OMIT_LOAD_EXTENSION \ 205 SQLITE_OMIT_LOAD_EXTENSION \
189 SQLITE_OMIT_LOCALTIME \ 206 SQLITE_OMIT_LOCALTIME \
(...skipping 21 matching lines...) Expand all
211 SQLITE_OMIT_VIRTUALTABLE \ 228 SQLITE_OMIT_VIRTUALTABLE \
212 SQLITE_OMIT_WAL \ 229 SQLITE_OMIT_WAL \
213 SQLITE_OMIT_WSD \ 230 SQLITE_OMIT_WSD \
214 SQLITE_OMIT_XFER_OPT \ 231 SQLITE_OMIT_XFER_OPT \
215 ] 232 ]
216 233
217 set ::ENABLE_SYMBOLS [list \ 234 set ::ENABLE_SYMBOLS [list \
218 SQLITE_DISABLE_DIRSYNC \ 235 SQLITE_DISABLE_DIRSYNC \
219 SQLITE_DISABLE_LFS \ 236 SQLITE_DISABLE_LFS \
220 SQLITE_ENABLE_ATOMIC_WRITE \ 237 SQLITE_ENABLE_ATOMIC_WRITE \
221 xxxSQLITE_ENABLE_CEROD \
222 SQLITE_ENABLE_COLUMN_METADATA \ 238 SQLITE_ENABLE_COLUMN_METADATA \
223 SQLITE_ENABLE_EXPENSIVE_ASSERT \ 239 SQLITE_ENABLE_EXPENSIVE_ASSERT \
224 xxxSQLITE_ENABLE_FTS1 \
225 xxxSQLITE_ENABLE_FTS2 \
226 SQLITE_ENABLE_FTS3 \ 240 SQLITE_ENABLE_FTS3 \
227 SQLITE_ENABLE_FTS3_PARENTHESIS \ 241 SQLITE_ENABLE_FTS3_PARENTHESIS \
228 SQLITE_ENABLE_FTS4 \ 242 SQLITE_ENABLE_FTS4 \
229 xxxSQLITE_ENABLE_ICU \
230 SQLITE_ENABLE_IOTRACE \ 243 SQLITE_ENABLE_IOTRACE \
231 SQLITE_ENABLE_LOAD_EXTENSION \ 244 SQLITE_ENABLE_LOAD_EXTENSION \
232 SQLITE_ENABLE_LOCKING_STYLE \ 245 SQLITE_ENABLE_LOCKING_STYLE \
233 SQLITE_ENABLE_MEMORY_MANAGEMENT \ 246 SQLITE_ENABLE_MEMORY_MANAGEMENT \
234 SQLITE_ENABLE_MEMSYS3 \ 247 SQLITE_ENABLE_MEMSYS3 \
235 SQLITE_ENABLE_MEMSYS5 \ 248 SQLITE_ENABLE_MEMSYS5 \
236 SQLITE_ENABLE_OVERSIZE_CELL_CHECK \ 249 SQLITE_ENABLE_OVERSIZE_CELL_CHECK \
237 SQLITE_ENABLE_RTREE \ 250 SQLITE_ENABLE_RTREE \
238 SQLITE_ENABLE_STAT2 \ 251 SQLITE_ENABLE_STAT3 \
239 SQLITE_ENABLE_UNLOCK_NOTIFY \ 252 SQLITE_ENABLE_UNLOCK_NOTIFY \
240 SQLITE_ENABLE_UPDATE_DELETE_LIMIT \ 253 SQLITE_ENABLE_UPDATE_DELETE_LIMIT \
241 ] 254 ]
242 255
243 # Process any command line options. 256 # Process any command line options.
244 process_options $argv 257 process_options $argv
245 258
246 if {[info exists ::SYMBOL] } { 259 if {[info exists ::SYMBOL] } {
247 set sym $::SYMBOL 260 set sym $::SYMBOL
248 261
249 if {[lsearch $::OMIT_SYMBOLS $sym]<0 && [lsearch $::ENABLE_SYMBOLS $sym]<0} { 262 if {[lsearch $::OMIT_SYMBOLS $sym]<0 && [lsearch $::ENABLE_SYMBOLS $sym]<0} {
250 puts stderr "No such symbol: $sym" 263 puts stderr "No such symbol: $sym"
251 exit -1 264 exit -1
252 } 265 }
253 266
254 set dirname "test_[string range $sym 7 end]" 267 set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]"
255 run_quick_test $dirname $sym 268 run_quick_test $dirname $sym
256 } else { 269 } else {
257 # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT 270 # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT
258 # and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults) 271 # and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults)
259 # and the latter is currently incompatible with the test suite (this should 272 # and the latter is currently incompatible with the test suite (this should
260 # be fixed, but it will be a lot of work). 273 # be fixed, but it will be a lot of work).
261 set allsyms [list] 274 set allsyms [list]
262 foreach s $::OMIT_SYMBOLS { 275 foreach s $::OMIT_SYMBOLS {
263 if {$s!="SQLITE_OMIT_FLOATING_POINT" && $s!="SQLITE_OMIT_PRAGMA"} { 276 if {$s!="SQLITE_OMIT_FLOATING_POINT" && $s!="SQLITE_OMIT_PRAGMA"} {
264 lappend allsyms $s 277 lappend allsyms $s
265 } 278 }
266 } 279 }
267 run_quick_test test_OMIT_EVERYTHING $allsyms 280 run_quick_test test_OMIT_EVERYTHING $allsyms
268 281
269 # Now try one quick.test with each of the OMIT symbols defined. Included 282 # Now try one quick.test with each of the OMIT symbols defined. Included
270 # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we 283 # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we
271 # know they will fail. It's good to be reminded of this from time to time. 284 # know they will fail. It's good to be reminded of this from time to time.
272 foreach sym $::OMIT_SYMBOLS { 285 foreach sym $::OMIT_SYMBOLS {
273 set dirname "test_[string range $sym 7 end]" 286 set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]"
274 run_quick_test $dirname $sym 287 run_quick_test $dirname $sym
275 } 288 }
276 289
277 # Try the ENABLE/DISABLE symbols one at a time. 290 # Try the ENABLE/DISABLE symbols one at a time.
278 # We don't do them all at once since some are conflicting. 291 # We don't do them all at once since some are conflicting.
279 foreach sym $::ENABLE_SYMBOLS { 292 foreach sym $::ENABLE_SYMBOLS {
280 set dirname "test_[string range $sym 7 end]" 293 set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]"
281 run_quick_test $dirname $sym 294 run_quick_test $dirname $sym
282 } 295 }
283 } 296 }
284 } 297 }
285 298
286 main $argv 299 main $argv
OLDNEW
« no previous file with comments | « third_party/sqlite/src/tool/offsets.c ('k') | third_party/sqlite/src/tool/pagesig.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698