Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add and enhance tests for ticket [0e48e80333]. Updates to test suite infrastructure. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tkt-0e48e80333 |
Files: | files | file ages | folders |
SHA1: |
dbf44d7cf241a26b5c2821e737c0949a |
User & Date: | mistachkin 2017-11-14 16:17:07 |
Context
2017-11-14
| ||
16:19 | Attempt to invalidate all native delegates from a connection during its disposal. Pursuant to [0e48e80333]. check-in: a6f55afb81 user: mistachkin tags: trunk | |
16:17 | Add and enhance tests for ticket [0e48e80333]. Updates to test suite infrastructure. Closed-Leaf check-in: dbf44d7cf2 user: mistachkin tags: tkt-0e48e80333 | |
08:47 | Initial work on tests for ticket [0e48e80333]. check-in: c2d56cbccf user: mistachkin tags: tkt-0e48e80333 | |
Changes
Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # # NOTE: Use our own namespace here because even though we do not directly # support namespaces ourselves, we do not want to pollute the global # namespace if this script actually ends up being evaluated in Tcl. # 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 } | > > > > > > > > > > > > > > > > > | 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 | # # NOTE: Use our own namespace here because even though we do not directly # support namespaces ourselves, we do not want to pollute the global # namespace if this script actually ends up being evaluated in Tcl. # namespace eval ::Eagle { if {[isEagle]} then { proc checkForVendorQuiet { {name ""} } { if {[info exists ::env(checkForVendorQuiet)]} then { return true } if {[string length $name] > 0} then { set envVarName [appendArgs quiet [string toupper \ [string index $name 0]] [string range $name 1 end]] if {[info exists ::env($envVarName)]} then { return true } } return false } proc checkForTestOverrides { channel varNames quiet } { set result 0 foreach varName $varNames { if {![uplevel 1 [list info exists $varName]]} then { continue } |
︙ | ︙ | |||
341 342 343 344 345 346 347 | interop_assembly_file_names native_library_file_names release_version \ scratch_directory temporary_directory test_clr test_clr_v2 \ test_clr_v4 test_configuration test_configurations test_constraints \ test_machine test_net_fx test_net_fx_2005 test_net_fx_2008 \ test_net_fx_2010 test_net_fx_2012 test_net_fx_2013 test_net_fx_2015 \ test_overrides test_platform test_suite test_year test_years \ test_year_clr_v2 test_year_clr_v4 vendor_directory \ | | | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | interop_assembly_file_names native_library_file_names release_version \ scratch_directory temporary_directory test_clr test_clr_v2 \ test_clr_v4 test_configuration test_configurations test_constraints \ test_machine test_net_fx test_net_fx_2005 test_net_fx_2008 \ test_net_fx_2010 test_net_fx_2012 test_net_fx_2013 test_net_fx_2015 \ test_overrides test_platform test_suite test_year test_years \ test_year_clr_v2 test_year_clr_v4 vendor_directory \ vendor_test_directory]}] [checkForVendorQuiet checkForTestOverrides] # # NOTE: Set the name of the running test suite, if necessary. # if {![info exists test_suite]} then { set test_suite "System.Data.SQLite Test Suite for Eagle" } |
︙ | ︙ | |||
389 390 391 392 393 394 395 | # current interpreter. Normally, this will also set the variable # created above to point to the directory added to the auto-path; # however, this will not be done if the variable was not created # by us. # addTestSuiteToAutoPath stdout \ [expr {$have_vendor_directory ? "" : "vendor_directory"}] \ | | | | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | # current interpreter. Normally, this will also set the variable # created above to point to the directory added to the auto-path; # however, this will not be done if the variable was not created # by us. # addTestSuiteToAutoPath stdout \ [expr {$have_vendor_directory ? "" : "vendor_directory"}] \ [checkForVendorQuiet addTestSuiteToAutoPath] unset have_vendor_directory # # NOTE: This procedure will attempt to find the vendor-specific testing # directory. Normally, this will also set the variable created # above to point to the directory; however, this will not be done # if the variable was not created by us. # findInterpreterTestPath stdout $vendor_directory \ [expr {$have_vendor_test_directory ? "" : "vendor_test_directory"}] \ [checkForVendorQuiet findInterpreterTestPath] unset have_vendor_test_directory # # NOTE: If we actually found a vendor-specific testing infrastructure # directory then modify the TestPath property of the current # interpreter to point directly to it. # if {[string length $vendor_test_directory] > 0} then { setupInterpreterTestPath stdout $vendor_test_directory \ [checkForVendorQuiet setupInterpreterTestPath] } } # # HACK: Prevent the Eagle core test suite infrastructure from checking # test constraints that are time-consuming and/or most likely to # be superfluous to third-party test suites (i.e. those that are |
︙ | ︙ |
Changes to Tests/tkt-0e48e80333.eagle.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ############################################################################### runTest {test tkt-0e48e80333-1.1 {unhook delegates on pooled close} -setup { moveEagleShellMdaConfig false saveMdaConfigEnvironment } -body { | | < < < | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ############################################################################### runTest {test tkt-0e48e80333-1.1 {unhook delegates on pooled close} -setup { moveEagleShellMdaConfig false saveMdaConfigEnvironment } -body { set configFileName [writeEagleShellMdaConfig [string trim { <?xml version="1.0" encoding="UTF-8" ?> <mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda"> <assistants> <callbackOnCollectedDelegate listSize="50" /> </assistants> </mdaConfig> }]] set scriptFileName [file tempname] writeFile $scriptFileName [string trim { package require Eagle package require Eagle.Library package require Eagle.Test |
︙ | ︙ | |||
86 87 88 89 90 91 92 | set env(COMPLUS_MDA) 1; # enable MDA config file. set code [catch { execTestShell [list \ -eventflags Wait -success Success -stdout output] \ -preInitialize [appendArgs \" "set no(logFileName) 1" \"] \ | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | set env(COMPLUS_MDA) 1; # enable MDA config file. set code [catch { execTestShell [list \ -eventflags Wait -success Success -stdout output] \ -preInitialize [appendArgs \" "set no(logFileName) 1" \"] \ -file [appendArgs \" $scriptFileName \"] \ -logFile [appendArgs \" [getTestLog] \"] } error] tlog "---- BEGIN STDOUT OUTPUT\n" tlog $output tlog "\n---- END STDOUT OUTPUT\n" set code } -cleanup { catch {file delete $scriptFileName} catch {file delete $configFileName} unset -nocomplain code output error scriptFileName configFileName restoreMdaConfigEnvironment moveEagleShellMdaConfig true } -constraints {eagle dotNet testExec command.object monoBug28 command.sql\ compile.DATA SQLite System.Data.SQLite} -result {0}} ############################################################################### runTest {test tkt-0e48e80333-1.2 {delegate MDA on pooled close} -setup { moveEagleShellMdaConfig false saveEnvironmentVariables [list checkForVendorQuiet] saveMdaConfigEnvironment setupDb [set fileName tkt-0e48e80333-1.2.db] } -body { set configFileName [writeEagleShellMdaConfig [string trim { <?xml version="1.0" encoding="UTF-8" ?> <mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda"> <assistants> <callbackOnCollectedDelegate listSize="50" /> </assistants> </mdaConfig> }]] set scriptFileName [file tempname] writeFile $scriptFileName [string trim { package require Eagle package require Eagle.Library package require Eagle.Test package require System.Data.SQLite.Test set ::test_channel ""; # disable [tputs] set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getDatabaseDirectory] $fileName] set count(1) 1000; # thread work-item count set count(2) 1000; # per-thread query count set count(3) [expr {$count(1) * $count(2)}]; # total query count set count(4) [expr {0.5 * $count(3)}]; # timeout in seconds set count(5) 10; # busy loop sleep milliseconds set sql { \ SELECT 1; \ } unset -nocomplain results errors set code [compileCSharpWith [subst { using System; using System.Data; using System.Data.SQLite; using System.Threading; namespace _Dynamic${id} { public static class Test${id} { #region Private Static Data private static long count; ///////////////////////////////////////////////////////////////////// private static SQLiteTraceEventHandler handler; #endregion ///////////////////////////////////////////////////////////////////// #region Public Static Methods public static void TraceEventHandler( object sender, TraceEventArgs e ) { /* IGNORED */ Interlocked.Increment(ref count); } ///////////////////////////////////////////////////////////////////// public static SQLiteConnection MakeConnection() { SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};Journal Mode=Wal;Pooling=true;" + "[getFlagsProperty AllowNestedTransactions]"); connection.Open(); connection.Trace += handler; return connection; } ///////////////////////////////////////////////////////////////////// public static long ThreadedPoolTraceTest() { for (int index1 = 0; index1 < ${count(1)}; index1++) { ThreadPool.QueueUserWorkItem(delegate(object state) { using (SQLiteConnection connection = MakeConnection()) { for (int index2 = 0; index2 < ${count(2)}; index2++) { using (SQLiteTransaction transaction = connection.BeginTransaction()) { using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "[subst ${sql}]"; command.ExecuteNonQuery(); } } } } }); GC.Collect(); } DateTime start = DateTime.UtcNow; while (true) { if (Interlocked.CompareExchange(ref count, 0, 0) >= ${count(3)}) break; if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(4)}) break; Thread.Sleep(${count(5)}); } return Interlocked.CompareExchange(ref count, 0, 0); } ///////////////////////////////////////////////////////////////////// public static void Main() { handler = new SQLiteTraceEventHandler(TraceEventHandler); } #endregion } } }] true true true results errors System.Data.SQLite.dll] puts stdout [list $code $results \ [expr {[info exists errors] ? $errors : ""}] \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result \ [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} ThreadedPoolTraceTest } result] : [set result ""]}] $result] }] set env(checkForVendorQuiet) 1 set env(COMPLUS_MDA) 1; # enable MDA config file. set code [catch { execTestShell [list \ -eventflags Wait -success Success -stdout output] \ -preInitialize [appendArgs \" "set fileName {" $fileName }\"] \ -preInitialize [appendArgs \" "set no(logFileName) 1" \"] \ -file [appendArgs \" $scriptFileName \"] \ -logFile [appendArgs \" [getTestLog] \"] } error] tlog "---- BEGIN STDOUT OUTPUT\n" tlog $output tlog "\n---- END STDOUT OUTPUT\n" list $code [string trim $error] } -cleanup { cleanupDb $fileName catch {file delete $scriptFileName} catch {file delete $configFileName} unset -nocomplain code output error scriptFileName configFileName unset -nocomplain db fileName restoreMdaConfigEnvironment restoreEnvironmentVariables [list checkForVendorQuiet] moveEagleShellMdaConfig true } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^0 \{Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 0 1000\}$}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/tkt-d4728aecb7.eagle.
︙ | ︙ | |||
78 79 80 81 82 83 84 | [getAppDomainPreamble] -body { package require Eagle.Library package require Eagle.Test package require System.Data.SQLite.Test moveSystemDataSQLiteDllConfig false | | < < < | | 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 | [getAppDomainPreamble] -body { package require Eagle.Library package require Eagle.Test package require System.Data.SQLite.Test moveSystemDataSQLiteDllConfig false set fileName [writeSystemDataSQLiteDllConfig [string trim { <?xml version="1.0"?> <configuration> <appSettings> <add key="d472_1" value="prfx1/%PreLoadSQLite_AssemblyDirectory%/sufx1" /> <add key="d472_2" value="prfx2/%PreLoadSQLite_TargetFramework%/sufx2" /> <add key="d472_3" value="prfx3/%PreLoadSQLite_XmlConfigDirectory%/sufx3" /> </appSettings> </configuration> }]] object load -loadtype Bytes [base64 encode [readFile [file join \ [getBinaryDirectory] System.Data.SQLite.dll]]] set result [list] lappend result [string map [list \\ /] [object invoke -flags +NonPublic \ |
︙ | ︙ |
Changes to lib/System.Data.SQLite/common.eagle.
︙ | ︙ | |||
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | tputs $::test_channel [appendArgs \ "---- skipped moving \"" $fileName(1) \ "\", it does not exist\n"] } } } } proc moveEagleShellMdaConfig { {restore false} {verbose true} } { set directory [getBinaryDirectory] if {[string length $directory] == 0} then { if {$verbose} then { tputs $::test_channel [appendArgs \ | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | tputs $::test_channel [appendArgs \ "---- skipped moving \"" $fileName(1) \ "\", it does not exist\n"] } } } } proc writeSystemDataSQLiteDllConfig { data {verbose true} } { set directory [getBinaryDirectory] if {[string length $directory] == 0} then { if {$verbose} then { tputs $::test_channel [appendArgs \ "---- skipped moving \"System.Data.SQLite.dll.config\", " \ "no binary directory\n"] } return } set fileName [file normalize \ [file join $directory System.Data.SQLite.dll.config]] writeFile $fileName $data if {$verbose} then { tputs $::test_channel \ "---- wrote \"System.Data.SQLite.dll.config\"\n" } return $fileName } proc moveEagleShellMdaConfig { {restore false} {verbose true} } { set directory [getBinaryDirectory] if {[string length $directory] == 0} then { if {$verbose} then { tputs $::test_channel [appendArgs \ |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | tputs $::test_channel [appendArgs \ "---- skipped moving \"" $fileName(1) \ "\", it does not exist\n"] } } } } proc getAppDomainPreamble { {prefix ""} {suffix ""} } { # # NOTE: This procedure returns a test setup script fragment suitable for # evaluation by an interpreter created in an isolated application # domain. The script fragment being returned will be surrounded by # the prefix and suffix "script fragments" specified by our caller, | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | tputs $::test_channel [appendArgs \ "---- skipped moving \"" $fileName(1) \ "\", it does not exist\n"] } } } } proc writeEagleShellMdaConfig { data {verbose true} } { set directory [getBinaryDirectory] if {[string length $directory] == 0} then { if {$verbose} then { tputs $::test_channel [appendArgs \ "---- skipped moving \"EagleShell.exe.mda.config\", " \ "no binary directory\n"] } return } set fileName [file normalize \ [file join $directory EagleShell.exe.mda.config]] writeFile $fileName $data if {$verbose} then { tputs $::test_channel \ "---- wrote \"EagleShell.exe.mda.config\"\n" } return $fileName } proc getAppDomainPreamble { {prefix ""} {suffix ""} } { # # NOTE: This procedure returns a test setup script fragment suitable for # evaluation by an interpreter created in an isolated application # domain. The script fragment being returned will be surrounded by # the prefix and suffix "script fragments" specified by our caller, |
︙ | ︙ |