/ Check-in [051c61eb]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix the shellN.test test scripts so that they work with the --testdir option.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 051c61ebae921b70f843c55aacf046a9922cc187
User & Date: dan 2016-03-15 09:55:44
Context
2016-03-15
12:37
More test-case changes so that everything works when the reserved_bytes value in the header is non-zero. check-in: 2fd095b1 user: drh tags: trunk
09:55
Fix the shellN.test test scripts so that they work with the --testdir option. check-in: 051c61eb user: dan tags: trunk
2016-03-14
21:26
Fix the permutations.test script so that it works again. check-in: 9f194f90 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/shell1.test.

    17     17   #
    18     18   #   shell1-1.*: Basic command line option handling.
    19     19   #   shell1-2.*: Basic "dot" command token parsing.
    20     20   #   shell1-3.*: Basic test that "dot" command can be called.
    21     21   #
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24         -if {$tcl_platform(platform)=="windows"} {
    25         -  set CLI "sqlite3.exe"
    26         -} else {
    27         -  set CLI "./sqlite3"
    28         -}
    29         -if {![file executable $CLI]} {
    30         -  finish_test
    31         -  return
    32         -}
           24  +set CLI [test_find_cli]
    33     25   db close
    34     26   forcedelete test.db test.db-journal test.db-wal
    35     27   sqlite3 db test.db
    36     28   
    37     29   #----------------------------------------------------------------------------
    38     30   # Test cases shell1-1.*: Basic command line option handling.
    39     31   #

Changes to test/shell2.test.

    16     16   
    17     17   # Test plan:
    18     18   #
    19     19   #   shell2-1.*: Misc. test of various tickets and reported errors.
    20     20   #
    21     21   set testdir [file dirname $argv0]
    22     22   source $testdir/tester.tcl
    23         -if {$tcl_platform(platform)=="windows"} {
    24         -  set CLI "sqlite3.exe"
    25         -} else {
    26         -  set CLI "./sqlite3"
    27         -}
    28         -if {![file executable $CLI]} {
    29         -  finish_test
    30         -  return
    31         -}
           23  +set CLI [test_find_cli]
    32     24   db close
    33     25   forcedelete test.db test.db-journal test.db-wal
    34     26   sqlite3 db test.db
    35     27   
    36     28   
    37     29   #----------------------------------------------------------------------------
    38     30   #   shell2-1.*: Misc. test of various tickets and reported errors.

Changes to test/shell3.test.

    17     17   # Test plan:
    18     18   #
    19     19   #   shell3-1.*: Basic tests for running SQL statments from command line.
    20     20   #   shell3-2.*: Basic tests for running SQL file from command line.
    21     21   #
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24         -if {$tcl_platform(platform)=="windows"} {
    25         -  set CLI "sqlite3.exe"
    26         -} else {
    27         -  set CLI "./sqlite3"
    28         -}
    29         -if {![file executable $CLI]} {
    30         -  finish_test
    31         -  return
    32         -}
           24  +set CLI [test_find_cli]
    33     25   db close
    34     26   forcedelete test.db test.db-journal test.db-wal
    35     27   sqlite3 db test.db
    36     28   
    37     29   #----------------------------------------------------------------------------
    38     30   #   shell3-1.*: Basic tests for running SQL statments from command line.
    39     31   #

Changes to test/shell4.test.

    17     17   # Test plan:
    18     18   #
    19     19   #   shell4-1.*: Basic tests specific to the "stats" command.
    20     20   #   shell4-2.*: Basic tests for ".trace"
    21     21   #
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24         -if {$tcl_platform(platform)=="windows"} {
    25         -  set CLI "sqlite3.exe"
    26         -} else {
    27         -  set CLI "./sqlite3"
    28         -}
    29         -if {![file executable $CLI]} {
    30         -  finish_test
    31         -  return
    32         -}
           24  +set CLI [test_find_cli]
    33     25   db close
    34     26   forcedelete test.db test.db-journal test.db-wal
    35     27   sqlite3 db test.db
    36     28   
    37     29   #----------------------------------------------------------------------------
    38     30   # Test cases shell4-1.*: Tests specific to the "stats" command.
    39     31   #

Changes to test/shell5.test.

    17     17   
    18     18   # Test plan:
    19     19   #
    20     20   #   shell5-1.*: Basic tests specific to the ".import" command.
    21     21   #
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24         -if {$tcl_platform(platform)=="windows"} {
    25         -  set CLI "sqlite3.exe"
    26         -} else {
    27         -  set CLI "./sqlite3"
    28         -}
    29         -if {![file executable $CLI]} {
    30         -  finish_test
    31         -  return
    32         -}
           24  +set CLI [test_find_cli]
    33     25   db close
    34     26   forcedelete test.db test.db-journal test.db-wal
    35     27   
    36     28   #----------------------------------------------------------------------------
    37     29   # Test cases shell5-1.*: Basic handling of the .import and .separator commands.
    38     30   #
    39     31   

Changes to test/tester.tcl.

  2131   2131     sqlite3_shutdown
  2132   2132     eval sqlite3_config_pagecache $::old_pagecache_config
  2133   2133     unset ::old_pagecache_config 
  2134   2134     sqlite3_initialize
  2135   2135     autoinstall_test_functions
  2136   2136     sqlite3 db test.db
  2137   2137   }
         2138  +
         2139  +# Find the name of the 'shell' executable (e.g. "sqlite3.exe") to use for
         2140  +# the tests in shell[1-5].test. If no such executable can be found, invoke
         2141  +# [finish_test ; return] in the callers context.
         2142  +#
         2143  +proc test_find_cli {} {
         2144  +  if {$::tcl_platform(platform)=="windows"} {
         2145  +    set ret "sqlite3.exe"
         2146  +  } else {
         2147  +    set ret "sqlite3"
         2148  +  }
         2149  +  set ret [file normalize [file join $::cmdlinearg(TESTFIXTURE_HOME) $ret]]
         2150  +  if {![file executable $ret]} {
         2151  +    finish_test
         2152  +    return -code return
         2153  +  }
         2154  +  return $ret
         2155  +}
  2138   2156   
  2139   2157   # If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
  2140   2158   # to non-zero, then set the global variable $AUTOVACUUM to 1.
  2141   2159   set AUTOVACUUM $sqlite_options(default_autovacuum)
  2142   2160   
  2143   2161   # Make sure the FTS enhanced query syntax is disabled.
  2144   2162   set sqlite_fts3_enable_parentheses 0