System.Data.SQLite
Check-in [0c6f84763c]
Not logged in

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

Overview
Comment:Enhancements to unit test infrastructure to enable profiling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0c6f84763cbd589e7f104af8b688ae3f74eae2ff
User & Date: mistachkin 2011-07-08 10:24:28
Context
2011-07-08
10:27
Removing copying of assembly files from unit tests as they are now copied in the common prologue. check-in: bbc7c21748 user: mistachkin tags: trunk
10:24
Enhancements to unit test infrastructure to enable profiling. check-in: 0c6f84763c user: mistachkin tags: trunk
10:22
Make the fix for [e1b2e0f769] more robust for corner cases. check-in: ce4f34e190 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/all.eagle.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
65
66
67
68
69
70
71

72

#
# NOTE: Pre-load the assembly and the necessary helper procedures now, so that
#       they do not count as being "leaked" (i.e. the test framework has no way
#       to know who procedures actually belong to).
#
source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll
tryLoadAssembly System.Data.SQLite.Linq.dll

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

set no(prologue.eagle) true
set no(epilogue.eagle) true

#
................................................................................
unset no(epilogue.eagle)
unset no(prologue.eagle)

if {[array size no] == 0} then {unset no}

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


runTestEpilogue







|
<







 







>

23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
..
64
65
66
67
68
69
70
71
72

#
# NOTE: Pre-load the assembly and the necessary helper procedures now, so that
#       they do not count as being "leaked" (i.e. the test framework has no way
#       to know who procedures actually belong to).
#
source [file join $path common.eagle]
runSQLiteTestPrologue


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

set no(prologue.eagle) true
set no(epilogue.eagle) true

#
................................................................................
unset no(epilogue.eagle)
unset no(prologue.eagle)

if {[array size no] == 0} then {unset no}

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/basic.eagle.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
126
127
128
129
130
131
132

133
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll
tryLoadAssembly System.Data.SQLite.Linq.dll

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

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set testExeFile [getBuildFileName test.exe]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [getBuildFileName northwindEF.db]
set testLinqOutFile [file join $path testlinq.out]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint file_[file tail $testExeFile]]} then {
  checkForFile $test_channel $testExeFile
}
................................................................................
  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  unset -nocomplain code output error
} -constraints {eagle System.Data.SQLite file_test.exe} -result {0 {}}}

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

runTest {test basic-1.2 {unit tests from the 'testlinq' project} -setup {
  #
  # NOTE: We need to make 100% sure that the console output encoding is the
  #       same as when the 'testlinq.out' file was created.
................................................................................

  list $code [string equal $output [readFile $testLinqOutFile]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}

  unset -nocomplain code output error savedEncoding encoding
} -constraints {eagle System.Data.SQLite file_testlinq.exe file_northwindEF.db\
file_testlinq.out} -result {0 True {}}}

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

runTest {test basic-1.3 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName basic-1.1.db]
} -body {
  set result [list]
................................................................................

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

unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile

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


runTestEpilogue







|
<










|







 







|







 







|
|







 







>

12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
...
125
126
127
128
129
130
131
132
133
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
runSQLiteTestPrologue


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

#
# NOTE: Setup the variables that refer to the various files required by the
#       tests in this file.
#
set testExeFile [getBuildFileName test.exe]
set testLinqExeFile [getBuildFileName testlinq.exe]
set northwindEfDbFile [getBuildFileName northwindEF.db]
set testLinqOutFile [file nativename [file join $path testlinq.out]]

#
# NOTE: Setup the test constraints specific to the tests in this file.
#
if {![haveConstraint file_[file tail $testExeFile]]} then {
  checkForFile $test_channel $testExeFile
}
................................................................................
  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  unset -nocomplain code output error
} -constraints {eagle file_test.exe} -result {0 {}}}

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

runTest {test basic-1.2 {unit tests from the 'testlinq' project} -setup {
  #
  # NOTE: We need to make 100% sure that the console output encoding is the
  #       same as when the 'testlinq.out' file was created.
................................................................................

  list $code [string equal $output [readFile $testLinqOutFile]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}

  unset -nocomplain code output error savedEncoding encoding
} -constraints {eagle file_testlinq.exe file_northwindEF.db file_testlinq.out} \
-result {0 True {}}}

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

runTest {test basic-1.3 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName basic-1.1.db]
} -body {
  set result [list]
................................................................................

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

unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/common.eagle.

4
5
6
7
8
9
10
11
12
13
14
15
16
17



18











19
20
21
22
23
24























































25
26
27
28
29
30
31
...
103
104
105
106
107
108
109
110





























#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

if {[isEagle]} then {
  proc getBuildFileName { fileName } {
    return [file join [file dirname $::path] bin \
        [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}] \
        $::test_configuration bin $fileName]
  }
 
  proc copyAssembly { fileName } {



    #











    # NOTE: If we cannot copy the file then it is probably already loaded,
    #       ignore the error.
    #
    catch {
      file copy -force [getBuildFileName $fileName] \
          [file join [info binary] $fileName]























































    }
  }
 
  proc tryLoadAssembly { fileName } {
    set fileName [getBuildFileName $fileName]

    if {[catch {set assembly \
................................................................................
  }
 
  proc cleanupDb {fileName {varName db}} {
    upvar 1 $varName db
    catch {sql close $db}
    catch {file delete [file join [getTemporaryPath] $fileName]}
  }
}




































|


|


|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
<

<
|
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
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
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

if {[isEagle]} then {
  proc getBuildDirectory {} {
    return [file join [file dirname $::path] bin \
        [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}] \
        $::test_configuration bin]
  }
 
  proc getBuildFileName { fileName } {
    return [file nativename \
        [file join [getBuildDirectory] [file tail $fileName]]]
  }
 
  proc getBinaryDirectory {} {
    return [info binary]
  }
 
  proc getBinaryFileName { fileName } {
    return [file nativename \
        [file join [getBinaryDirectory] [file tail $fileName]]]
  }
 
  proc tryCopyBuildFile { fileName } {
    #
    # NOTE: If we cannot copy the assembly then it is probably already loaded.

    #

    set sourceFileName [getBuildFileName $fileName]


    if {![file exists $sourceFileName]} then {
      tputs $::test_channel [appendArgs \
          "---- skipped copying build file \"" $sourceFileName \
          "\", it does not exist\n"]

      return
    }

    set targetFileName [getBinaryFileName $fileName]

    if {[catch {file copy -force $sourceFileName $targetFileName}] == 0} then {
      tputs $::test_channel [appendArgs \
          "---- copied build file from \"" $sourceFileName "\" to \"" \
          $targetFileName \"\n]
    } else {
      tputs $::test_channel [appendArgs \
          "---- failed to copy build file from \"" $sourceFileName "\" to \"" \
          $targetFileName \"\n]
    }
  }
 
  proc tryDeleteBinaryFile { fileName } {
    set fileName [getBinaryFileName $fileName]

    if {![file exists $fileName]} then {
      tputs $::test_channel [appendArgs \
          "---- skipped deleting binary file \"" $fileName \
          "\", it does not exist\n"]

      return
    }

    if {[catch {file delete $fileName}] == 0} then {
      tputs $::test_channel [appendArgs \
          "---- deleted binary file \"" $fileName \"\n]
    } else {
      tputs $::test_channel [appendArgs \
          "---- failed to delete binary file \"" $fileName \"\n]
    }
  }
 
  proc tryCopyAssembly { fileName {pdb true} } {
    tryCopyBuildFile $fileName

    if {$pdb} then {
      tryCopyBuildFile [appendArgs [file rootname $fileName] .pdb]
    }
  }
 
  proc tryDeleteAssembly { fileName {pdb true} } {
    tryDeleteBinaryFile $fileName

    if {$pdb} then {
      tryDeleteBinaryFile [appendArgs [file rootname $fileName] .pdb]
    }
  }
 
  proc tryLoadAssembly { fileName } {
    set fileName [getBuildFileName $fileName]

    if {[catch {set assembly \
................................................................................
  }
 
  proc cleanupDb {fileName {varName db}} {
    upvar 1 $varName db
    catch {sql close $db}
    catch {file delete [file join [getTemporaryPath] $fileName]}
  }
 
  proc runSQLiteTestPrologue {} {
    #
    # NOTE: Skip running our custom prologue if the main one has been skipped.
    #
    if {![info exists ::no(prologue.eagle)]} then {
      tryDeleteAssembly SQLite.Interop.dll
      tryDeleteAssembly System.Data.SQLite.dll
      tryDeleteAssembly System.Data.SQLite.Linq.dll

      tryCopyAssembly SQLite.Interop.dll
      tryCopyAssembly System.Data.SQLite.dll
      tryCopyAssembly System.Data.SQLite.Linq.dll

      tryLoadAssembly System.Data.SQLite.dll
      tryLoadAssembly System.Data.SQLite.Linq.dll
    }
  }
 
  proc runSQLiteTestEpilogue {} {
    #
    # NOTE: Skip running our custom epilogue if the main one has been skipped.
    #
    if {![info exists ::no(epilogue.eagle)]} then {
      #
      # NOTE: For now, nothing is done here.
      #
    }
  }
}

Changes to Tests/tkt-201128cc88.eagle.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
95
96
97
98
99
100
101

102
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll

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

runTest {test tkt-201128cc88-1.1 {custom function with byte[] arg} -setup {
  copyAssembly SQLite.Interop.dll
  copyAssembly System.Data.SQLite.dll
  set fileName tkt-201128cc88-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
................................................................................
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\
SQLiteConnection#\d+ \{\} \{\} Zm9v$}}

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


runTestEpilogue







|




|
|







 







>

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
95
96
97
98
99
100
101
102
103
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
runSQLiteTestPrologue

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

runTest {test tkt-201128cc88-1.1 {custom function with byte[] arg} -setup {
  tryCopyAssembly SQLite.Interop.dll
  tryCopyAssembly System.Data.SQLite.dll
  set fileName tkt-201128cc88-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
................................................................................
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\
SQLiteConnection#\d+ \{\} \{\} Zm9v$}}

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/tkt-2c630bffa7.eagle.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
90
91
92
93
94
95
96

97
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll

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

set y [list -1.79769e308 -3.40282e038 -1 0 1 3.40282e038 1.79769e308]

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

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

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

unset -nocomplain y

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


runTestEpilogue







|







 







>

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
90
91
92
93
94
95
96
97
98
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
runSQLiteTestPrologue

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

set y [list -1.79769e308 -3.40282e038 -1 0 1 3.40282e038 1.79769e308]

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

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

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

unset -nocomplain y

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/tkt-448d663d11.eagle.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
255
256
257
258
259
260
261

262
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll

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

runTest {test tkt-448d663d11-1.1 {missing journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.1.db]
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
................................................................................
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}}

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


runTestEpilogue







|







 







>

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
255
256
257
258
259
260
261
262
263
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
runSQLiteTestPrologue

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

runTest {test tkt-448d663d11-1.1 {missing journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.1.db]
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
................................................................................
  cleanupDb $fileName
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}}

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

runSQLiteTestEpilogue
runTestEpilogue

Changes to Tests/tkt-e1b2e0f769.eagle.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
123
124
125
126
127
128
129

130
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
tryLoadAssembly System.Data.SQLite.dll

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

runTest {test tkt-e1b2e0f769-1.1 {data reader cleanup} -setup {
  copyAssembly SQLite.Interop.dll
  copyAssembly System.Data.SQLite.dll
  setupDb [set fileName tkt-e1b2e0f769-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"
  sql execute $db "CREATE TABLE t2(x INTEGER);"

  foreach x [list 1 2 3] {
    sql execute $db "INSERT INTO t1 (x) VALUES($x);"
................................................................................
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

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


runTestEpilogue







|




|
|







 







>

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
123
124
125
126
127
128
129
130
131
package require EagleTest

runTestPrologue

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

source [file join $path common.eagle]
runSQLiteTestPrologue

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

runTest {test tkt-e1b2e0f769-1.1 {data reader cleanup} -setup {
  tryCopyAssembly SQLite.Interop.dll
  tryCopyAssembly System.Data.SQLite.dll
  setupDb [set fileName tkt-e1b2e0f769-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"
  sql execute $db "CREATE TABLE t2(x INTEGER);"

  foreach x [list 1 2 3] {
    sql execute $db "INSERT INTO t1 (x) VALUES($x);"
................................................................................
} -constraints \
{eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

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

runSQLiteTestEpilogue
runTestEpilogue