]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove old files related to wapptest.tcl from test/ directory.
authordan <Dan Kennedy>
Wed, 8 Nov 2023 15:51:42 +0000 (15:51 +0000)
committerdan <Dan Kennedy>
Wed, 8 Nov 2023 15:51:42 +0000 (15:51 +0000)
FossilOrigin-Name: dd3e7b5bcad122ac1e7e19ec547f4486ce90a6a2aa89a64e36bea13a216492fe

manifest
manifest.uuid
test/releasetest_data.tcl [deleted file]
test/wapp.tcl [deleted file]
test/wapptest.tcl [deleted file]

index a1dc817b0afa9d04d500833144a01e201ab167d3..f8b0d56fd2e414a2feb314915f711099f9eb1737 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sblocking\sas\spart\sof\spassive\scheckpoint\soperations,\seven\sif\sSQLITE_ENABLE_SETLK_TIMEOUT\sis\sdefined.
-D 2023-11-08T15:49:57.172
+C Remove\sold\sfiles\srelated\sto\swapptest.tcl\sfrom\stest/\sdirectory.
+D 2023-11-08T15:51:42.810
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1487,7 +1487,6 @@ F test/recover.test fd5199f928757cb308661b5fdca1abc19398a798ff7f24b57c3071e9f8e0
 F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
 F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
 F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
-F test/releasetest_data.tcl 50679c8de0e67ca93a47dc95fdf077ecbc4b6eceb14dcb76f19779ab44132e65
 F test/resetdb.test 54c06f18bc832ac6d6319e5ab23d5c8dd49fdbeec7c696d791682a8006bd5fc3
 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
 F test/returning1.test db532cde29d6aebbc48c6ddc3149b30476f8e69ca7a2c4b53986c7635e6fd8ec
@@ -1952,8 +1951,6 @@ F test/walshared.test 42e3808582504878af237ea02c42ca793e8a0efaa19df7df26ac573370
 F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f
 F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2af51747
 F test/walvfs.test e1a6ad0f3c78e98b55c3d5f0889cf366cc0d0a1cb2bccb44ac9ec67384adc4a1
-F test/wapp.tcl b440cd8cf57953d3a49e7ee81e6a18f18efdaf113b69f7d8482b0710a64566ec
-F test/wapptest.tcl 1bea58a6a8e68a73f542ee4fca28b771b84ed803bd0c9e385087070b3d747b3c x
 F test/where.test 59abb854eee24f166b5f7ba9d17eb250abc59ce0a66c48912ffb10763648196d
 F test/where2.test 03c21a11e7b90e2845fc3c8b4002fc44cc2797fa74c86ee47d70bd7ea4f29ed6
 F test/where3.test 5b4ffc0ac2ea0fe92f02b1244b7531522fe4d7bccf6fa8741d54e82c10e67753
@@ -2142,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 916ae898743a969295a48ae2a6e9e366586834b32d77d3fa281bbaf7f2818502
-R 5bea92ea8c9d0554fce6b86ad4fbcf31
+P e5ecc404cae1ce8b639d0263fa07571c066f11bfc62f5ba331ad7ae138e78572
+R ce83d55831eeaab82518466b14d3660d
 U dan
-Z c817b07612729531bff15732a557a90b
+Z aaf04791c4ef545a121de15f3eab560c
 # Remove this line to create a well-formed Fossil manifest.
index 27f2be574e0fa3f5d2892a3e436425f8669d7f99..198e99f2b47f0525ad0f8291e5785e291f59cb45 100644 (file)
@@ -1 +1 @@
-e5ecc404cae1ce8b639d0263fa07571c066f11bfc62f5ba331ad7ae138e78572
\ No newline at end of file
+dd3e7b5bcad122ac1e7e19ec547f4486ce90a6a2aa89a64e36bea13a216492fe
\ No newline at end of file
diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl
deleted file mode 100644 (file)
index 95c1b7a..0000000
+++ /dev/null
@@ -1,846 +0,0 @@
-# 2019 August 01
-#
-# The author disclaims copyright to this source code.  In place of
-# a legal notice, here is a blessing:
-#
-#    May you do good and not evil.
-#    May you find forgiveness for yourself and forgive others.
-#    May you share freely, never taking more than you give.
-#
-#***********************************************************************
-#
-# This file implements a program that produces scripts (either shell scripts
-# or batch files) to implement a particular test that is part of the SQLite
-# release testing procedure. For example, to run veryquick.test with a 
-# specified set of -D compiler switches.
-#
-# A "configuration" is a set of options passed to [./configure] and [make]
-# to build the SQLite library in a particular fashion. A "platform" is a
-# list of tests; most platforms are named after the hardware/OS platform
-# that the tests will be run on as part of the release procedure. Each 
-# "test" is a combination of a configuration and a makefile target (e.g.
-# "fulltest"). The program may be invoked as follows:
-#
-set USAGE {
-$argv0 script ?-msvc? CONFIGURATION TARGET
-    Given a configuration and make target, return a bash (or, if -msvc
-    is specified, batch) script to execute the test. The first argument
-    passed to the script must be a directory containing SQLite source code.
-
-$argv0 configurations
-    List available configurations.
-
-$argv0 platforms
-    List available platforms.
-
-$argv0 tests ?-nodebug? PLATFORM
-    List tests in a specified platform. If the -nodebug switch is 
-    specified, synthetic debug/ndebug configurations are omitted. Each
-    test is a combination of a configuration and a makefile target.
-}
-
-# Omit comments (text between # and \n) in a long multi-line string.
-#
-proc strip_comments {in} {
-  regsub -all {#[^\n]*\n} $in {} out
-  return $out
-}
-
-array set ::Configs [strip_comments {
-  "Default" {
-    -O2
-    --disable-amalgamation --disable-shared
-    --enable-session
-    -DSQLITE_ENABLE_RBU
-  }
-  "All-Debug" {
-    --enable-debug --enable-all
-  }
-  "All-O0" {
-    -O0 --enable-all
-  }
-  "Sanitize" {
-    CC=clang -fsanitize=address,undefined
-    -DSQLITE_ENABLE_STAT4
-    -DCONFIG_SLOWDOWN_FACTOR=5.0
-    --enable-debug
-    --enable-all
-  }
-  "Stdcall" {
-    -DUSE_STDCALL=1
-    -O2
-  }
-  "Have-Not" {
-    # The "Have-Not" configuration sets all possible -UHAVE_feature options
-    # in order to verify that the code works even on platforms that lack
-    # these support services.
-    -DHAVE_FDATASYNC=0
-    -DHAVE_GMTIME_R=0
-    -DHAVE_ISNAN=0
-    -DHAVE_LOCALTIME_R=0
-    -DHAVE_LOCALTIME_S=0
-    -DHAVE_MALLOC_USABLE_SIZE=0
-    -DHAVE_STRCHRNUL=0
-    -DHAVE_USLEEP=0
-    -DHAVE_UTIME=0
-  }
-  "Unlock-Notify" {
-    -O2
-    -DSQLITE_ENABLE_UNLOCK_NOTIFY
-    -DSQLITE_THREADSAFE
-    -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
-  }
-  "User-Auth" {
-    -O2
-    -DSQLITE_USER_AUTHENTICATION=1
-  }
-  "Secure-Delete" {
-    -O2
-    -DSQLITE_SECURE_DELETE=1
-    -DSQLITE_SOUNDEX=1
-  }
-  "Update-Delete-Limit" {
-    -O2
-    -DSQLITE_DEFAULT_FILE_FORMAT=4
-    -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
-    -DSQLITE_ENABLE_STMT_SCANSTATUS
-    -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
-    -DSQLITE_ENABLE_CURSOR_HINTS
-  }
-  "Check-Symbols" {
-    -DSQLITE_MEMDEBUG=1
-    -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
-    -DSQLITE_ENABLE_FTS3=1
-    -DSQLITE_ENABLE_RTREE=1
-    -DSQLITE_ENABLE_MEMSYS5=1
-    -DSQLITE_ENABLE_MEMSYS3=1
-    -DSQLITE_ENABLE_COLUMN_METADATA=1
-    -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
-    -DSQLITE_SECURE_DELETE=1
-    -DSQLITE_SOUNDEX=1
-    -DSQLITE_ENABLE_ATOMIC_WRITE=1
-    -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
-    -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
-    -DSQLITE_ENABLE_STAT4
-    -DSQLITE_ENABLE_STMT_SCANSTATUS
-    --enable-fts5 --enable-session
-  }
-  "Debug-One" {
-    --disable-shared
-    -O2 -funsigned-char
-    -DSQLITE_DEBUG=1
-    -DSQLITE_MEMDEBUG=1
-    -DSQLITE_MUTEX_NOOP=1
-    -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
-    -DSQLITE_ENABLE_FTS3=1
-    -DSQLITE_ENABLE_RTREE=1
-    -DSQLITE_ENABLE_MEMSYS5=1
-    -DSQLITE_ENABLE_COLUMN_METADATA=1
-    -DSQLITE_ENABLE_STAT4
-    -DSQLITE_ENABLE_HIDDEN_COLUMNS
-    -DSQLITE_MAX_ATTACHED=125
-    -DSQLITE_MUTATION_TEST
-    --enable-fts5
-  }
-  "Debug-Two" {
-    -DSQLITE_DEFAULT_MEMSTATUS=0
-    -DSQLITE_MAX_EXPR_DEPTH=0
-    --enable-debug
-  }
-  "Fast-One" {
-    -O6
-    -DSQLITE_ENABLE_FTS4=1
-    -DSQLITE_ENABLE_RTREE=1
-    -DSQLITE_ENABLE_STAT4
-    -DSQLITE_ENABLE_RBU
-    -DSQLITE_MAX_ATTACHED=125
-    -DSQLITE_MAX_MMAP_SIZE=12884901888
-    -DSQLITE_ENABLE_SORTER_MMAP=1
-    -DLONGDOUBLE_TYPE=double
-    --enable-session
-  }
-  "Device-One" {
-    -O2
-    -DSQLITE_DEBUG=1
-    -DSQLITE_DEFAULT_AUTOVACUUM=1
-    -DSQLITE_DEFAULT_CACHE_SIZE=64
-    -DSQLITE_DEFAULT_PAGE_SIZE=1024
-    -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
-    -DSQLITE_DISABLE_LFS=1
-    -DSQLITE_ENABLE_ATOMIC_WRITE=1
-    -DSQLITE_ENABLE_IOTRACE=1
-    -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
-    -DSQLITE_MAX_PAGE_SIZE=4096
-    -DSQLITE_OMIT_LOAD_EXTENSION=1
-    -DSQLITE_OMIT_PROGRESS_CALLBACK=1
-    -DSQLITE_OMIT_VIRTUALTABLE=1
-    -DSQLITE_ENABLE_HIDDEN_COLUMNS
-    -DSQLITE_TEMP_STORE=3
-  }
-  "Device-Two" {
-    -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
-    -DSQLITE_DEFAULT_AUTOVACUUM=1
-    -DSQLITE_DEFAULT_CACHE_SIZE=1000
-    -DSQLITE_DEFAULT_LOCKING_MODE=0
-    -DSQLITE_DEFAULT_PAGE_SIZE=1024
-    -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
-    -DSQLITE_DISABLE_LFS=1
-    -DSQLITE_ENABLE_FTS3=1
-    -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
-    -DSQLITE_ENABLE_RTREE=1
-    -DSQLITE_MAX_COMPOUND_SELECT=50
-    -DSQLITE_MAX_PAGE_SIZE=32768
-    -DSQLITE_OMIT_TRACE=1
-    -DSQLITE_TEMP_STORE=3
-    -DSQLITE_THREADSAFE=2
-    --enable-fts5 --enable-session
-  }
-  "Locking-Style" {
-    -O2
-    -DSQLITE_ENABLE_LOCKING_STYLE=1
-  }
-  "Apple" {
-    -Os
-    -DHAVE_GMTIME_R=1
-    -DHAVE_ISNAN=1
-    -DHAVE_LOCALTIME_R=1
-    -DHAVE_PREAD=1
-    -DHAVE_PWRITE=1
-    -DHAVE_UTIME=1
-    -DSQLITE_DEFAULT_CACHE_SIZE=1000
-    -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
-    -DSQLITE_DEFAULT_MEMSTATUS=1
-    -DSQLITE_DEFAULT_PAGE_SIZE=1024
-    -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
-    -DSQLITE_ENABLE_API_ARMOR=1
-    -DSQLITE_ENABLE_AUTO_PROFILE=1
-    -DSQLITE_ENABLE_FLOCKTIMEOUT=1
-    -DSQLITE_ENABLE_FTS3=1
-    -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
-    -DSQLITE_ENABLE_FTS3_TOKENIZER=1
-    -DSQLITE_ENABLE_PERSIST_WAL=1
-    -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
-    -DSQLITE_ENABLE_RTREE=1
-    -DSQLITE_ENABLE_SETLK_TIMEOUT=1
-    -DSQLITE_ENABLE_SNAPSHOT=1
-    # -DSQLITE_ENABLE_SQLLOG=1
-    -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
-    -DSQLITE_MAX_LENGTH=2147483645
-    -DSQLITE_MAX_VARIABLE_NUMBER=500000
-    # -DSQLITE_MEMDEBUG=1
-    -DSQLITE_NO_SYNC=1
-    -DSQLITE_OMIT_AUTORESET=1
-    -DSQLITE_OMIT_LOAD_EXTENSION=1
-    -DSQLITE_PREFER_PROXY_LOCKING=1
-    -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
-    -DSQLITE_THREADSAFE=2
-    -DSQLITE_USE_URI=1
-    -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
-    -DUSE_GUARDED_FD=1
-    -DUSE_PREAD=1
-    --enable-fts5
-  }
-  "Extra-Robustness" {
-    -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
-    -DSQLITE_MAX_ATTACHED=62
-  }
-  "Devkit" {
-    -DSQLITE_DEFAULT_FILE_FORMAT=4
-    -DSQLITE_MAX_ATTACHED=30
-    -DSQLITE_ENABLE_COLUMN_METADATA
-    -DSQLITE_ENABLE_FTS4
-    -DSQLITE_ENABLE_FTS5
-    -DSQLITE_ENABLE_FTS4_PARENTHESIS
-    -DSQLITE_DISABLE_FTS4_DEFERRED
-    -DSQLITE_ENABLE_RTREE
-    --enable-fts5
-  }
-  "No-lookaside" {
-    -DSQLITE_TEST_REALLOC_STRESS=1
-    -DSQLITE_OMIT_LOOKASIDE=1
-  }
-  "Valgrind" {
-    -DSQLITE_ENABLE_STAT4
-    -DSQLITE_ENABLE_FTS4
-    -DSQLITE_ENABLE_RTREE
-    -DSQLITE_ENABLE_HIDDEN_COLUMNS
-    -DLONGDOUBLE_TYPE=double
-    -DCONFIG_SLOWDOWN_FACTOR=8.0
-  }
-
-  "Windows-Memdebug" {
-    MEMDEBUG=1
-    DEBUG=3
-  }
-  "Windows-Win32Heap" {
-    WIN32HEAP=1
-    DEBUG=4
-  }
-
-  # The next group of configurations are used only by the
-  # Failure-Detection platform.  They are all the same, but we need
-  # different names for them all so that they results appear in separate
-  # subdirectories.
-  #
-  Fail0     {-O0}
-  Fail2     {-O0}
-  Fail3     {-O0}
-  Fail4     {-O0}
-  FuzzFail1 {-O0}
-  FuzzFail2 {-O0}
-}]
-if {$tcl_platform(os)=="Darwin"} {
-  lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1
-}
-
-array set ::Platforms [strip_comments {
-  Linux-x86_64 {
-    "Check-Symbols*"          "" checksymbols
-    "Fast-One"                QUICKTEST_INCLUDE=rbu.test "fuzztest test"
-    "Debug-One"               "" "mptest test"
-    "Debug-Two"               "" test
-    "Have-Not"                "" test
-    "Secure-Delete"           "" test
-    "Unlock-Notify"           QUICKTEST_INCLUDE=notify2.test test
-    "User-Auth"               "" tcltest
-    "Update-Delete-Limit"     "" test
-    "Extra-Robustness"        "" test
-    "Device-Two"              "" "threadtest test"
-    "No-lookaside"            "" test
-    "Devkit"                  "" test
-    "Apple"                   "" test
-    "Sanitize*"               "" test
-    "Device-One"              "" alltest
-    "Default"                 "" "threadtest fuzztest alltest"
-    "Valgrind*"               "" valgrindtest
-  }
-  Linux-i686 {
-    "Devkit"                  "" test
-    "Have-Not"                "" test
-    "Unlock-Notify"           QUICKTEST_INCLUDE=notify2.test test
-    "Device-One"              "" test
-    "Device-Two"              "" test
-    "Default"                 "" "threadtest fuzztest alltest"
-  }
-  Darwin-i386 {
-    "Locking-Style"           "" "mptest test"
-    "Have-Not"                "" test
-    "Apple"                   "" "threadtest fuzztest alltest"
-  }
-  Darwin-x86_64 {
-    "Locking-Style"           "" "mptest test"
-    "Have-Not"                "" test
-    "Apple"                   "" "threadtest fuzztest alltest"
-  }
-  Darwin-arm64 {
-    "Locking-Style"           "" "mptest test"
-    "Have-Not"                "" test
-    "Apple"                   "" "threadtest fuzztest alltest"
-  }
-  "Windows NT-intel" {
-    "Stdcall"                 "" test
-    "Have-Not"                "" test
-    "Windows-Memdebug*"       "" test
-    "Windows-Win32Heap*"      "" test
-    "Default"                 "" "mptest fulltestonly"
-  }
-  "Windows NT-amd64" {
-    "Stdcall"                 "" test
-    "Have-Not"                "" test
-    "Windows-Memdebug*"       "" test
-    "Windows-Win32Heap*"      "" test
-    "Default"                 "" "mptest fulltestonly"
-  }
-
-  # The Failure-Detection platform runs various tests that deliberately
-  # fail.  This is used as a test of this script to verify that this script
-  # correctly identifies failures.
-  #
-  Failure-Detection {
-    Fail0*     "TEST_FAILURE=0" test
-    Sanitize*  "TEST_FAILURE=1" test
-    Fail2*     "TEST_FAILURE=2" valgrindtest
-    Fail3*     "TEST_FAILURE=3" valgrindtest
-    Fail4*     "TEST_FAILURE=4" test
-    FuzzFail1* "TEST_FAILURE=5" test
-    FuzzFail2* "TEST_FAILURE=5" valgrindtest
-  }
-}]
-
-#--------------------------------------------------------------------------
-#--------------------------------------------------------------------------
-#--------------------------------------------------------------------------
-# End of configuration section.
-#--------------------------------------------------------------------------
-#--------------------------------------------------------------------------
-#--------------------------------------------------------------------------
-
-# Configuration verification: Check that each entry in the list of configs
-# specified for each platforms exists.
-#
-foreach {key value} [array get ::Platforms] {
-  foreach {v vars t} $value {
-    if {[string range $v end end]=="*"} {
-      set v [string range $v 0 end-1]
-    }
-    if {0==[info exists ::Configs($v)]} {
-      puts stderr "No such configuration: \"$v\""
-      exit -1
-    }
-  }
-}
-
-proc usage {} {
-  global argv0
-  puts stderr [subst $::USAGE]
-  exit 1
-}
-
-proc is_prefix {p str min} {
-  set n [string length $p]
-  if {$n<$min} { return 0 }
-  if {[string range $str 0 [expr $n-1]]!=$p} { return 0 }
-  return 1
-}
-
-proc main_configurations {} {
-  foreach k [lsort [array names ::Configs]] {
-    puts $k
-  }
-}
-
-proc main_platforms {} {
-  foreach k [lsort [array names ::Platforms]] {
-    puts "\"$k\""
-  }
-}
-
-proc main_script {args} {
-  set bMsvc 0
-  set nArg [llength $args]
-  if {$nArg==3} {
-    if {![is_prefix [lindex $args 0] -msvc 2]} usage
-    set bMsvc 1
-  } elseif {$nArg<2 || $nArg>3} {
-    usage
-  }
-  set config [lindex $args end-1]
-  set target [lindex $args end]
-
-  set opts       [list]                         ;# OPTS value
-  set cflags     [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
-  set makeOpts   [list]                         ;# Extra args for [make]
-  set configOpts [list]                         ;# Extra args for [configure]
-
-  if {$::tcl_platform(platform)=="windows" || $bMsvc} {
-    lappend opts -DSQLITE_OS_WIN=1
-  } else {
-    lappend opts -DSQLITE_OS_UNIX=1
-  }
-
-  # Figure out if this is a synthetic ndebug or debug configuration.
-  #
-  set bRemoveDebug 0
-  if {[string match *-ndebug $config]} {
-    set bRemoveDebug 1
-    set config [string range $config 0 end-7]
-  }
-  if {[string match *-debug $config]} {
-    lappend opts -DSQLITE_DEBUG
-    lappend opts -DSQLITE_EXTRA_IFNULLROW
-    set config [string range $config 0 end-6]
-  }
-  regexp {^(.*)-[0-9]+} $config -> config
-
-  # Ensure that the named configuration exists.
-  #
-  if {![info exists ::Configs($config)]} {
-    puts stderr "No such config: $config"
-    exit 1
-  }
-
-  # Loop through the parameters of the nominated configuration, updating
-  # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
-  # follows:
-  #
-  #   1. If the parameter begins with a "*", discard it.
-  #
-  #   2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
-  #      -DSQLITE_DEBUG=1, discard it
-  #
-  #   3. If the parameter begins with "-D", add it to $opts.
-  #
-  #   4. If the parameter begins with "--" add it to $configOpts. Unless
-  #      this command is preparing a script for MSVC - then add an 
-  #      equivalent to $makeOpts or $opts.
-  #
-  #   5. If the parameter begins with "-" add it to $cflags. If in MSVC
-  #      mode and the parameter is an -O<integer> option, instead add
-  #      an OPTIMIZATIONS=<integer> switch to $makeOpts.
-  #
-  #   6. If none of the above apply, add the parameter to $makeOpts
-  #
-  foreach param $::Configs($config) {
-    if {[string range $param 0 0]=="*"} continue
-
-    if {$bRemoveDebug} {
-      if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
-       || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
-       || $param=="--enable-debug"
-      } {
-        continue
-      }
-    }
-
-    if {[string range $param 0 1]=="-D"} {
-      lappend opts $param
-      continue
-    }
-
-    if {[string range $param 0 1]=="--"} {
-      if {$bMsvc} {
-        switch -- $param {
-          --disable-amalgamation {
-            lappend makeOpts USE_AMALGAMATION=0
-          }
-          --disable-shared {
-            lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
-          }
-          --enable-fts5 {
-            lappend opts -DSQLITE_ENABLE_FTS5
-          } 
-          --enable-shared {
-            lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
-          }
-          --enable-session {
-            lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
-            lappend opts -DSQLITE_ENABLE_SESSION
-          }
-          default {
-            error "Cannot translate $param for MSVC"
-          }
-        }
-      } else {
-        lappend configOpts $param
-      }
-
-      continue
-    }
-
-    if {[string range $param 0 0]=="-"} {
-      if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
-        lappend makeOpts OPTIMIZATIONS=$level
-      } else {
-        lappend cflags $param
-      }
-      continue
-    }
-
-    lappend makeOpts $param
-  }
-
-  # Some configurations specify -DHAVE_USLEEP=0. For all others, add
-  # -DHAVE_USLEEP=1.
-  #
-  if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
-    lappend opts -DHAVE_USLEEP=1
-  }
-
-  if {$bMsvc==0} {
-    puts {set -e}
-    puts {}
-    puts {if [ "$#" -ne 1 ] ; then}
-    puts {  echo "Usage: $0 <sqlite-src-dir>" }
-    puts {  exit -1 }
-    puts {fi }
-    puts {SRCDIR=$1}
-    puts {}
-    puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
-
-    puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts"
-    puts {}
-    puts {OPTS="      -DSQLITE_NO_SYNC=1"}
-    foreach o $opts { 
-      puts "OPTS=\"\$OPTS $o\"" 
-    }
-    puts {}
-    puts "CFLAGS=\"$cflags\""
-    puts {}
-    puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
-  } else {
-
-    puts {set SRCDIR=%1}
-    set makecmd    "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target "
-    append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
-
-    puts "set TMP=%CD%"
-    puts $makecmd
-  }
-}
-
-proc main_trscript {args} {
-  set bMsvc 0
-  set nArg [llength $args]
-  if {$nArg==3} {
-    if {![is_prefix [lindex $args 0] -msvc 2]} usage
-    set bMsvc 1
-  } elseif {$nArg<2 || $nArg>3} {
-    usage
-  }
-  set config [lindex $args end-1]
-  set srcdir [lindex $args end]
-
-  set opts       [list]                         ;# OPTS value
-  set cflags     [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
-  set makeOpts   [list]                         ;# Extra args for [make]
-  set configOpts [list]                         ;# Extra args for [configure]
-
-  if {$::tcl_platform(platform)=="windows" || $bMsvc} {
-    lappend opts -DSQLITE_OS_WIN=1
-  } else {
-    lappend opts -DSQLITE_OS_UNIX=1
-  }
-
-  # Figure out if this is a synthetic ndebug or debug configuration.
-  #
-  set bRemoveDebug 0
-  if {[string match *-ndebug $config]} {
-    set bRemoveDebug 1
-    set config [string range $config 0 end-7]
-  }
-  if {[string match *-debug $config]} {
-    lappend opts -DSQLITE_DEBUG
-    lappend opts -DSQLITE_EXTRA_IFNULLROW
-    set config [string range $config 0 end-6]
-  }
-  regexp {^(.*)-[0-9]+} $config -> config
-
-  # Ensure that the named configuration exists.
-  #
-  if {![info exists ::Configs($config)]} {
-    puts stderr "No such config: $config"
-    exit 1
-  }
-
-  # Loop through the parameters of the nominated configuration, updating
-  # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
-  # follows:
-  #
-  #   1. If the parameter begins with a "*", discard it.
-  #
-  #   2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
-  #      -DSQLITE_DEBUG=1, discard it
-  #
-  #   3. If the parameter begins with "-D", add it to $opts.
-  #
-  #   4. If the parameter begins with "--" add it to $configOpts. Unless
-  #      this command is preparing a script for MSVC - then add an 
-  #      equivalent to $makeOpts or $opts.
-  #
-  #   5. If the parameter begins with "-" add it to $cflags. If in MSVC
-  #      mode and the parameter is an -O<integer> option, instead add
-  #      an OPTIMIZATIONS=<integer> switch to $makeOpts.
-  #
-  #   6. If none of the above apply, add the parameter to $makeOpts
-  #
-  foreach param $::Configs($config) {
-    if {[string range $param 0 0]=="*"} continue
-
-    if {$bRemoveDebug} {
-      if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
-       || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
-       || $param=="--enable-debug"
-      } {
-        continue
-      }
-    }
-
-    if {[string range $param 0 1]=="-D"} {
-      lappend opts $param
-      continue
-    }
-
-    if {[string range $param 0 1]=="--"} {
-      if {$bMsvc} {
-        switch -- $param {
-          --disable-amalgamation {
-            lappend makeOpts USE_AMALGAMATION=0
-          }
-          --disable-shared {
-            lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
-          }
-          --enable-fts5 {
-            lappend opts -DSQLITE_ENABLE_FTS5
-          } 
-          --enable-shared {
-            lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
-          }
-          --enable-session {
-            lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
-            lappend opts -DSQLITE_ENABLE_SESSION
-          }
-          --enable-all {
-          }
-          --enable-debug {
-            # lappend makeOpts OPTIMIZATIONS=0
-            lappend opts -DSQLITE_DEBUG
-          }
-          default {
-            error "Cannot translate $param for MSVC"
-          }
-        }
-      } else {
-        lappend configOpts $param
-      }
-
-      continue
-    }
-
-    if {[string range $param 0 0]=="-"} {
-      if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
-        lappend makeOpts OPTIMIZATIONS=$level
-      } else {
-        lappend cflags $param
-      }
-      continue
-    }
-
-    lappend makeOpts $param
-  }
-
-  # Some configurations specify -DHAVE_USLEEP=0. For all others, add
-  # -DHAVE_USLEEP=1.
-  #
-  if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
-    lappend opts -DHAVE_USLEEP=1
-  }
-
-  if {$bMsvc==0} {
-    puts {set -e}
-    puts {}
-    puts {if [ "$#" -ne 1 ] ; then}
-    puts {  echo "Usage: $0 <target>" }
-    puts {  exit -1 }
-    puts {fi }
-    puts "SRCDIR=\"$srcdir\""
-    puts {}
-    puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
-
-    puts {if [ ! -f Makefile ] ; then}
-    puts "  \$SRCDIR/configure --with-tcl=\$TCL $configOpts"
-    puts {fi}
-    puts {}
-    if {[info exists ::env(OPTS)]} {
-      puts "# From environment variable:"
-      puts "OPTS=$::env(OPTS)"
-      puts ""
-    }
-    puts {OPTS="$OPTS -DSQLITE_NO_SYNC=1"}
-    foreach o $opts { 
-      puts "OPTS=\"\$OPTS $o\"" 
-    }
-    puts {}
-    puts "CFLAGS=\"$cflags\""
-    puts {}
-    puts "make \$1 \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
-  } else {
-
-    set srcdir [file nativename [file normalize $srcdir]]
-    # set srcdir [string map [list "\\" "\\\\"] $srcdir]
-
-    puts {set TARGET=%1}
-    set makecmd    "nmake /f $srcdir\\Makefile.msc TOP=\"$srcdir\" %TARGET% "
-    append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
-
-    puts "set TMP=%CD%"
-    puts $makecmd
-  }
-}
-
-proc main_tests {args} {
-  set bNodebug 0
-  set nArg [llength $args]
-  if {$nArg==2} {
-    if {[is_prefix [lindex $args 0] -nodebug 2]} {
-      set bNodebug 1
-    } elseif {[is_prefix [lindex $args 0] -debug 2]} {
-      set bNodebug 0
-    } else usage
-  } elseif {$nArg==0 || $nArg>2} {
-    usage
-  }
-  set p [lindex $args end]
-  if {![info exists ::Platforms($p)]} {
-    puts stderr "No such platform: $p"
-    exit 1
-  }
-
-  set lTest [list]
-
-  foreach {config vars target} $::Platforms($p) {
-    if {[string range $config end end]=="*"} {
-      set config [string range $config 0 end-1]
-    } elseif {$bNodebug==0} {
-      set dtarget test
-      if {[lsearch $target fuzztest]<0 && [lsearch $target test]<0} {
-        set dtarget tcltest
-      }
-      if {$vars!=""} { set dtarget "$vars $dtarget" }
-
-      if {[string first SQLITE_DEBUG $::Configs($config)]>=0
-       || [string first --enable-debug $::Configs($config)]>=0
-      } {
-        lappend lTest "$config-ndebug \"$dtarget\""
-      } else {
-        lappend lTest "$config-debug \"$dtarget\""
-      }
-    }
-
-    if {[llength $target]==1 && ([string match "*TEST_FAILURE*" $vars] || (
-        [lsearch $target "valgrindtest"]<0
-     && [lsearch $target "alltest"]<0
-     && [lsearch $target "fulltestonly"]<0
-     && ![string match Sanitize* $config]
-    ))} {
-      if {$vars!=""} { set target "$vars $target" }
-      lappend lTest "$config \"$target\""
-    } else {
-      set idir -1
-      foreach t $target {
-        if {$t=="valgrindtest" || $t=="alltest" || $t=="fulltestonly"
-         || [string match Sanitize* $config]
-        } {
-          if {$vars!=""} { set t "$vars $t" }
-          for {set ii 1} {$ii<=4} {incr ii} {
-            lappend lTest "$config-[incr idir] \"TCLTEST_PART=$ii/4 $t\""
-          }
-        } else {
-          if {$vars!=""} { set t "$vars $t" }
-          lappend lTest "$config-[incr idir] \"$t\""
-        }
-      }
-    }
-  }
-
-  foreach l $lTest {
-    puts $l
-  }
-
-}
-
-if {[llength $argv]==0} { usage }
-set cmd [lindex $argv 0]
-set n [expr [llength $argv]-1]
-if {[string match ${cmd}* configurations] && $n==0} {
-  main_configurations 
-} elseif {[string match ${cmd}* script]} {
-  main_script {*}[lrange $argv 1 end]
-} elseif {[string match ${cmd}* trscript]} {
-  main_trscript {*}[lrange $argv 1 end]
-} elseif {[string match ${cmd}* platforms] && $n==0} {
-  main_platforms
-} elseif {[string match ${cmd}* tests]} {
-  main_tests {*}[lrange $argv 1 end]
-} else {
-  usage
-}
diff --git a/test/wapp.tcl b/test/wapp.tcl
deleted file mode 100644 (file)
index 53c21e8..0000000
+++ /dev/null
@@ -1,987 +0,0 @@
-# Copyright (c) 2017 D. Richard Hipp
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the Simplified BSD License (also
-# known as the "2-Clause License" or "FreeBSD License".)
-#
-# This program is distributed in the hope that it will be useful,
-# but without any warranty; without even the implied warranty of
-# merchantability or fitness for a particular purpose.
-#
-#---------------------------------------------------------------------------
-#
-# Design rules:
-#
-#   (1)  All identifiers in the global namespace begin with "wapp"
-#
-#   (2)  Indentifiers intended for internal use only begin with "wappInt"
-#
-package require Tcl 8.6
-
-# Add text to the end of the HTTP reply.  No interpretation or transformation
-# of the text is performs.  The argument should be enclosed within {...}
-#
-proc wapp {txt} {
-  global wapp
-  dict append wapp .reply $txt
-}
-
-# Add text to the page under construction.  Do no escaping on the text.
-#
-# Though "unsafe" in general, there are uses for this kind of thing.
-# For example, if you want to return the complete, unmodified content of
-# a file:
-#
-#         set fd [open content.html rb]
-#         wapp-unsafe [read $fd]
-#         close $fd
-#
-# You could do the same thing using ordinary "wapp" instead of "wapp-unsafe".
-# The difference is that wapp-safety-check will complain about the misuse
-# of "wapp", but it assumes that the person who write "wapp-unsafe" understands
-# the risks.
-#
-# Though occasionally necessary, the use of this interface should be minimized.
-#
-proc wapp-unsafe {txt} {
-  global wapp
-  dict append wapp .reply $txt
-}
-
-# Add text to the end of the reply under construction.  The following
-# substitutions are made:
-#
-#     %html(...)          Escape text for inclusion in HTML
-#     %url(...)           Escape text for use as a URL
-#     %qp(...)            Escape text for use as a URI query parameter
-#     %string(...)        Escape text for use within a JSON string
-#     %unsafe(...)        No transformations of the text
-#
-# The substitutions above terminate at the first ")" character.  If the
-# text of the TCL string in ... contains ")" characters itself, use instead:
-#
-#     %html%(...)%
-#     %url%(...)%
-#     %qp%(...)%
-#     %string%(...)%
-#     %unsafe%(...)%
-#
-# In other words, use "%(...)%" instead of "(...)" to include the TCL string
-# to substitute.
-#
-# The %unsafe substitution should be avoided whenever possible, obviously.
-# In addition to the substitutions above, the text also does backslash
-# escapes.
-#
-# The wapp-trim proc works the same as wapp-subst except that it also removes
-# whitespace from the left margin, so that the generated HTML/CSS/Javascript
-# does not appear to be indented when delivered to the client web browser.
-#
-if {$tcl_version>=8.7} {
-  proc wapp-subst {txt} {
-    global wapp
-    regsub -all -command \
-       {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt wappInt-enc txt
-    dict append wapp .reply [subst -novariables -nocommand $txt]
-  }
-  proc wapp-trim {txt} {
-    global wapp
-    regsub -all {\n\s+} [string trim $txt] \n txt
-    regsub -all -command \
-       {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt wappInt-enc txt
-    dict append wapp .reply [subst -novariables -nocommand $txt]
-  }
-  proc wappInt-enc {all mode nu1 txt} {
-    return [uplevel 2 "wappInt-enc-$mode \"$txt\""]
-  }
-} else {
-  proc wapp-subst {txt} {
-    global wapp
-    regsub -all {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt \
-           {[wappInt-enc-\1 "\3"]} txt
-    dict append wapp .reply [uplevel 1 [list subst -novariables $txt]]
-  }
-  proc wapp-trim {txt} {
-    global wapp
-    regsub -all {\n\s+} [string trim $txt] \n txt
-    regsub -all {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt \
-           {[wappInt-enc-\1 "\3"]} txt
-    dict append wapp .reply [uplevel 1 [list subst -novariables $txt]]
-  }
-}
-
-# There must be a wappInt-enc-NAME routine for each possible substitution
-# in wapp-subst.  Thus there are routines for "html", "url", "qp", and "unsafe".
-#
-#    wappInt-enc-html           Escape text so that it is safe to use in the
-#                               body of an HTML document.
-#
-#    wappInt-enc-url            Escape text so that it is safe to pass as an
-#                               argument to href= and src= attributes in HTML.
-#
-#    wappInt-enc-qp             Escape text so that it is safe to use as the
-#                               value of a query parameter in a URL or in
-#                               post data or in a cookie.
-#
-#    wappInt-enc-string         Escape ", ', \, and < for using inside of a
-#                               javascript string literal.  The < character
-#                               is escaped to prevent "</script>" from causing
-#                               problems in embedded javascript.
-#
-#    wappInt-enc-unsafe         Perform no encoding at all.  Unsafe.
-#
-proc wappInt-enc-html {txt} {
-  return [string map {& &amp; < &lt; > &gt; \" &quot; \\ &#92;} $txt]
-}
-proc wappInt-enc-unsafe {txt} {
-  return $txt
-}
-proc wappInt-enc-url {s} {
-  if {[regsub -all {[^-{}@~?=#_.:/a-zA-Z0-9]} $s {[wappInt-%HHchar {&}]} s]} {
-    set s [subst -novar -noback $s]
-  }
-  if {[regsub -all {[{}]} $s {[wappInt-%HHchar \\&]} s]} {
-    set s [subst -novar -noback $s]
-  }
-  return $s
-}
-proc wappInt-enc-qp {s} {
-  if {[regsub -all {[^-{}_.a-zA-Z0-9]} $s {[wappInt-%HHchar {&}]} s]} {
-    set s [subst -novar -noback $s]
-  }
-  if {[regsub -all {[{}]} $s {[wappInt-%HHchar \\&]} s]} {
-    set s [subst -novar -noback $s]
-  }
-  return $s
-}
-proc wappInt-enc-string {s} {
-  return [string map {\\ \\\\ \" \\\" ' \\' < \\u003c} $s]
-}
-
-# This is a helper routine for wappInt-enc-url and wappInt-enc-qp.  It returns
-# an appropriate %HH encoding for the single character c.  If c is a unicode
-# character, then this routine might return multiple bytes:  %HH%HH%HH
-#
-proc wappInt-%HHchar {c} {
-  if {$c==" "} {return +}
-  return [regsub -all .. [binary encode hex [encoding convertto utf-8 $c]] {%&}]
-}
-
-
-# Undo the www-url-encoded format.
-#
-# HT: This code stolen from ncgi.tcl
-#
-proc wappInt-decode-url {str} {
-  set str [string map [list + { } "\\" "\\\\" \[ \\\[ \] \\\]] $str]
-  regsub -all -- \
-      {%([Ee][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])} \
-      $str {[encoding convertfrom utf-8 [binary decode hex \1\2\3]]} str
-  regsub -all -- \
-      {%([CDcd][A-Fa-f0-9])%([89ABab][A-Fa-f0-9])}                     \
-      $str {[encoding convertfrom utf-8 [binary decode hex \1\2]]} str
-  regsub -all -- {%([0-7][A-Fa-f0-9])} $str {\\u00\1} str
-  return [subst -novar $str]
-}
-
-# Reset the document back to an empty string.
-#
-proc wapp-reset {} {
-  global wapp
-  dict set wapp .reply {}
-}
-
-# Change the mime-type of the result document.
-#
-proc wapp-mimetype {x} {
-  global wapp
-  dict set wapp .mimetype $x
-}
-
-# Change the reply code.
-#
-proc wapp-reply-code {x} {
-  global wapp
-  dict set wapp .reply-code $x
-}
-
-# Set a cookie
-#
-proc wapp-set-cookie {name value} {
-  global wapp
-  dict lappend wapp .new-cookies $name $value
-}
-
-# Unset a cookie
-#
-proc wapp-clear-cookie {name} {
-  wapp-set-cookie $name {}
-}
-
-# Add extra entries to the reply header
-#
-proc wapp-reply-extra {name value} {
-  global wapp
-  dict lappend wapp .reply-extra $name $value
-}
-
-# Specifies how the web-page under construction should be cached.
-# The argument should be one of:
-#
-#    no-cache
-#    max-age=N             (for some integer number of seconds, N)
-#    private,max-age=N
-#
-proc wapp-cache-control {x} {
-  wapp-reply-extra Cache-Control $x
-}
-
-# Redirect to a different web page
-#
-proc wapp-redirect {uri} {
-  wapp-reply-code {307 Redirect}
-  wapp-reply-extra Location $uri
-}
-
-# Return the value of a wapp parameter
-#
-proc wapp-param {name {dflt {}}} {
-  global wapp
-  if {![dict exists $wapp $name]} {return $dflt}
-  return [dict get $wapp $name]
-}
-
-# Return true if a and only if the wapp parameter $name exists
-#
-proc wapp-param-exists {name} {
-  global wapp
-  return [dict exists $wapp $name]
-}
-
-# Set the value of a wapp parameter
-#
-proc wapp-set-param {name value} {
-  global wapp
-  dict set wapp $name $value
-}
-
-# Return all parameter names that match the GLOB pattern, or all
-# names if the GLOB pattern is omitted.
-#
-proc wapp-param-list {{glob {*}}} {
-  global wapp
-  return [dict keys $wapp $glob]
-}
-
-# By default, Wapp does not decode query parameters and POST parameters
-# for cross-origin requests.  This is a security restriction, designed to
-# help prevent cross-site request forgery (CSRF) attacks.
-#
-# As a consequence of this restriction, URLs for sites generated by Wapp
-# that contain query parameters will not work as URLs found in other
-# websites.  You cannot create a link from a second website into a Wapp
-# website if the link contains query planner, by default.
-#
-# Of course, it is sometimes desirable to allow query parameters on external
-# links.  For URLs for which this is safe, the application should invoke
-# wapp-allow-xorigin-params.  This procedure tells Wapp that it is safe to
-# go ahead and decode the query parameters even for cross-site requests.
-#
-# In other words, for Wapp security is the default setting.  Individual pages
-# need to actively disable the cross-site request security if those pages
-# are safe for cross-site access.
-#
-proc wapp-allow-xorigin-params {} {
-  global wapp
-  if {![dict exists $wapp .qp] && ![dict get $wapp SAME_ORIGIN]} {
-    wappInt-decode-query-params
-  }
-}
-
-# Set the content-security-policy.
-#
-# The default content-security-policy is very strict:  "default-src 'self'"
-# The default policy prohibits the use of in-line javascript or CSS.
-#
-# Provide an alternative CSP as the argument.  Or use "off" to disable
-# the CSP completely.
-#
-proc wapp-content-security-policy {val} {
-  global wapp
-  if {$val=="off"} {
-    dict unset wapp .csp
-  } else {
-    dict set wapp .csp $val
-  }
-}
-
-# Examine the bodys of all procedures in this program looking for
-# unsafe calls to various Wapp interfaces.  Return a text string
-# containing warnings. Return an empty string if all is ok.
-#
-# This routine is advisory only.  It misses some constructs that are
-# dangerous and flags others that are safe.
-#
-proc wapp-safety-check {} {
-  set res {}
-  foreach p [info procs] {
-    set ln 0
-    foreach x [split [info body $p] \n] {
-      incr ln
-      if {[regexp {^[ \t]*wapp[ \t]+([^\n]+)} $x all tail]
-       && [string index $tail 0]!="\173"
-       && [regexp {[[$]} $tail]
-      } {
-        append res "$p:$ln: unsafe \"wapp\" call: \"[string trim $x]\"\n"
-      }
-      if {[regexp {^[ \t]*wapp-(subst|trim)[ \t]+[^\173]} $x all cx]} {
-        append res "$p:$ln: unsafe \"wapp-$cx\" call: \"[string trim $x]\"\n"
-      }
-    }
-  }
-  return $res
-}
-
-# Return a string that descripts the current environment.  Applications
-# might find this useful for debugging.
-#
-proc wapp-debug-env {} {
-  global wapp
-  set out {}
-  foreach var [lsort [dict keys $wapp]] {
-    if {[string index $var 0]=="."} continue
-    append out "$var = [list [dict get $wapp $var]]\n"
-  }
-  append out "\[pwd\] = [list [pwd]]\n"
-  return $out
-}
-
-# Tracing function for each HTTP request.  This is overridden by wapp-start
-# if tracing is enabled.
-#
-proc wappInt-trace {} {}
-
-# Start up a listening socket.  Arrange to invoke wappInt-new-connection
-# for each inbound HTTP connection.
-#
-#    port            Listen on this TCP port.  0 means to select a port
-#                    that is not currently in use
-#
-#    wappmode        One of "scgi", "remote-scgi", "server", or "local".
-#
-#    fromip          If not {}, then reject all requests from IP addresses
-#                    other than $fromip
-#
-proc wappInt-start-listener {port wappmode fromip} {
-  if {[string match *scgi $wappmode]} {
-    set type SCGI
-    set server [list wappInt-new-connection \
-                wappInt-scgi-readable $wappmode $fromip]
-  } else {
-    set type HTTP
-    set server [list wappInt-new-connection \
-                wappInt-http-readable $wappmode $fromip]
-  }
-  if {$wappmode=="local" || $wappmode=="scgi"} {
-    set x [socket -server $server -myaddr 127.0.0.1 $port]
-  } else {
-    set x [socket -server $server $port]
-  }
-  set coninfo [chan configure $x -sockname]
-  set port [lindex $coninfo 2]
-  if {$wappmode=="local"} {
-    wappInt-start-browser http://127.0.0.1:$port/
-  } elseif {$fromip!=""} {
-    puts "Listening for $type requests on TCP port $port from IP $fromip"
-  } else {
-    puts "Listening for $type requests on TCP port $port"
-  }
-}
-
-# Start a web-browser and point it at $URL
-#
-proc wappInt-start-browser {url} {
-  global tcl_platform
-  if {$tcl_platform(platform)=="windows"} {
-    exec cmd /c start $url &
-  } elseif {$tcl_platform(os)=="Darwin"} {
-    exec open $url &
-  } elseif {[catch {exec xdg-open $url}]} {
-    exec firefox $url &
-  }
-}
-
-# This routine is a "socket -server" callback.  The $chan, $ip, and $port
-# arguments are added by the socket command.
-#
-# Arrange to invoke $callback when content is available on the new socket.
-# The $callback will process inbound HTTP or SCGI content.  Reject the
-# request if $fromip is not an empty string and does not match $ip.
-#
-proc wappInt-new-connection {callback wappmode fromip chan ip port} {
-  upvar #0 wappInt-$chan W
-  if {$fromip!="" && ![string match $fromip $ip]} {
-    close $chan
-    return
-  }
-  set W [dict create REMOTE_ADDR $ip REMOTE_PORT $port WAPP_MODE $wappmode \
-         .header {}]
-  fconfigure $chan -blocking 0 -translation binary
-  fileevent $chan readable [list $callback $chan]
-}
-
-# Close an input channel
-#
-proc wappInt-close-channel {chan} {
-  if {$chan=="stdout"} {
-    # This happens after completing a CGI request
-    exit 0
-  } else {
-    unset ::wappInt-$chan
-    close $chan
-  }
-}
-
-# Process new text received on an inbound HTTP request
-#
-proc wappInt-http-readable {chan} {
-  if {[catch [list wappInt-http-readable-unsafe $chan] msg]} {
-    puts stderr "$msg\n$::errorInfo"
-    wappInt-close-channel $chan
-  }
-}
-proc wappInt-http-readable-unsafe {chan} {
-  upvar #0 wappInt-$chan W wapp wapp
-  if {![dict exists $W .toread]} {
-    # If the .toread key is not set, that means we are still reading
-    # the header
-    set line [string trimright [gets $chan]]
-    set n [string length $line]
-    if {$n>0} {
-      if {[dict get $W .header]=="" || [regexp {^\s+} $line]} {
-        dict append W .header $line
-      } else {
-        dict append W .header \n$line
-      }
-      if {[string length [dict get $W .header]]>100000} {
-        error "HTTP request header too big - possible DOS attack"
-      }
-    } elseif {$n==0} {
-      # We have reached the blank line that terminates the header.
-      global argv0
-      set a0 [file normalize $argv0]
-      dict set W SCRIPT_FILENAME $a0
-      dict set W DOCUMENT_ROOT [file dir $a0]
-      if {[wappInt-parse-header $chan]} {
-        catch {close $chan}
-        return
-      }
-      set len 0
-      if {[dict exists $W CONTENT_LENGTH]} {
-        set len [dict get $W CONTENT_LENGTH]
-      }
-      if {$len>0} {
-        # Still need to read the query content
-        dict set W .toread $len
-      } else {
-        # There is no query content, so handle the request immediately
-        set wapp $W
-        wappInt-handle-request $chan 0
-      }
-    }
-  } else {
-    # If .toread is set, that means we are reading the query content.
-    # Continue reading until .toread reaches zero.
-    set got [read $chan [dict get $W .toread]]
-    dict append W CONTENT $got
-    dict set W .toread [expr {[dict get $W .toread]-[string length $got]}]
-    if {[dict get $W .toread]<=0} {
-      # Handle the request as soon as all the query content is received
-      set wapp $W
-      wappInt-handle-request $chan 0
-    }
-  }
-}
-
-# Decode the HTTP request header.
-#
-# This routine is always running inside of a [catch], so if
-# any problems arise, simply raise an error.
-#
-proc wappInt-parse-header {chan} {
-  upvar #0 wappInt-$chan W
-  set hdr [split [dict get $W .header] \n]
-  if {$hdr==""} {return 1}
-  set req [lindex $hdr 0]
-  dict set W REQUEST_METHOD [set method [lindex $req 0]]
-  if {[lsearch {GET HEAD POST} $method]<0} {
-    error "unsupported request method: \"[dict get $W REQUEST_METHOD]\""
-  }
-  set uri [lindex $req 1]
-  set split_uri [split $uri ?]
-  set uri0 [lindex $split_uri 0]
-  if {![regexp {^/[-.a-z0-9_/]*$} $uri0]} {
-    error "invalid request uri: \"$uri0\""
-  }
-  dict set W REQUEST_URI $uri0
-  dict set W PATH_INFO $uri0
-  set uri1 [lindex $split_uri 1]
-  dict set W QUERY_STRING $uri1
-  set n [llength $hdr]
-  for {set i 1} {$i<$n} {incr i} {
-    set x [lindex $hdr $i]
-    if {![regexp {^(.+): +(.*)$} $x all name value]} {
-      error "invalid header line: \"$x\""
-    }
-    set name [string toupper $name]
-    switch -- $name {
-      REFERER {set name HTTP_REFERER}
-      USER-AGENT {set name HTTP_USER_AGENT}
-      CONTENT-LENGTH {set name CONTENT_LENGTH}
-      CONTENT-TYPE {set name CONTENT_TYPE}
-      HOST {set name HTTP_HOST}
-      COOKIE {set name HTTP_COOKIE}
-      ACCEPT-ENCODING {set name HTTP_ACCEPT_ENCODING}
-      default {set name .hdr:$name}
-    }
-    dict set W $name $value
-  }
-  return 0
-}
-
-# Decode the QUERY_STRING parameters from a GET request or the
-# application/x-www-form-urlencoded CONTENT from a POST request.
-#
-# This routine sets the ".qp" element of the ::wapp dict as a signal
-# that query parameters have already been decoded.
-#
-proc wappInt-decode-query-params {} {
-  global wapp
-  dict set wapp .qp 1
-  if {[dict exists $wapp QUERY_STRING]} {
-    foreach qterm [split [dict get $wapp QUERY_STRING] &] {
-      set qsplit [split $qterm =]
-      set nm [lindex $qsplit 0]
-      if {[regexp {^[a-z][a-z0-9]*$} $nm]} {
-        dict set wapp $nm [wappInt-decode-url [lindex $qsplit 1]]
-      }
-    }
-  }
-  if {[dict exists $wapp CONTENT_TYPE] && [dict exists $wapp CONTENT]} {
-    set ctype [dict get $wapp CONTENT_TYPE]
-    if {$ctype=="application/x-www-form-urlencoded"} {
-      foreach qterm [split [string trim [dict get $wapp CONTENT]] &] {
-        set qsplit [split $qterm =]
-        set nm [lindex $qsplit 0]
-        if {[regexp {^[a-z][-a-z0-9_]*$} $nm]} {
-          dict set wapp $nm [wappInt-decode-url [lindex $qsplit 1]]
-        }
-      }
-    } elseif {[string match multipart/form-data* $ctype]} {
-      regexp {^(.*?)\r\n(.*)$} [dict get $wapp CONTENT] all divider body
-      set ndiv [string length $divider]
-      while {[string length $body]} {
-        set idx [string first $divider $body]
-        set unit [string range $body 0 [expr {$idx-3}]]
-        set body [string range $body [expr {$idx+$ndiv+2}] end]
-        if {[regexp {^Content-Disposition: form-data; (.*?)\r\n\r\n(.*)$} \
-             $unit unit hdr content]} {
-          if {[regexp {name="(.*)"; filename="(.*)"\r\nContent-Type: (.*?)$}\
-                $hdr hr name filename mimetype]} {
-            dict set wapp $name.filename \
-              [string map [list \\\" \" \\\\ \\] $filename]
-            dict set wapp $name.mimetype $mimetype
-            dict set wapp $name.content $content
-          } elseif {[regexp {name="(.*)"} $hdr hr name]} {
-            dict set wapp $name $content
-          }
-        }
-      }
-    }
-  }
-}
-
-# Invoke application-supplied methods to generate a reply to
-# a single HTTP request.
-#
-# This routine always runs within [catch], so handle exceptions by
-# invoking [error].
-#
-proc wappInt-handle-request {chan useCgi} {
-  global wapp
-  dict set wapp .reply {}
-  dict set wapp .mimetype {text/html; charset=utf-8}
-  dict set wapp .reply-code {200 Ok}
-  dict set wapp .csp {default-src 'self'}
-
-  # Set up additional CGI environment values
-  #
-  if {![dict exists $wapp HTTP_HOST]} {
-    dict set wapp BASE_URL {}
-  } elseif {[dict exists $wapp HTTPS]} {
-    dict set wapp BASE_URL https://[dict get $wapp HTTP_HOST]
-  } else {
-    dict set wapp BASE_URL http://[dict get $wapp HTTP_HOST]
-  }
-  if {![dict exists $wapp REQUEST_URI]} {
-    dict set wapp REQUEST_URI /
-  } elseif {[regsub {\?.*} [dict get $wapp REQUEST_URI] {} newR]} {
-    # Some servers (ex: nginx) append the query parameters to REQUEST_URI.
-    # These need to be stripped off
-    dict set wapp REQUEST_URI $newR
-  }
-  if {[dict exists $wapp SCRIPT_NAME]} {
-    dict append wapp BASE_URL [dict get $wapp SCRIPT_NAME]
-  } else {
-    dict set wapp SCRIPT_NAME {}
-  }
-  if {![dict exists $wapp PATH_INFO]} {
-    # If PATH_INFO is missing (ex: nginx) then construct it
-    set URI [dict get $wapp REQUEST_URI]
-    set skip [string length [dict get $wapp SCRIPT_NAME]]
-    dict set wapp PATH_INFO [string range $URI $skip end]
-  }
-  if {[regexp {^/([^/]+)(.*)$} [dict get $wapp PATH_INFO] all head tail]} {
-    dict set wapp PATH_HEAD $head
-    dict set wapp PATH_TAIL [string trimleft $tail /]
-  } else {
-    dict set wapp PATH_INFO {}
-    dict set wapp PATH_HEAD {}
-    dict set wapp PATH_TAIL {}
-  }
-  dict set wapp SELF_URL [dict get $wapp BASE_URL]/[dict get $wapp PATH_HEAD]
-
-  # Parse query parameters from the query string, the cookies, and
-  # POST data
-  #
-  if {[dict exists $wapp HTTP_COOKIE]} {
-    foreach qterm [split [dict get $wapp HTTP_COOKIE] {;}] {
-      set qsplit [split [string trim $qterm] =]
-      set nm [lindex $qsplit 0]
-      if {[regexp {^[a-z][-a-z0-9_]*$} $nm]} {
-        dict set wapp $nm [wappInt-decode-url [lindex $qsplit 1]]
-      }
-    }
-  }
-  set same_origin 0
-  if {[dict exists $wapp HTTP_REFERER]} {
-    set referer [dict get $wapp HTTP_REFERER]
-    set base [dict get $wapp BASE_URL]
-    if {$referer==$base || [string match $base/* $referer]} {
-      set same_origin 1
-    }
-  }
-  dict set wapp SAME_ORIGIN $same_origin
-  if {$same_origin} {
-    wappInt-decode-query-params
-  }
-
-  # Invoke the application-defined handler procedure for this page
-  # request.  If an error occurs while running that procedure, generate
-  # an HTTP reply that contains the error message.
-  #
-  wapp-before-dispatch-hook
-  wappInt-trace
-  set mname [dict get $wapp PATH_HEAD]
-  if {[catch {
-    if {$mname!="" && [llength [info proc wapp-page-$mname]]>0} {
-      wapp-page-$mname
-    } else {
-      wapp-default
-    }
-  } msg]} {
-    if {[wapp-param WAPP_MODE]=="local" || [wapp-param WAPP_MODE]=="server"} {
-      puts "ERROR: $::errorInfo"
-    }
-    wapp-reset
-    wapp-reply-code "500 Internal Server Error"
-    wapp-mimetype text/html
-    wapp-trim {
-      <h1>Wapp Application Error</h1>
-      <pre>%html($::errorInfo)</pre>
-    }
-    dict unset wapp .new-cookies
-  }
-
-  # Transmit the HTTP reply
-  #
-  if {$chan=="stdout"} {
-    puts $chan "Status: [dict get $wapp .reply-code]\r"
-  } else {
-    puts $chan "HTTP/1.1 [dict get $wapp .reply-code]\r"
-    puts $chan "Server: wapp\r"
-    puts $chan "Connection: close\r"
-  }
-  if {[dict exists $wapp .reply-extra]} {
-    foreach {name value} [dict get $wapp .reply-extra] {
-      puts $chan "$name: $value\r"
-    }
-  }
-  if {[dict exists $wapp .csp]} {
-    puts $chan "Content-Security-Policy: [dict get $wapp .csp]\r"
-  }
-  set mimetype [dict get $wapp .mimetype]
-  puts $chan "Content-Type: $mimetype\r"
-  if {[dict exists $wapp .new-cookies]} {
-    foreach {nm val} [dict get $wapp .new-cookies] {
-      if {[regexp {^[a-z][-a-z0-9_]*$} $nm]} {
-        if {$val==""} {
-          puts $chan "Set-Cookie: $nm=; HttpOnly; Path=/; Max-Age=1\r"
-        } else {
-          set val [wappInt-enc-url $val]
-          puts $chan "Set-Cookie: $nm=$val; HttpOnly; Path=/\r"
-        }
-      }
-    }
-  }
-  if {[string match text/* $mimetype]} {
-    set reply [encoding convertto utf-8 [dict get $wapp .reply]]
-    if {[regexp {\ygzip\y} [wapp-param HTTP_ACCEPT_ENCODING]]} {
-      catch {
-        set x [zlib gzip $reply]
-        set reply $x
-        puts $chan "Content-Encoding: gzip\r"
-      }
-    }
-  } else {
-    set reply [dict get $wapp .reply]
-  }
-  puts $chan "Content-Length: [string length $reply]\r"
-  puts $chan \r
-  puts -nonewline $chan $reply
-  flush $chan
-  wappInt-close-channel $chan
-}
-
-# This routine runs just prior to request-handler dispatch.  The
-# default implementation is a no-op, but applications can override
-# to do additional transformations or checks.
-#
-proc wapp-before-dispatch-hook {} {return}
-
-# Process a single CGI request
-#
-proc wappInt-handle-cgi-request {} {
-  global wapp env
-  foreach key {
-    CONTENT_LENGTH
-    CONTENT_TYPE
-    DOCUMENT_ROOT
-    HTTP_ACCEPT_ENCODING
-    HTTP_COOKIE
-    HTTP_HOST
-    HTTP_REFERER
-    HTTP_USER_AGENT
-    HTTPS
-    PATH_INFO
-    QUERY_STRING
-    REMOTE_ADDR
-    REQUEST_METHOD
-    REQUEST_URI
-    REMOTE_USER
-    SCRIPT_FILENAME
-    SCRIPT_NAME
-    SERVER_NAME
-    SERVER_PORT
-    SERVER_PROTOCOL
-  } {
-    if {[info exists env($key)]} {
-      dict set wapp $key $env($key)
-    }
-  }
-  set len 0
-  if {[dict exists $wapp CONTENT_LENGTH]} {
-    set len [dict get $wapp CONTENT_LENGTH]
-  }
-  if {$len>0} {
-    fconfigure stdin -translation binary
-    dict set wapp CONTENT [read stdin $len]
-  }
-  dict set wapp WAPP_MODE cgi
-  fconfigure stdout -translation binary
-  wappInt-handle-request stdout 1
-}
-
-# Process new text received on an inbound SCGI request
-#
-proc wappInt-scgi-readable {chan} {
-  if {[catch [list wappInt-scgi-readable-unsafe $chan] msg]} {
-    puts stderr "$msg\n$::errorInfo"
-    wappInt-close-channel $chan
-  }
-}
-proc wappInt-scgi-readable-unsafe {chan} {
-  upvar #0 wappInt-$chan W wapp wapp
-  if {![dict exists $W .toread]} {
-    # If the .toread key is not set, that means we are still reading
-    # the header.
-    #
-    # An SGI header is short.  This implementation assumes the entire
-    # header is available all at once.
-    #
-    dict set W .remove_addr [dict get $W REMOTE_ADDR]
-    set req [read $chan 15]
-    set n [string length $req]
-    scan $req %d:%s len hdr
-    incr len [string length "$len:,"]
-    append hdr [read $chan [expr {$len-15}]]
-    foreach {nm val} [split $hdr \000] {
-      if {$nm==","} break
-      dict set W $nm $val
-    }
-    set len 0
-    if {[dict exists $W CONTENT_LENGTH]} {
-      set len [dict get $W CONTENT_LENGTH]
-    }
-    if {$len>0} {
-      # Still need to read the query content
-      dict set W .toread $len
-    } else {
-      # There is no query content, so handle the request immediately
-      dict set W SERVER_ADDR [dict get $W .remove_addr]
-      set wapp $W
-      wappInt-handle-request $chan 0
-    }
-  } else {
-    # If .toread is set, that means we are reading the query content.
-    # Continue reading until .toread reaches zero.
-    set got [read $chan [dict get $W .toread]]
-    dict append W CONTENT $got
-    dict set W .toread [expr {[dict get $W .toread]-[string length $got]}]
-    if {[dict get $W .toread]<=0} {
-      # Handle the request as soon as all the query content is received
-      dict set W SERVER_ADDR [dict get $W .remove_addr]
-      set wapp $W
-      wappInt-handle-request $chan 0
-    }
-  }
-}
-
-# Start up the wapp framework.  Parameters are a list passed as the
-# single argument.
-#
-#    -server $PORT         Listen for HTTP requests on this TCP port $PORT
-#
-#    -local $PORT          Listen for HTTP requests on 127.0.0.1:$PORT
-#
-#    -scgi $PORT           Listen for SCGI requests on 127.0.0.1:$PORT
-#
-#    -remote-scgi $PORT    Listen for SCGI requests on TCP port $PORT
-#
-#    -cgi                  Handle a single CGI request
-#
-# With no arguments, the behavior is called "auto".  In "auto" mode,
-# if the GATEWAY_INTERFACE environment variable indicates CGI, then run
-# as CGI.  Otherwise, start an HTTP server bound to the loopback address
-# only, on an arbitrary TCP port, and automatically launch a web browser
-# on that TCP port.
-#
-# Additional options:
-#
-#    -fromip GLOB         Reject any incoming request where the remote
-#                         IP address does not match the GLOB pattern.  This
-#                         value defaults to '127.0.0.1' for -local and -scgi.
-#
-#    -nowait              Do not wait in the event loop.  Return immediately
-#                         after all event handlers are established.
-#
-#    -trace               "puts" each request URL as it is handled, for
-#                         debugging
-#
-#    -lint                Run wapp-safety-check on the application instead
-#                         of running the application itself
-#
-#    -Dvar=value          Set TCL global variable "var" to "value"
-#
-#
-proc wapp-start {arglist} {
-  global env
-  set mode auto
-  set port 0
-  set nowait 0
-  set fromip {}
-  set n [llength $arglist]
-  for {set i 0} {$i<$n} {incr i} {
-    set term [lindex $arglist $i]
-    if {[string match --* $term]} {set term [string range $term 1 end]}
-    switch -glob -- $term {
-      -server {
-        incr i;
-        set mode "server"
-        set port [lindex $arglist $i]
-      }
-      -local {
-        incr i;
-        set mode "local"
-        set fromip 127.0.0.1
-        set port [lindex $arglist $i]
-      }
-      -scgi {
-        incr i;
-        set mode "scgi"
-        set fromip 127.0.0.1
-        set port [lindex $arglist $i]
-      }
-      -remote-scgi {
-        incr i;
-        set mode "remote-scgi"
-        set port [lindex $arglist $i]
-      }
-      -cgi {
-        set mode "cgi"
-      }
-      -fromip {
-        incr i
-        set fromip [lindex $arglist $i]
-      }
-      -nowait {
-        set nowait 1
-      }
-      -trace {
-        proc wappInt-trace {} {
-          set q [wapp-param QUERY_STRING]
-          set uri [wapp-param BASE_URL][wapp-param PATH_INFO]
-          if {$q!=""} {append uri ?$q}
-          puts $uri
-        }
-      }
-      -lint {
-        set res [wapp-safety-check]
-        if {$res!=""} {
-          puts "Potential problems in this code:"
-          puts $res
-          exit 1
-        } else {
-          exit
-        }
-      }
-      -D*=* {
-        if {[regexp {^.D([^=]+)=(.*)$} $term all var val]} {
-          set ::$var $val
-        }
-      }
-      default {
-        error "unknown option: $term"
-      }
-    }
-  }
-  if {$mode=="auto"} {
-    if {[info exists env(GATEWAY_INTERFACE)]
-        && [string match CGI/1.* $env(GATEWAY_INTERFACE)]} {
-      set mode cgi
-    } else {
-      set mode local
-    }
-  }
-  if {$mode=="cgi"} {
-    wappInt-handle-cgi-request
-  } else {
-    wappInt-start-listener $port $mode $fromip
-    if {!$nowait} {
-      vwait ::forever
-    }
-  }
-}
-
-# Call this version 1.0
-package provide wapp 1.0
diff --git a/test/wapptest.tcl b/test/wapptest.tcl
deleted file mode 100755 (executable)
index d37b2e4..0000000
+++ /dev/null
@@ -1,909 +0,0 @@
-#!/bin/sh
-# \
-exec wapptclsh "$0" ${1+"$@"}
-
-# package required wapp
-source [file join [file dirname [info script]] wapp.tcl]
-
-# Variables set by the "control" form:
-#
-#   G(platform) - User selected platform.
-#   G(cfgglob)  - Glob pattern that all configurations must match
-#   G(test)     - Set to "Normal", "Veryquick", "Smoketest" or "Build-Only".
-#   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(cfgglob)  *
-set G(test)     Normal
-set G(keep)     1
-set G(msvc)     0
-set G(tcl)      [::tcl::pkgconfig get libdir,install]
-set G(jobs)     3
-set G(debug)    0
-
-set G(noui)     0
-set G(stdout)   0
-
-
-proc wapptest_init {} {
-  global G
-
-  set lSave [list platform test keep msvc tcl jobs debug noui stdout cfgglob] 
-  foreach k $lSave { set A($k) $G($k) }
-  array unset G
-  foreach k $lSave { set G($k) $A($k) }
-
-  # The root of the SQLite source tree.
-  set G(srcdir)   [file dirname [file dirname [info script]]]
-
-  set G(sqlite_version) "unknown"
-
-  # Either "config", "running" or "stopped":
-  set G(state) "config"
-
-  set G(hostname) "(unknown host)"
-  catch { set G(hostname) [exec hostname] } 
-  set G(host) $G(hostname)
-  append G(host) " $::tcl_platform(os) $::tcl_platform(osVersion)"
-  append G(host) " $::tcl_platform(machine) $::tcl_platform(byteOrder)"
-}
-
-proc wapptest_run {} {
-  global G
-  set_test_array
-  set G(state) "running"
-
-  wapptest_openlog
-
-  wapptest_output "Running the following for $G(platform). $G(jobs) jobs."
-  foreach t $G(test_array) {
-    set config [dict get $t config]
-    set target [dict get $t target]
-    wapptest_output [format "    %-25s%s" $config $target]
-  }
-  wapptest_output [string repeat * 70]
-}
-
-proc releasetest_data {args} {
-  global G
-  set rtd [file join $G(srcdir) test releasetest_data.tcl]
-  set fd [open "|[info nameofexecutable] $rtd $args" r+]
-  set ret [read $fd]
-  close $fd
-  return $ret
-}
-
-# Generate the text for the box at the top of the UI. The current SQLite
-# version, according to fossil, along with a warning if there are 
-# uncommitted changes in the checkout.
-#
-proc generate_fossil_info {} {
-  global G
-  set pwd [pwd]
-  cd $G(srcdir)
-  set rc [catch {
-    set r1 [exec fossil info]
-    set r2 [exec fossil changes]
-  }]
-  cd $pwd
-  if {$rc} return
-
-  foreach line [split $r1 "\n"] {
-    if {[regexp {^checkout: *(.*)$} $line -> co]} {
-      wapp-trim { <br> %html($co) }
-    }
-  }
-
-  if {[string trim $r2]!=""} {
-    wapp-trim { 
-      <br><span class=warning> 
-      WARNING: Uncommitted changes in checkout
-      </span>
-    }
-  }
-}
-
-# If the application is in "config" state, set the contents of the 
-# ::G(test_array) global to reflect the tests that will be run. If the
-# app is in some other state ("running" or "stopped"), this command
-# is a no-op.
-#
-proc set_test_array {} {
-  global G
-  if { $G(state)=="config" } {
-    set G(test_array) [list]
-    set debug "-debug"
-    if {$G(debug)==0} { set debug "-nodebug"}
-    foreach {config target} [releasetest_data tests $debug $G(platform)] {
-
-      # All configuration names must match $g(cfgglob), which defaults to *
-      #
-      if {![string match -nocase $G(cfgglob) $config]} continue
-
-      # If using MSVC, do not run sanitize or valgrind tests. Or the
-      # checksymbols test.
-      if {$G(msvc) && (
-          "Sanitize" == $config 
-       || "checksymbols" in $target
-       || "valgrindtest" in $target
-      )} {
-        continue
-      }
-
-      # If the test mode is not "Normal", override the target.
-      #
-      if {$target!="checksymbols" && $G(platform)!="Failure-Detection"} {
-        switch -- $G(test) {
-          Veryquick { set target quicktest }
-          Smoketest { set target smoketest }
-          Build-Only {
-            set target testfixture
-            if {$::tcl_platform(platform)=="windows"} {
-              set target testfixture.exe
-            }
-          }
-        }
-      }
-
-      lappend G(test_array) [dict create config $config target $target]
-    }
-  }
-}
-
-proc count_tests_and_errors {name logfile} {
-  global G
-
-  set fd [open $logfile rb]
-  set seen 0
-  while {![eof $fd]} {
-    set line [gets $fd]
-    if {[regexp {(\d+) errors out of (\d+) tests} $line all nerr ntest]} {
-      incr G(test.$name.nError) $nerr
-      incr G(test.$name.nTest) $ntest
-      set seen 1
-      if {$nerr>0} {
-        set G(test.$name.errmsg) $line
-      }
-    }
-    if {[regexp {runtime error: +(.*)} $line all msg]} {
-      # skip over "value is outside range" errors
-      if {[regexp {.* is outside the range of representable} $line]} {
-         # noop
-      } else {
-        incr G(test.$name.nError)
-        if {$G(test.$name.errmsg)==""} {
-          set G(test.$name.errmsg) $msg
-        }
-      }
-    }
-    if {[regexp {fatal error +(.*)} $line all msg]} {
-      incr G(test.$name.nError)
-      if {$G(test.$name.errmsg)==""} {
-        set G(test.$name.errmsg) $msg
-      }
-    }
-    if {[regexp {ERROR SUMMARY: (\d+) errors.*} $line all cnt] && $cnt>0} {
-      incr G(test.$name.nError)
-      if {$G(test.$name.errmsg)==""} {
-        set G(test.$name.errmsg) $all
-      }
-    }
-    if {[regexp {^VERSION: 3\.\d+.\d+} $line]} {
-      set v [string range $line 9 end]
-      if {$G(sqlite_version) eq "unknown"} {
-        set G(sqlite_version) $v
-      } elseif {$G(sqlite_version) ne $v} {
-        set G(test.$name.errmsg) "version conflict: {$G(sqlite_version)} vs. {$v}"
-      }
-    }
-  }
-  close $fd
-  if {$G(test) == "Build-Only"} {
-    incr G(test.$name.nTest)
-    if {$G(test.$name.nError)>0} {
-      set errmsg "Build failed"
-    }
-  } elseif {!$seen} {
-    set G(test.$name.errmsg) "Test did not complete"
-    if {[file readable core]} {
-      append G(test.$name.errmsg) " - core file exists"
-    }
-  }
-}
-
-proc wapptest_output {str} {
-  global G
-  if {$G(stdout)} { puts $str }
-  if {[info exists G(log)]} { 
-    puts $G(log) $str 
-    flush $G(log)
-  }
-}
-proc wapptest_openlog {} {
-  global G
-  set G(log) [open wapptest-out.txt w+]
-}
-proc wapptest_closelog {} {
-  global G
-  close $G(log)
-  unset G(log)
-}
-
-proc format_seconds {seconds} {
-  set min [format %.2d [expr ($seconds / 60) % 60]]
-  set  hr [format %.2d [expr $seconds / 3600]]
-  set sec [format %.2d [expr $seconds % 60]]
-  return "$hr:$min:$sec"
-}
-
-# 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
-      wapptest_make.sh
-      wapptest_configure.sh
-      wapptest_run.tcl
-    }
-    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 }
-      }
-    }
-  }
-
-  # Format a message regarding the success or failure of hte test.
-  set t [format_seconds [expr $G(test.$name.done) - $G(test.$name.start)]]
-  set res "OK"
-  if {$G(test.$name.nError)} { set res "FAILED" }
-  set dots [string repeat . [expr 60 - [string length $name]]]
-  set msg "$name $dots $res ($t)"
-
-  wapptest_output $msg
-  if {[info exists G(test.$name.errmsg)] && $G(test.$name.errmsg)!=""} {
-    wapptest_output "    $G(test.$name.errmsg)"
-  }
-}
-
-# 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. All it does is execute the
-# test script already written to disk (wapptest_cmd.sh or wapptest_cmd.bat).
-#
-proc wapptest_slave_script {} {
-  global G
-  if {$G(msvc)==0} {
-    set dir [file join .. $G(srcdir)]
-    set res [subst -nocommands {
-      set rc [catch "exec sh wapptest_cmd.sh {$dir} >>& test.log" ]
-      exit [set rc]
-    }]
-  } else {
-    set dir [file nativename [file normalize $G(srcdir)]]
-    set dir [string map [list "\\" "\\\\"] $dir]
-    set res [subst -nocommands {
-      set rc [catch "exec wapptest_cmd.bat {$dir} >>& test.log" ]
-      exit [set rc]
-    }]
-  }
-
-  set res
-}
-
-
-# Launch a slave process to run a test.
-#
-proc slave_launch {name target dir} {
-  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 test command to wapptest_cmd.sh|bat.
-  #
-  set ext sh
-  if {$G(msvc)} { set ext bat }
-  set fd1 [open [file join $dir wapptest_cmd.$ext] w]
-  if {$G(msvc)} {
-    puts $fd1 [releasetest_data script -msvc $name $target]
-  } else {
-    puts $fd1 [releasetest_data script $name $target]
-  }
-  close $fd1
-
-  # Write the wapptest_run.tcl script to the test directory. To run the
-  # commands in the other two files.
-  #
-  set fd3 [open [file join $dir wapptest_run.tcl] w]
-  puts $fd3 [wapptest_slave_script]
-  close $fd3
-
-  set pwd [pwd]
-  cd $dir
-  set fd [open "|[info nameofexecutable] wapptest_run.tcl" r+]
-  cd $pwd
-
-  set G(test.$name.channel) $fd
-  fconfigure $fd -blocking 0
-  fileevent $fd readable [list slave_fileevent $name]
-}
-
-proc do_some_stuff {} {
-  global G
-
-  # Count the number of running jobs. A running job has an entry named
-  # "channel" in its dictionary.
-  set nRunning 0
-  set bFinished 1
-  foreach j $G(test_array) {
-    set name [dict get $j config]
-    if { [info exists G(test.$name.channel)]} { incr nRunning   }
-    if {![info exists G(test.$name.done)]}    { set bFinished 0 }
-  }
-
-  if {$bFinished} {
-    set nError 0
-    set nTest 0
-    set nConfig 0
-    foreach j $G(test_array) {
-      set name [dict get $j config]
-      incr nError $G(test.$name.nError)
-      incr nTest $G(test.$name.nTest)
-      incr nConfig 
-    }
-    set G(result) "$nError errors from $nTest tests in $nConfig configurations."
-    wapptest_output [string repeat * 70]
-    wapptest_output $G(result)
-    catch {
-      append G(result) " SQLite version $G(sqlite_version)"
-      wapptest_output " SQLite version $G(sqlite_version)"
-    }
-    set G(state) "stopped"
-    wapptest_closelog
-    if {$G(noui)} { exit 0 }
-  } else {
-    set nLaunch [expr $G(jobs) - $nRunning]
-    foreach j $G(test_array) {
-      if {$nLaunch<=0} break
-      set name [dict get $j config]
-      if { ![info exists G(test.$name.channel)]
-        && ![info exists G(test.$name.done)]
-      } {
-
-        set target [dict get $j target]
-        set dir [string tolower [string map {" " _ "-" _} $name]]
-        set G(test.$name.start) [clock seconds]
-        set G(test.$name.log) [file join $dir test.log]
-
-        slave_launch $name $target $dir
-
-        incr nLaunch -1
-      }
-    }
-  }
-}
-
-proc generate_select_widget {label id lOpt opt} {
-  wapp-trim {
-    <label> %string($label) </label>
-    <select id=%string($id) name=%string($id)>
-  }
-  foreach o $lOpt {
-    set selected ""
-    if {$o==$opt} { set selected " selected=1" }
-    wapp-subst "<option $selected>$o</option>"
-  }
-  wapp-trim { </select> }
-}
-
-proc generate_main_page {{extra {}}} {
-  global G
-  set_test_array
-
-  set hostname $G(hostname)
-  wapp-trim {
-    <html>
-    <head>
-      <title> %html($hostname): wapptest.tcl </title>
-      <link rel="stylesheet" type="text/css" href="style.css"/>
-    </head>
-    <body>
-  }
-
-  set host $G(host)
-  wapp-trim {
-    <div class="border">%string($host)
-  }
-  generate_fossil_info
-  wapp-trim {
-    </div>
-    <div class="border" id=controls> 
-    <form action="control" method="post" name="control">
-  }
-
-  # Build the "platform" select widget. 
-  set lOpt [releasetest_data platforms]
-  generate_select_widget Platform control_platform $lOpt $G(platform)
-
-  # Build the "test" select widget. 
-  set lOpt [list Normal Veryquick Smoketest Build-Only] 
-  generate_select_widget Test control_test $lOpt $G(test)
-
-  # Build the "jobs" select widget. Options are 1 to 8.
-  generate_select_widget Jobs control_jobs {1 2 3 4 5 6 7 8 12 16} $G(jobs)
-
-  switch $G(state) {
-    config {
-      set txt "Run Tests!"
-      set id control_run
-    }
-    running {
-      set txt "STOP Tests!"
-      set id control_stop
-    }
-    stopped {
-      set txt "Reset!"
-      set id control_reset
-    }
-  }
-  wapp-trim {
-    <div class=right>
-    <input id=%string($id) name=%string($id) type=submit value="%string($txt)">
-    </input>
-    </div>
-  }
-
-  wapp-trim {
-  <br><br>
-        <label> Tcl: </label>
-        <input id="control_tcl" name="control_tcl"></input>
-        <label> Keep files: </label>
-        <input id="control_keep" name="control_keep" type=checkbox value=1>
-        </input>
-        <label> Use MSVC: </label>
-        <input id="control_msvc" name="control_msvc" type=checkbox value=1>
-        <label> Debug tests: </label>
-        <input id="control_debug" name="control_debug" type=checkbox value=1>
-        </input>
-  }
-  wapp-trim {
-     </form>
-  }
-  wapp-trim {
-     </div>
-     <div id=tests>
-  }
-  wapp-page-tests
-
-  set script "script/$G(state).js"
-  wapp-trim {
-    </div>
-      <script src=%string($script)></script>
-    </body>
-    </html>
-  }
-}
-
-proc wapp-default {} {
-  generate_main_page
-}
-
-proc wapp-page-tests {} {
-  global G
-  wapp-trim { <table class="border" width=100%> }
-  foreach t $G(test_array) {
-    set config [dict get $t config]
-    set target [dict get $t target]
-
-    set class "testwait"
-    set seconds ""
-
-    if {[info exists G(test.$config.log)]} {
-      if {[info exists G(test.$config.channel)]} {
-        set class "testrunning"
-        set seconds [expr [clock seconds] - $G(test.$config.start)]
-      } elseif {[info exists G(test.$config.done)]} {
-        if {$G(test.$config.nError)>0} {
-          set class "testfail" 
-        } else {
-          set class "testdone"
-        }
-        set seconds [expr $G(test.$config.done) - $G(test.$config.start)]
-      }
-      set seconds [format_seconds $seconds]
-    }
-
-    wapp-trim {
-      <tr class=%string($class)>
-      <td class="nowrap"> %html($config) 
-      <td class="padleft nowrap"> %html($target)
-      <td class="padleft nowrap"> %html($seconds)
-      <td class="padleft nowrap">
-    }
-    if {[info exists G(test.$config.log)]} {
-      set log $G(test.$config.log)
-      set uri "log/$log"
-      wapp-trim {
-        <a href=%url($uri)> %html($log) </a>
-      }
-    }
-    if {[info exists G(test.$config.errmsg)] && $G(test.$config.errmsg)!=""} {
-      set errmsg $G(test.$config.errmsg)
-      wapp-trim {
-        <tr class=testfail>
-        <td> <td class="padleft" colspan=3> %html($errmsg)
-      }
-    }
-  }
-
-  wapp-trim { </table> }
-
-  if {[info exists G(result)]} {
-    set res $G(result)
-    wapp-trim {
-      <div class=border id=result> %string($res) </div>
-    }
-  }
-}
-
-# URI: /control
-#
-# Whenever the form at the top of the application page is submitted, it
-# is submitted here.
-#
-proc wapp-page-control {} {
-  global G
-  if {$::G(state)=="config"} {
-    set lControls [list platform test tcl jobs keep msvc debug]
-    set G(msvc) 0
-    set G(keep) 0
-    set G(debug) 0
-  } else {
-    set lControls [list jobs]
-  }
-  foreach v $lControls {
-    if {[wapp-param-exists control_$v]} {
-      set G($v) [wapp-param control_$v]
-    }
-  }
-
-  if {[wapp-param-exists control_run]} {
-    # This is a "run test" command.
-    wapptest_run
-  }
-
-  if {[wapp-param-exists control_stop]} {
-    # A "STOP tests" command.
-    set G(state) "stopped"
-    set G(result) "Test halted by user"
-    foreach j $G(test_array) {
-      set name [dict get $j config]
-      if { [info exists G(test.$name.channel)] } {
-        close $G(test.$name.channel)
-        unset G(test.$name.channel)
-        slave_test_done $name 1
-      }
-    }
-    wapptest_closelog
-  }
-
-  if {[wapp-param-exists control_reset]} {
-    # A "reset app" command.
-    set G(state) "config"
-    wapptest_init
-  }
-
-  if {$::G(state) == "running"} {
-    do_some_stuff
-  }
-  wapp-redirect /
-}
-
-# URI: /style.css
-#
-# Return the stylesheet for the application main page.
-#
-proc wapp-page-style.css {} {
-  wapp-subst {
-
-    /* The boxes with black borders use this class */
-    .border {
-      border: 3px groove #444444;
-      padding: 1em;
-      margin-top: 1em;
-      margin-bottom: 1em;
-    }
-
-    /* Float to the right (used for the Run/Stop/Reset button) */
-    .right { float: right; }
-
-    /* Style for the large red warning at the top of the page */
-    .warning {
-      color: red;
-      font-weight: bold;
-    }
-
-    /* Styles used by cells in the test table */
-    .padleft { padding-left: 5ex; }
-    .nowrap  { white-space: nowrap; }
-
-    /* Styles for individual tests, depending on the outcome */
-    .testwait    {              }
-    .testrunning { color: blue  }
-    .testdone    { color: green }
-    .testfail    { color: red   }
-  }
-}
-
-# URI: /script/${state}.js
-#
-# The last part of this URI is always "config.js", "running.js" or 
-# "stopped.js", depending on the state of the application. It returns
-# the javascript part of the front-end for the requested state to the
-# browser.
-#
-proc wapp-page-script {} {
-  regexp {[^/]*$} [wapp-param REQUEST_URI] script
-
-  set tcl $::G(tcl)
-  set keep $::G(keep)
-  set msvc $::G(msvc)
-  set debug $::G(debug)
-  
-  wapp-subst {
-    var lElem = \["control_platform", "control_test", "control_msvc", 
-        "control_jobs", "control_debug"
-    \];
-    lElem.forEach(function(e) {
-      var elem = document.getElementById(e);
-      elem.addEventListener("change", function() { control.submit() } );
-    })
-
-    elem = document.getElementById("control_tcl");
-    elem.value = "%string($tcl)"
-
-    elem = document.getElementById("control_keep");
-    elem.checked = %string($keep);
-
-    elem = document.getElementById("control_msvc");
-    elem.checked = %string($msvc);
-
-    elem = document.getElementById("control_debug");
-    elem.checked = %string($debug);
-  }
-
-  if {$script != "config.js"} {
-    wapp-subst {
-      var lElem = \["control_platform", "control_test", 
-          "control_tcl", "control_keep", "control_msvc", 
-          "control_debug"
-      \];
-      lElem.forEach(function(e) {
-        var elem = document.getElementById(e);
-        elem.disabled = true;
-      })
-    }
-  }
-
-  if {$script == "running.js"} {
-    wapp-subst {
-      function reload_tests() {
-        fetch('tests')
-          .then( data => data.text() )
-          .then( data => {
-            document.getElementById("tests").innerHTML = data;
-          })
-          .then( data => {
-            if( document.getElementById("result") ){
-              document.location = document.location;
-            } else {
-              setTimeout(reload_tests, 1000)
-            }
-          });
-      }
-
-      setTimeout(reload_tests, 1000)
-    }
-  }
-}
-
-# URI: /env
-#
-# This is for debugging only. Serves no other purpose.
-#
-proc wapp-page-env {} {
-  wapp-allow-xorigin-params
-  wapp-trim {
-    <h1>Wapp Environment</h1>\n<pre>
-    <pre>%html([wapp-debug-env])</pre>
-  }
-}
-
-# URI: /log/dirname/test.log
-#
-# This URI reads file "dirname/test.log" from disk, wraps it in a <pre>
-# block, and returns it to the browser. Use for viewing log files.
-#
-proc wapp-page-log {} {
-  set log [string range [wapp-param REQUEST_URI] 5 end]
-  set fd [open $log]
-  set data [read $fd]
-  close $fd
-  wapp-trim {
-    <pre>
-    %html($data)
-    </pre>
-  }
-}
-
-# Print out a usage message. Then do [exit 1].
-#
-proc wapptest_usage {} {
-  puts stderr {
-This Tcl script is used to test various configurations of SQLite. By
-default it uses "wapp" to provide an interactive interface. Supported 
-command line options (all optional) are:
-
-    --platform    PLATFORM         (which tests to run)
-    --config      GLOB             (only run configurations matching GLOB)
-    --smoketest                    (run "make smoketest" only)
-    --veryquick                    (run veryquick.test only)
-    --buildonly                    (build executables, do not run tests)
-    --jobs        N                (number of concurrent jobs)
-    --tcl         DIR              (where to find tclConfig.sh)
-    --deletefiles                  (delete extra files after each test)
-    --msvc                         (Use MS Visual C)
-    --debug                        (Also run [n]debugging versions of tests)
-    --noui                         (do not use wapp)
-  }
-  exit 1
-}
-
-# Sort command line arguments into two groups: those that belong to wapp,
-# and those that belong to the application.
-set WAPPARG(-server)      1
-set WAPPARG(-local)       1
-set WAPPARG(-scgi)        1
-set WAPPARG(-remote-scgi) 1
-set WAPPARG(-fromip)      1
-set WAPPARG(-nowait)      0
-set WAPPARG(-cgi)         0
-set lWappArg [list]
-set lTestArg [list]
-for {set i 0} {$i < [llength $argv]} {incr i} {
-  set arg [lindex $argv $i]
-  if {[string range $arg 0 1]=="--"} {
-    set arg [string range $arg 1 end]
-  }
-  if {[info exists WAPPARG($arg)]} {
-    lappend lWappArg $arg
-    if {$WAPPARG($arg)} {
-      incr i
-      lappend lWappArg [lindex $argv $i]
-    }
-  } else {
-    lappend lTestArg $arg
-  }
-}
-
-wapptest_init
-for {set i 0} {$i < [llength $lTestArg]} {incr i} {
-  set opt [lindex $lTestArg $i]
-  if {[string range $opt 0 1]=="--"} {
-    set opt [string range $opt 1 end]
-  }
-  switch -- $opt {
-    -platform {
-      if {$i==[llength $lTestArg]-1} { wapptest_usage }
-      incr i
-      set arg [lindex $lTestArg $i]
-      set lPlatform [releasetest_data platforms]
-      if {[lsearch $lPlatform $arg]<0} {
-        puts stderr "No such platform: $arg. Platforms are: $lPlatform"
-        exit -1
-      }
-      set G(platform) $arg
-    }
-
-    -smoketest { set G(test) Smoketest }
-    -veryquick { set G(test) Veryquick }
-    -buildonly { set G(test) Build-Only }
-    -jobs {
-      if {$i==[llength $lTestArg]-1} { wapptest_usage }
-      incr i
-      set G(jobs) [lindex $lTestArg $i]
-    }
-
-    -tcl {
-      if {$i==[llength $lTestArg]-1} { wapptest_usage }
-      incr i
-      set G(tcl) [lindex $lTestArg $i]
-    }
-
-    -deletefiles {
-      set G(keep) 0
-    }
-
-    -msvc {
-      set G(msvc) 1
-    }
-
-    -debug {
-      set G(debug) 1
-    }
-
-    -noui {
-      set G(noui) 1
-      set G(stdout) 1
-    }
-
-    -config {
-      if {$i==[llength $lTestArg]-1} { wapptest_usage }
-      incr i
-      set G(cfgglob) [lindex $lTestArg $i]
-    }
-
-    -stdout {
-      set G(stdout) 1
-    }
-
-    default {
-      puts stderr "Unrecognized option: [lindex $lTestArg $i]"
-      wapptest_usage
-    }
-  }
-}
-
-if {$G(noui)==0} {
-  wapp-start $lWappArg
-} else {
-  wapptest_run
-  do_some_stuff
-  vwait forever
-}