Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhancements to unit test infrastructure to enable profiling. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0c6f84763cbd589e7f104af8b688ae3f |
User & Date: | mistachkin 2011-07-08 10:24:28.058 |
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
Changes to Tests/all.eagle.
︙ | ︙ | |||
23 24 25 26 27 28 29 | # # 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] | | < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # # 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 # |
︙ | ︙ | |||
65 66 67 68 69 70 71 72 | unset no(epilogue.eagle) unset no(prologue.eagle) if {[array size no] == 0} then {unset no} ############################################################################### runTestEpilogue | > | 64 65 66 67 68 69 70 71 72 | 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 | package require EagleTest runTestPrologue ############################################################################### source [file join $path common.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 | 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 } |
︙ | ︙ | |||
60 61 62 63 64 65 66 | 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 | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 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. |
︙ | ︙ | |||
89 90 91 92 93 94 95 | 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 | | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 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] |
︙ | ︙ | |||
126 127 128 129 130 131 132 133 | ############################################################################### unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile ############################################################################### runTestEpilogue | > | 125 126 127 128 129 130 131 132 133 | ############################################################################### unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/common.eagle.
1 2 3 4 5 6 7 8 9 10 | ############################################################################### # # common.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### if {[isEagle]} then { | | | | > > > | > > > > > > > > > > > | > > | > > > > | > > | > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 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 | ############################################################################### # # common.eagle -- # # 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 \ |
︙ | ︙ | |||
103 104 105 106 107 108 109 | } proc cleanupDb {fileName {varName db}} { upvar 1 $varName db catch {sql close $db} catch {file delete [file join [getTemporaryPath] $fileName]} } | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } 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 | package require EagleTest runTestPrologue ############################################################################### source [file join $path common.eagle] | | | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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 { |
︙ | ︙ | |||
95 96 97 98 99 100 101 102 | } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \ -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\ SQLiteConnection#\d+ \{\} \{\} Zm9v$}} ############################################################################### runTestEpilogue | > | 95 96 97 98 99 100 101 102 103 | } -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 | package require EagleTest runTestPrologue ############################################################################### source [file join $path common.eagle] | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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] ############################################################################### |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 | ############################################################################### unset -nocomplain y ############################################################################### runTestEpilogue | > | 90 91 92 93 94 95 96 97 98 | ############################################################################### unset -nocomplain y ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/tkt-448d663d11.eagle.
︙ | ︙ | |||
12 13 14 15 16 17 18 | package require EagleTest runTestPrologue ############################################################################### source [file join $path common.eagle] | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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 { |
︙ | ︙ | |||
255 256 257 258 259 260 261 262 | cleanupDb $fileName unset -nocomplain db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -result {wal}} ############################################################################### runTestEpilogue | > | 255 256 257 258 259 260 261 262 263 | 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 | package require EagleTest runTestPrologue ############################################################################### source [file join $path common.eagle] | | | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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);" |
︙ | ︙ | |||
123 124 125 126 127 128 129 130 | } -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 | > | 123 124 125 126 127 128 129 130 131 | } -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 |