System.Data.SQLite
Check-in [916251d054]
Not logged in

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

Overview
Comment:Update several comments in the common unit test infrastructure. Slightly simplify the test for ticket [72905c9a77] and improve its comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 916251d0545af46ec91f8e1eae3dac214b90b00f
User & Date: mistachkin 2012-03-12 06:54:32
Context
2012-03-16
23:04
Update Eagle script library in externals to the latest pre-beta 22 and change tests as necessary. check-in: 7a9545bffd user: mistachkin tags: trunk
2012-03-12
06:54
Update several comments in the common unit test infrastructure. Slightly simplify the test for ticket [72905c9a77] and improve its comments. check-in: 916251d054 user: mistachkin tags: trunk
03:11
Update Eagle in Externals to the latest pre-beta 22 build. check-in: d05c18627d user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/common.eagle.

18
19
20
21
22
23
24
25
26
27
28



29
30
31
32
33
34
35
..
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
...
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc getBuildYear {} {
      #
      # NOTE: See if the "year" setting has been overridden by the user (e.g. on
      #       the command line).  This helps control exactly which set of
      #       binaries we are testing, those produced using either the Visual
      #       Studio 2008 or Visual Studio 2010 build systems.  To override this
      #       value via the command line, enter a command similar to one of the
      #       following (all on one line):



      #
      #       EagleShell.exe -preInitialize "set test_year 2008"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -preInitialize "set test_year 2010"
      #         -file .\path\to\all.eagle
      #
................................................................................
        #       default value will be based on whether or not Eagle has been
        #       compiled against the .NET Framework 2.0 or 4.0.
        #
        return $::test_year
      } else {
        #
        # NOTE: If Eagle has been compiled against the .NET Framework 4.0, use
        #       "2010" as the test year; otherwise, use "2008".  If another

        #       major [incompatible] version of the .NET Framework is released,
        #       this check will have to be changed.
        #
        return [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}]
      }
    }
 
    proc getBuildConfiguration {} {
      #
................................................................................
      }
    }
 
    proc tryLoadAssembly { fileName } {
      set fileName [getBinaryFileName $fileName]

      if {[catch {set assembly \
          [object load -loadtype File -alias $fileName]}] == 0} then {
        #
        # NOTE: Now, add the necessary test constraint.
        #
        addConstraint [file rootname [file tail $fileName]]

        #
        # NOTE: Grab the image runtime version from the assembly because







|
|
|
|
>
>
>







 







|
>
|
|







 







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
...
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc getBuildYear {} {
      #
      # NOTE: See if the "year" setting has been overridden by the user (e.g. on
      #       the command line).  This helps control exactly which set of
      #       binaries we are testing, those produced using the Visual Studio
      #       2005, 2008, or 2010 build systems.  To override this value via the
      #       command line, enter a command similar to one of the following (all
      #       on one line):
      #
      #       EagleShell.exe -preInitialize "set test_year 2005"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -preInitialize "set test_year 2008"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -preInitialize "set test_year 2010"
      #         -file .\path\to\all.eagle
      #
................................................................................
        #       default value will be based on whether or not Eagle has been
        #       compiled against the .NET Framework 2.0 or 4.0.
        #
        return $::test_year
      } else {
        #
        # NOTE: If Eagle has been compiled against the .NET Framework 4.0, use
        #       "2010" as the test year; otherwise, use "2008" (we could use
        #       "2005" in that case as well).  If another major [incompatible]
        #       version of the .NET Framework is released, this check will have
        #       to be changed.
        #
        return [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}]
      }
    }
 
    proc getBuildConfiguration {} {
      #
................................................................................
      }
    }
 
    proc tryLoadAssembly { fileName } {
      set fileName [getBinaryFileName $fileName]

      if {[catch {set assembly \
              [object load -loadtype File -alias $fileName]}] == 0} then {
        #
        # NOTE: Now, add the necessary test constraint.
        #
        addConstraint [file rootname [file tail $fileName]]

        #
        # NOTE: Grab the image runtime version from the assembly because

Changes to Tests/tkt-72905c9a77.eagle.

29
30
31
32
33
34
35
36


37
38
39
40
41
42
43
44
45
46
..
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
...
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
###############################################################################

#
# NOTE: *WARNING* This test has been extremely carefully designed; however, it
#       is still quite sensitive to machine timing, resource availability, etc.
#       This test MAY pass even if the bug under test has not been fixed (or
#       has been regressed somehow).  However, due to the unpredictable nature
#       of race conditions, it really is the best that can be done.


#
runTest {test tkt-72905c9a77-1.1 {StaticIsInitialized race condition} -setup {
  set version [file version [getBinaryFileName System.Data.SQLite.dll]]
  set fileName tkt-72905c9a77-1.1.db
} -body {
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
................................................................................
            //
            // NOTE: Add the trace listener to the collection of active trace
            //       listeners (for this application domain).
            //
            Trace.Listeners.Add(listener);

            //
            // NOTE: Lookup the type for the private SQLite3 class in the
            //       System.Data.SQLite assembly.  We need the type in order to
            //       lookup the method used in this test (via reflection).
            //       This is only necessary because the method under test is
            //       private and cannot normally be executed from C#.



            //
            Type type = Type.GetType(
                "System.Data.SQLite.SQLite3, System.Data.SQLite, " +
                "Version=${version}, Culture=neutral, " +
                "PublicKeyToken=db937bc2d44ff139");

            //
            // NOTE: Grab the method object for the private method we need for



            //       this test.
            //
            MethodInfo methodInfo = type.GetMethod("StaticIsInitialized",
                BindingFlags.Static | BindingFlags.NonPublic);

            //
            // NOTE: Create the event that will be used to synchronize all the
            //       created threads so that they start doing their actual test
................................................................................
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} GetTraceOutput
      } result] : [set result ""]}] [string map [list \r\n \n] $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors dataSource fileName version
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs "^Ok\
System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" [string repeat \
"SQLite message \\(0\\): TEST $id
" [expr {4 * [info processors]}]] "\\}\$"]}








|
>
>


<







 







|
|
|
|
|
>
>
>

|
|
<
<


|
>
>
>
|







 







|







29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
..
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
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
###############################################################################

#
# NOTE: *WARNING* This test has been extremely carefully designed; however, it
#       is still quite sensitive to machine timing, resource availability, etc.
#       This test MAY pass even if the bug under test has not been fixed (or
#       has been regressed somehow).  However, due to the unpredictable nature
#       of race conditions, it really is the best that can be done.  This test
#       will only work as intended if the version of System.Data.SQLite being
#       tested is 1.0.77.0 or higher.
#
runTest {test tkt-72905c9a77-1.1 {StaticIsInitialized race condition} -setup {

  set fileName tkt-72905c9a77-1.1.db
} -body {
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
................................................................................
            //
            // NOTE: Add the trace listener to the collection of active trace
            //       listeners (for this application domain).
            //
            Trace.Listeners.Add(listener);

            //
            // NOTE: Attempt to lookup the type for the private SQLite3 class
            //       in the System.Data.SQLite assembly.  We need the type in
            //       order to lookup the primary method used for this test (via
            //       reflection).  This is only necessary because the method
            //       under test is private and cannot normally be executed from
            //       C# directly.  If this fails, the following statement will
            //       throw a NullReferenceException, which is fine as that will
            //       cause the whole test to fail.
            //
            Type type = Type.GetType("System.Data.SQLite.SQLite3, " +
                "System.Data.SQLite");



            //
            // NOTE: Attempt to lookup the method object for the private method
            //       we need for this test.  If this fails, the first attempt
            //       to invoke the method using this variable will throw a
            //       NullReferenceException, which is fine as that will cause
            //       the whole test to fail.
            //
            MethodInfo methodInfo = type.GetMethod("StaticIsInitialized",
                BindingFlags.Static | BindingFlags.NonPublic);

            //
            // NOTE: Create the event that will be used to synchronize all the
            //       created threads so that they start doing their actual test
................................................................................
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catch {
        object invoke _Dynamic${id}.Test${id} GetTraceOutput
      } result] : [set result ""]}] [string map [list \r\n \n] $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors dataSource fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result [appendArgs "^Ok\
System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" [string repeat \
"SQLite message \\(0\\): TEST $id
" [expr {4 * [info processors]}]] "\\}\$"]}