System.Data.SQLite
Check-in [a6e4e7b517]
Not logged in

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

Overview
Comment:Simplify implementation and usage of the getAppDomainPreamble test suite infrastructure procedure.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a6e4e7b517e5fb52de18c6165b90cdcff22faf53
User & Date: mistachkin 2012-10-08 12:17:41
Context
2012-10-08
13:48
Enhancements to test suite infrastructure and comments. check-in: 34eb58d008 user: mistachkin tags: trunk
12:17
Simplify implementation and usage of the getAppDomainPreamble test suite infrastructure procedure. check-in: a6e4e7b517 user: mistachkin tags: trunk
09:11
Add support for extra diagnostics in the native interop assembly when compiled in the debug build configuration. Fix several tests to account for recent changes to the setupDb and cleanupDb test suite infrastructure procedures. check-in: e8a0cf1336 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.

33
34
35
36
37
38
39
40



41
42
43
44
45
46
47
48









49
50
51
52
53
54
55
...
156
157
158
159
160
161
162

163
164
165

166
167
168
169
170
171
172
173
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    proc checkForTestOverrides { channel varNames quiet } {
      set result 0

      foreach varName $varNames {
        if {[uplevel 1 [list info exists $varName]]} then {



          incr result

          if {!$quiet} then {
            tqputs $channel [appendArgs \
                "---- found vendor-specific test override \"" $varName "\".\n"]
          }
        }
      }










      return $result
    }
 
    proc addTestSuiteToAutoPath { channel varName quiet } {
      #
      # NOTE: Start with the directory containing this file.
................................................................................
      }
    }
 
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #

    checkForTestOverrides stdout [list binary_directory build_base_directory \
        build_directory common_directory connection_flags database_directory \
        datetime_format test_configuration test_year test_year_clr_v2 \

        temporary_directory test_year_clr_v4 vendor_directory] false

    #
    # NOTE: This variable will contain the name of the directory containing the
    #       vendor-specific testing infrastructure.  If the variable does not
    #       already exist, create it; otherwise, it has been overridden and the
    #       existing value should be left intact.
    #







|
>
>
>
|

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







 







>
|

<
>
|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
...
168
169
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
186
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    proc checkForTestOverrides { channel varNames quiet } {
      set result 0

      foreach varName $varNames {
        if {![uplevel 1 [list info exists $varName]]} then {
          continue
        }

        incr result

        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- found vendor-specific test override \"" $varName "\".\n"]
        }
      }

      #
      # NOTE: Keep track of the list of test override variables, for later
      #       use by the test suite.  This needs to be done after the loop
      #       above because the variable used to keep track is listed with
      #       the other possible test override variables.
      #
      if {![uplevel 1 [list info exists test_overrides]]} then {
        uplevel 1 [list set test_overrides $varNames]
      }

      return $result
    }
 
    proc addTestSuiteToAutoPath { channel varName quiet } {
      #
      # NOTE: Start with the directory containing this file.
................................................................................
      }
    }
 
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #
    checkForTestOverrides stdout [expr {[info exists test_overrides] ? \
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory connection_flags database_directory \

        datetime_format temporary_directory test_configuration test_overrides \
        test_year test_year_clr_v2 test_year_clr_v4 vendor_directory]}] false

    #
    # NOTE: This variable will contain the name of the directory containing the
    #       vendor-specific testing infrastructure.  If the variable does not
    #       already exist, create it; otherwise, it has been overridden and the
    #       existing value should be left intact.
    #

Changes to Tests/common.eagle.

327
328
329
330
331
332
333
























































334
335
336
337
338
339
340
...
352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
        #       therefore, use it.
        #
        return [file normalize $::temporary_directory]
      } else {
        return [getTemporaryPath]
      }
    }
























































 
    proc getAppDomainPreamble { {prefix ""} {suffix ""} } {
      #
      # NOTE: This procedure returns a test setup script suitable for evaluation
      #       by a test interpreter created in an isolated application domain.
      #       The script being returned will be surrounded by the prefix and
      #       suffix "script fragments" specified by our caller, if any.  The
................................................................................
      #       being evaluated in the context of the calling interpreter and not
      #       the test interpreter created in the isolated application domain.
      #
      return [uplevel 1 [list subst [appendArgs $prefix {
        if {[hasRuntimeOption native]} then {
          object invoke Interpreter.GetActive AddRuntimeOption native
        }

        set ::test_channel {$::test_channel}
        set ::path {$::path}
        set ::test_year {[getBuildYear]}
        set ::test_configuration {[getBuildConfiguration]}
      } $suffix]]]

    }
 
    proc tryCopyBuildFile { fileName } {
      #
      # NOTE: If we cannot copy the assembly then it is probably already loaded.
      #
      set sourceFileName [getBuildFileName $fileName]







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
>







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
408
409
410
411
412
413
414






415
416
417
418
419
420
421
422
        #       therefore, use it.
        #
        return [file normalize $::temporary_directory]
      } else {
        return [getTemporaryPath]
      }
    }
 
    proc getTestOverridesPreamble { {extraVarNames ""} } {
      set varNames [list]

      #
      # NOTE: If available, start with the master list of test override
      #       variables.
      #
      if {[info exists ::test_overrides] && \
          [llength $::test_overrides] > 0} then {
        eval lappend varNames $::test_overrides
      }

      #
      # NOTE: If requested by the caller, add any additional variable
      #       names to copy now.
      #
      if {[llength $extraVarNames] > 0} then {
        eval lappend varNames $extraVarNames
      }

      #
      # NOTE: Build the script fragment to be returned by processing each
      #       variable name and adding the nececessary script fragments for
      #       each one.
      #
      set result ""

      foreach varName $varNames {
        #
        # NOTE: Build the qualified global variable name.
        #
        set fullVarName [appendArgs :: $varName]

        #
        # NOTE: Does the variable exist in this interpreter context?
        #
        if {[info exists $fullVarName]} then {
          #
          # NOTE: Append a script fragment to the result that will correctly
          #       copy any contained value to another interpreter context.
          #
          append result \n "set " $fullVarName " \{" [set $fullVarName] \}
        }
      }

      #
      # NOTE: If the result contains one or more script fragments, append a
      #       newline.
      #
      if {[string length $result] > 0} then {
        append result \n
      }

      return $result
    }
 
    proc getAppDomainPreamble { {prefix ""} {suffix ""} } {
      #
      # NOTE: This procedure returns a test setup script suitable for evaluation
      #       by a test interpreter created in an isolated application domain.
      #       The script being returned will be surrounded by the prefix and
      #       suffix "script fragments" specified by our caller, if any.  The
................................................................................
      #       being evaluated in the context of the calling interpreter and not
      #       the test interpreter created in the isolated application domain.
      #
      return [uplevel 1 [list subst [appendArgs $prefix {
        if {[hasRuntimeOption native]} then {
          object invoke Interpreter.GetActive AddRuntimeOption native
        }






      } [getTestOverridesPreamble [list path test_channel]] $suffix]]]
    }
 
    proc tryCopyBuildFile { fileName } {
      #
      # NOTE: If we cannot copy the assembly then it is probably already loaded.
      #
      set sourceFileName [getBuildFileName $fileName]

Changes to Tests/tkt-2ce0870fad.eagle.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

for {set i 1} {$i < 3} {incr i} {
  runTest {test [appendArgs tkt-2ce0870fad-1. $i] {logging setup} -setup \
      [getAppDomainPreamble {
    set i {$i}
    set appDomainId($i) {[object invoke AppDomain.CurrentDomain Id]}
    set fileName {[appendArgs tkt-2ce0870fad-1. $i .db]}

    #
    # NOTE: Keep track of whether or not the global test year and configuration
    #       variables already exist in the primary application domain before the
    #       test.  If not, we will need to unset them after the test.
    #
    set hadTestChannel {[info exists ::test_channel]}
    set hadTestYear {[info exists ::test_year]}
    set hadTestYearClrV2 {[info exists ::test_year_clr_v2]}
    set hadTestYearClrV4 {[info exists ::test_year_clr_v4]}
    set hadTestConfiguration {[info exists ::test_configuration]}
  }] -body {
    set appDomainId(3) [object invoke AppDomain.CurrentDomain Id]

    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

................................................................................

    list $appDomainId($i) $appDomainId(3) [expr {$i == 1 ? \
        $appDomainId($i) != $appDomainId(3) : \
        $appDomainId($i) == $appDomainId(3)}] [setupDb $fileName]
  } -cleanup {
    cleanupDb $fileName

    if {!$hadTestConfiguration} then {
      unset -nocomplain ::test_configuration
    }

    if {!$hadTestYearClrV4} then {
      unset -nocomplain ::test_year_clr_v4
    }

    if {!$hadTestYearClrV2} then {
      unset -nocomplain ::test_year_clr_v2
    }

    if {!$hadTestYear} then {
      unset -nocomplain ::test_year
    }

    if {!$hadTestChannel} then {
      unset -nocomplain ::test_channel
    }

    #
    # NOTE: If this is the primary application domain, skip unsetting the
    #       loop variable because the surrounding [for] command still needs
    #       it.
    #
    if {$i <= 1} then {
      unset -nocomplain i
    }

    unset -nocomplain assembly appDomainId db fileName hadTestConfiguration \
        hadTestYearClrV4 hadTestYearClrV2 hadTestYear hadTestChannel
  } -constraints {eagle monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \
[expr {$i == 1 ? "AppDomain" : "Default"}] -match regexp -result \
{^\d+ \d+ True System#Data#SQLite#SQLiteConnection#\d+$}}
}

###############################################################################







<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<









|
<







33
34
35
36
37
38
39











40
41
42
43
44
45
46
..
51
52
53
54
55
56
57




















58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74

for {set i 1} {$i < 3} {incr i} {
  runTest {test [appendArgs tkt-2ce0870fad-1. $i] {logging setup} -setup \
      [getAppDomainPreamble {
    set i {$i}
    set appDomainId($i) {[object invoke AppDomain.CurrentDomain Id]}
    set fileName {[appendArgs tkt-2ce0870fad-1. $i .db]}











  }] -body {
    set appDomainId(3) [object invoke AppDomain.CurrentDomain Id]

    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

................................................................................

    list $appDomainId($i) $appDomainId(3) [expr {$i == 1 ? \
        $appDomainId($i) != $appDomainId(3) : \
        $appDomainId($i) == $appDomainId(3)}] [setupDb $fileName]
  } -cleanup {
    cleanupDb $fileName





















    #
    # NOTE: If this is the primary application domain, skip unsetting the
    #       loop variable because the surrounding [for] command still needs
    #       it.
    #
    if {$i <= 1} then {
      unset -nocomplain i
    }

    unset -nocomplain assembly appDomainId db fileName

  } -constraints {eagle monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \
[expr {$i == 1 ? "AppDomain" : "Default"}] -match regexp -result \
{^\d+ \d+ True System#Data#SQLite#SQLiteConnection#\d+$}}
}

###############################################################################