System.Data.SQLite
Check-in [90e981ea2d]
Not logged in

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

Overview
Comment:Use save/restore semantics for environment variables modified by the test suite infrastructure.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 90e981ea2de5c1dd539f839149e91813f17a5ff0
User & Date: mistachkin 2015-12-20 07:13:48
Context
2015-12-31
22:58
Merge fix for [5251bd0878]. Update SQLite core library to the latest trunk code. Bump version to 1.0.100.0. Update version history docs. check-in: 59a224a9cf user: mistachkin tags: trunk
22:50
Merge fix for [5251bd0878]. Update SQLite core library to the latest trunk code. Bump version to 1.0.100.0. Update version history docs. check-in: 9f0c9b796f user: mistachkin tags: updates
2015-12-20
07:13
Use save/restore semantics for environment variables modified by the test suite infrastructure. check-in: 90e981ea2d user: mistachkin tags: trunk
07:13
Stop leaking the 'savedEnv' script variable in tests 'data-1.68' and 'data-1.69'. check-in: 90e0d6df11 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to lib/System.Data.SQLite/common.eagle.

  2333   2333           # NOTE: The file does not exist, success!
  2334   2334           #
  2335   2335           set code 0
  2336   2336         }
  2337   2337   
  2338   2338         return $code
  2339   2339       }
         2340  +
         2341  +    proc saveEnvironmentVariables { names {varName ""} } {
         2342  +      #
         2343  +      # NOTE: For each name, does the live environment variable exist?  If
         2344  +      #       so, save the value for later; otherwise, make sure the saved
         2345  +      #       value does not exist either.  The live environment variables
         2346  +      #       ARE NOT changed by this procedure.
         2347  +      #
         2348  +      if {[string length $varName] == 0} then {
         2349  +        set varName savedEnv
         2350  +      }
         2351  +
         2352  +      upvar 1 $varName savedEnv
         2353  +
         2354  +      foreach name $names {
         2355  +        if {[info exists ::env($name)]} then {
         2356  +          set savedEnv($name) $::env($name)
         2357  +        } else {
         2358  +          unset -nocomplain savedEnv($name)
         2359  +        }
         2360  +      }
         2361  +
         2362  +      #
         2363  +      # NOTE: This is self-cleaning.  If no saved environment variables now
         2364  +      #       exist, remove the array.
         2365  +      #
         2366  +      if {[array size savedEnv] == 0} then {
         2367  +        unset -nocomplain savedEnv
         2368  +      }
         2369  +    }
         2370  +
         2371  +    proc restoreEnvironmentVariables { names {varName ""} } {
         2372  +      #
         2373  +      # NOTE: For each name, does the saved environment variable exist?  If
         2374  +      #       so, restore the saved value and unset it; otherwise, make sure
         2375  +      #       the live environment variable does not exist either (i.e. it
         2376  +      #       was not set to begin with).  Both saved and live environment
         2377  +      #       variables ARE changed by this procedure.
         2378  +      #
         2379  +      if {[string length $varName] == 0} then {
         2380  +        set varName savedEnv
         2381  +      }
         2382  +
         2383  +      upvar 1 $varName savedEnv
         2384  +
         2385  +      foreach name $names {
         2386  +        if {[info exists savedEnv($name)]} then {
         2387  +          set ::env($name) $savedEnv($name)
         2388  +          unset -nocomplain savedEnv($name)
         2389  +        } else {
         2390  +          unset -nocomplain ::env($name)
         2391  +        }
         2392  +      }
         2393  +
         2394  +      #
         2395  +      # NOTE: This is self-cleaning.  If no saved environment variables now
         2396  +      #       exist, remove the array.
         2397  +      #
         2398  +      if {[array size savedEnv] == 0} then {
         2399  +        unset -nocomplain savedEnv
         2400  +      }
         2401  +    }
  2340   2402   
  2341   2403       proc setupDbInterruptCallback { channel log } {
  2342   2404         tputs $channel "---- setting up debugger interrupt callback... "
  2343   2405   
  2344   2406         if {[catch {
  2345         -        set ::env(quietFindInterpreterTestPath) 1
  2346         -        set ::env(quietSetupInterpreterTestPath) 1
         2407  +        saveEnvironmentVariables [list \
         2408  +            quietFindInterpreterTestPath quietSetupInterpreterTestPath]
  2347   2409   
  2348   2410           try {
         2411  +          #
         2412  +          # NOTE: Prevent the vendor script from being noisy when creating
         2413  +          #       the isolated interpreter.
         2414  +          #
         2415  +          set ::env(quietFindInterpreterTestPath) 1
         2416  +          set ::env(quietSetupInterpreterTestPath) 1
         2417  +
  2349   2418             #
  2350   2419             # NOTE: Make sure the script debugger and the isolated interpreter
  2351   2420             #       are setup and ready for use.
  2352   2421             #
  2353   2422             debug setup true true
  2354   2423   
  2355   2424             #
................................................................................
  2407   2476                   tputs $::test_channel [appendArgs \n \
  2408   2477                       "==== WARNING: cannot cancel any queries: " \
  2409   2478                       "the \"object\" command is not available\n"]
  2410   2479                 }
  2411   2480               }
  2412   2481             }}
  2413   2482           } finally {
  2414         -          catch {unset ::env(quietSetupInterpreterTestPath)}
  2415         -          catch {unset ::env(quietFindInterpreterTestPath)}
         2483  +          restoreEnvironmentVariables [list \
         2484  +              quietFindInterpreterTestPath quietSetupInterpreterTestPath]
  2416   2485           }
  2417   2486         } error] == 0} then {
  2418   2487           addConstraint interruptCallback.sqlite3
  2419   2488   
  2420   2489           tputs $channel yes\n
  2421   2490         } else {
  2422   2491           tputs $channel [appendArgs "no, error: " \n\t $error \n]