SQLite

Check-in [09623cc4cc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update wapptest.tcl so that it deletes extra files if the "Keep files:" checkbox is clear. Set it by default.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 09623cc4cc82e3c123d1fd5d88b2f4b50ec5f2cc7e579a7203258bf0c246a74f
User & Date: dan 2019-05-01 15:25:38.538
Context
2019-05-01
15:32
Avoid unwelcomed side effects on the input operands in the OP_Concat operator. Fix for ticket [3be1295b264be2fac49b681] (check-in: 713caa382c user: drh tags: trunk)
15:25
Update wapptest.tcl so that it deletes extra files if the "Keep files:" checkbox is clear. Set it by default. (check-in: 09623cc4cc user: dan tags: trunk)
14:41
In "PRAGMA vdbe_trace" output, show the results of OP_Affinity opcodes. (check-in: 56604bb60a user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/wapptest.tcl.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#   G(keep)     - Boolean. True to delete no files after each test.
#   G(msvc)     - Boolean. True to use MSVC as the compiler.
#   G(tcl)      - Use Tcl from this directory for builds.
#   G(jobs)     - How many sub-processes to run simultaneously.
#
set G(platform) $::tcl_platform(os)-$::tcl_platform(machine)
set G(test)     Normal
set G(keep)     0
set G(msvc)     0
set G(tcl)      [::tcl::pkgconfig get libdir,install]
set G(jobs)     3
set G(debug)    0

proc wapptest_init {} {
  global G








|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#   G(keep)     - Boolean. True to delete no files after each test.
#   G(msvc)     - Boolean. True to use MSVC as the compiler.
#   G(tcl)      - Use Tcl from this directory for builds.
#   G(jobs)     - How many sub-processes to run simultaneously.
#
set G(platform) $::tcl_platform(os)-$::tcl_platform(machine)
set G(test)     Normal
set G(keep)     1
set G(msvc)     [expr {$::tcl_platform(platform)=="windows"}]
set G(tcl)      [::tcl::pkgconfig get libdir,install]
set G(jobs)     3
set G(debug)    0

proc wapptest_init {} {
  global G

193
194
195
196
197
198
199




200
201
202
203
204
205
206
207
208
209
210
211
212








213












214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230








231
232
233
234
235
236
237
    set G(test.$name.errmsg) "Test did not complete"
    if {[file readable core]} {
      append G(test.$name.errmsg) " - core file exists"
    }
  }
}





proc slave_test_done {name rc} {
  global G
  set G(test.$name.done) [clock seconds]
  set G(test.$name.nError) 0
  set G(test.$name.nTest) 0
  set G(test.$name.errmsg) ""
  if {$rc} {
    incr G(test.$name.nError)
  }
  if {[file exists $G(test.$name.log)]} {
    count_tests_and_errors $name $G(test.$name.log)
  }
}





















proc slave_fileevent {name} {
  global G
  set fd $G(test.$name.channel)

  if {[eof $fd]} {
    fconfigure $fd -blocking 1
    set rc [catch { close $fd }]
    unset G(test.$name.channel)
    slave_test_done $name $rc
  } else {
    set line [gets $fd]
    if {[string trim $line] != ""} { puts "Trace   : $name - \"$line\"" }
  }

  do_some_stuff
}









proc wapptest_slave_script {} {
  global G
  set res {
    proc readfile {filename} {
      set fd [open $filename]
      set data [read $fd]
      close $fd







>
>
>
>












|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>

















>
>
>
>
>
>
>
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    set G(test.$name.errmsg) "Test did not complete"
    if {[file readable core]} {
      append G(test.$name.errmsg) " - core file exists"
    }
  }
}

# This command is invoked once a slave process has finished running its
# tests, successfully or otherwise. Parameter $name is the name of the 
# test, $rc the exit code returned by the slave process.
#
proc slave_test_done {name rc} {
  global G
  set G(test.$name.done) [clock seconds]
  set G(test.$name.nError) 0
  set G(test.$name.nTest) 0
  set G(test.$name.errmsg) ""
  if {$rc} {
    incr G(test.$name.nError)
  }
  if {[file exists $G(test.$name.log)]} {
    count_tests_and_errors $name $G(test.$name.log)
  }

  # If the "keep files" checkbox is clear, delete all files except for
  # the executables and test logs. And any core file that is present.
  if {$G(keep)==0} {
    set keeplist {
      testfixture testfixture.exe
      sqlite3 sqlite3.exe
      test.log test-out.txt
      core
    }
    foreach f [glob -nocomplain [file join $G(test.$name.dir) *]] {
      set t [file tail $f]
      if {[lsearch $keeplist $t]<0} {
        catch { file delete -force $f }
      }
    }
  }
}

# This is a fileevent callback invoked each time a file-descriptor that
# connects this process to a slave process is readable.
#
proc slave_fileevent {name} {
  global G
  set fd $G(test.$name.channel)

  if {[eof $fd]} {
    fconfigure $fd -blocking 1
    set rc [catch { close $fd }]
    unset G(test.$name.channel)
    slave_test_done $name $rc
  } else {
    set line [gets $fd]
    if {[string trim $line] != ""} { puts "Trace   : $name - \"$line\"" }
  }

  do_some_stuff
}

# Return the contents of the "slave script" - the script run by slave 
# processes to actually perform the test. It does two things:
#
#   1. Reads and [exec]s the contents of file wapptest_configure.sh.
#   2. Reads and [exec]s the contents of file wapptest_make.sh.
#
# Step 1 is omitted if the test uses MSVC (which does not use configure).
#
proc wapptest_slave_script {} {
  global G
  set res {
    proc readfile {filename} {
      set fd [open $filename]
      set data [read $fd]
      close $fd
266
267
268
269
270
271
272

273
274
275
276
277
278
279
} {
  global G

  catch { file mkdir $dir } msg
  foreach f [glob -nocomplain [file join $dir *]] {
    catch { file delete -force $f }
  }


  # Write the configure command to wapptest_configure.sh. This file
  # is empty if using MSVC - MSVC does not use configure.
  #
  set fd1 [open [file join $dir wapptest_configure.sh] w]
  if {$G(msvc)==0} {
    puts $fd1 "[file join .. $G(srcdir) configure] $wtcl $configOpts"







>







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
} {
  global G

  catch { file mkdir $dir } msg
  foreach f [glob -nocomplain [file join $dir *]] {
    catch { file delete -force $f }
  }
  set G(test.$name.dir) $dir

  # Write the configure command to wapptest_configure.sh. This file
  # is empty if using MSVC - MSVC does not use configure.
  #
  set fd1 [open [file join $dir wapptest_configure.sh] w]
  if {$G(msvc)==0} {
    puts $fd1 "[file join .. $G(srcdir) configure] $wtcl $configOpts"