System.Data.SQLite
Check-in [1a3f35c77a]
Not logged in

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

Overview
Comment:Update test suite infrastructure to make it possible to easily test the native library pre-loading code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1a3f35c77a1c5e08ea357af794f098dc984ab872
User & Date: mistachkin 2013-12-31 07:40:32
Context
2013-12-31
07:44
Change the default behavior for the native library pre-loader so that it first searches the executing (i.e. System.Data.SQLite) assembly directory and then the application domain directory. Pursuant to [f0246d1817]. check-in: 73b6826ea6 user: mistachkin tags: trunk
07:40
Update test suite infrastructure to make it possible to easily test the native library pre-loading code. check-in: 1a3f35c77a user: mistachkin tags: trunk
07:39
More readability fixes for the wiki pages. check-in: 13e4a1ba1f user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/common.eagle.

771
772
773
774
775
776
777


778



779
780
781
782
783
784
785
...
800
801
802
803
804
805
806


807



808
809
810
811
812
813
814
...
907
908
909
910
911
912
913
914
915

916
917
918
919
920
921
922
....
2200
2201
2202
2203
2204
2205
2206
2207





































































2208
2209
2210
2211
2212
2213
2214
2215



2216

2217
2218
2219
2220
2221
2222
2223


2224

2225
2226






2227
2228


2229
2230
2231
2232
2233
2234





2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
....
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
....
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293


2294
2295





2296
2297
2298
2299
2300



2301

2302






2303






2304

2305
2306
2307
2308
2309
2310
2311
2312
2313
2314

2315
2316
2317





2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
....
2394
2395
2396
2397
2398
2399
2400























2401
2402
2403
2404
2405
2406
2407

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBuildFileName $newFileName $platform]
      } else {
        set targetFileName [getBuildFileName $fileName $platform]
      }



      if {[catch {



              file copy -force $sourceFileName $targetFileName}] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- copied binary file from \"" $sourceFileName "\" to \"" \
            $targetFileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to copy binary file from \"" $sourceFileName \
................................................................................

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBinaryFileName $newFileName $platform]
      } else {
        set targetFileName [getBinaryFileName $fileName $platform]
      }



      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 \
................................................................................
      #       and ready for use by the test suite.  Currently, this procedure
      #       should be called only after the [tryLoadAssembly] procedure has
      #       been called to probe for the System.Data.SQLite managed assembly
      #       and the [checkForSQLite] procedure has been called to probe for
      #       the SQLite native library; otherwise, this procedure will simply
      #       always return zero.
      #
      return [expr {[haveConstraint System.Data.SQLite] && \
          [haveConstraint SQLite]}]

    }
 
    proc matchMachine { platform } {
      #
      # NOTE: An empty string for the platform means that the build is not
      #       [primarily] a native build; therefore, it always matches.
      #
................................................................................
      if {![info exists ::no(prologue.eagle)]} then {
        #
        # NOTE: Load the "before-constraints" custom per-user and/or per-host
        #       test settings now.
        #
        uplevel 1 [list loadSQLiteTestSettings $::test_channel .before]

        #





































































        # NOTE: Skip all System.Data.SQLite related file handling (deleting,
        #       copying, and loading) if we are so instructed.
        #
        if {![info exists ::no(sqliteFiles)]} then {
          #
          # NOTE: Determine the name for the current native platform.
          #
          set platform [architectureForPlatform [getBuildPlatform true]]





          #
          # NOTE: Show the platform that will be used to help locate native
          #       build files.
          #
          tputs $::test_channel [appendArgs \
              "---- platform for locating native build files is \"" \
              $platform \"\n]




          #
          # NOTE: Skip trying to delete any files if we are so instructed.






          #
          if {![info exists ::no(deleteSqliteFiles)]} then {


            tryDeleteAssembly sqlite3.dll
            tryDeleteAssembly SQLite.Interop.dll
            tryDeleteAssembly System.Data.SQLite.dll
            tryDeleteAssembly System.Data.SQLite.Linq.dll

            if {[string length $platform] > 0} then {





              tryDeleteAssembly sqlite3.dll $platform
              tryDeleteAssembly SQLite.Interop.dll $platform
              tryDeleteAssembly System.Data.SQLite.dll $platform
            }

            removeConstraint file_sqlite3.dll
            removeConstraint file_SQLite.Interop.dll
            removeConstraint file_System.Data.SQLite.dll
            removeConstraint file_System.Data.SQLite.Linq.dll
          }

          #
          # NOTE: Check for the "autoSelect" runtime option.  If present,
          #       attempt to automatically select the first available
          #       build (or "release") of SQLite and System.Data.SQLite
          #       for use with the test suite.
................................................................................
          if {[hasRuntimeOption autoSelect]} then {
            if {![checkForSQLiteBuilds $::test_channel true]} then {
              checkForSQLiteReleases $::test_channel true
            }
          }

          #
          # NOTE: Skip trying to verify the build directory if we are so
          #       instructed; otherwise, make sure it actually exists or
          #       halt the entire testing process if it does not exist.
          #
          if {![info exists ::no(verifyBuildDirectory)]} then {
            #
            # NOTE: At this point, the build directory MUST exist as a
            #       valid directory for the testing process to continue.
            #
            set directory [getBuildDirectory]
................................................................................
              error [appendArgs \
                  "could not verify build directory \"" $directory \
                  "\", all testing halted"]
            }
          }

          #
          # NOTE: Skip trying to copy any files if we are so instructed.
          #
          if {![info exists ::no(copySqliteFiles)]} then {


            tryCopyBuildFile System.Data.SQLite.dll.config






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




            if {[string length $platform] > 0} then {

              tryCopyAssembly sqlite3.dll $platform






              tryCopyAssembly SQLite.Interop.dll $platform






              tryCopyAssembly System.Data.SQLite.dll $platform

            }
          }

          #
          # NOTE: Skip trying to load any files if we are so instructed.
          #
          if {![info exists ::no(loadSqliteFiles)]} then {
            tryLoadAssembly System.Data.SQLite.dll
            tryLoadAssembly System.Data.SQLite.Linq.dll


            if {[string length $platform] > 0} then {
              tryLoadAssembly System.Data.SQLite.dll $platform
            }





          }

          #
          # NOTE: Build a list of auxiliary Managed Debugging Assistants (MDA)
          #       configuration files that may need to be deleted or copied.
          #
          set mdaConfigFileNames [list \
              Installer.exe.mda.config test.exe.mda.config \
              testlinq.exe.mda.config]

          #
          # NOTE: Skip trying to delete external files if we are so instructed.
          #
          if {![info exists ::no(deleteSqliteExternalFiles)]} then {
            foreach mdaConfigFileName $mdaConfigFileNames {
              tryDeleteBuildFile $mdaConfigFileName
            }
          }

          #
          # NOTE: Skip trying to copy external files if we are so instructed.
          #
          if {![info exists ::no(copySqliteExternalFiles)]} then {
            #
            # NOTE: Copy the Managed Debugging Assistants (MDA) configuration
            #       file for the Eagle shell to the build output directory,
            #       while using each of the names of the various legacy test
            #       executables.  This will help to make sure that all the
            #       legacy tests run with exactly the same set of Managed
            #       Debugging Assistants configured.
            #
            foreach mdaConfigFileName $mdaConfigFileNames {
              tryCopyBinaryFile EagleShell.exe.mda.config "" $mdaConfigFileName
            }
          }
        }

        catch {
          tputs $::test_channel [appendArgs \
              "---- file version of \"sqlite3.dll\"... " \
................................................................................
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" $platform \
                "/System.Data.SQLite.dll\"... " [file version \
                [getBinaryFileName System.Data.SQLite.dll $platform]] \n]
          }
        }
























        set assemblies [object invoke AppDomain.CurrentDomain GetAssemblies]

        object foreach assembly $assemblies {
          if {[string match \{System.Data.SQLite* $assembly]} then {
            tputs $::test_channel [appendArgs \
                "---- found assembly: " $assembly \n]







>
>

>
>
>







 







>
>

>
>
>







 







|
|
>







 








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

|



|

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







 







|
|
|







 







|


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




|





>
|


>
>
>
>
>



<
<
<
<
<
<
<
<
|


|
|




|










|
|







 







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







771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
...
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
...
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
....
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301




2302
2303
2304
2305
2306
2307
2308

2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319



2320

2321
2322
2323
2324
2325
2326


2327
2328




2329
2330
2331
2332
2333
2334
2335
....
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
....
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388



2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432








2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
....
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBuildFileName $newFileName $platform]
      } else {
        set targetFileName [getBuildFileName $fileName $platform]
      }

      set targetDirectory [file dirname $targetFileName]

      if {[catch {
              if {![file exists $targetDirectory]} then {
                file mkdir $targetDirectory
              }
              file copy -force $sourceFileName $targetFileName}] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- copied binary file from \"" $sourceFileName "\" to \"" \
            $targetFileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to copy binary file from \"" $sourceFileName \
................................................................................

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBinaryFileName $newFileName $platform]
      } else {
        set targetFileName [getBinaryFileName $fileName $platform]
      }

      set targetDirectory [file dirname $targetFileName]

      if {[catch {
              if {![file exists $targetDirectory]} then {
                file mkdir $targetDirectory
              }
              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 \
................................................................................
      #       and ready for use by the test suite.  Currently, this procedure
      #       should be called only after the [tryLoadAssembly] procedure has
      #       been called to probe for the System.Data.SQLite managed assembly
      #       and the [checkForSQLite] procedure has been called to probe for
      #       the SQLite native library; otherwise, this procedure will simply
      #       always return zero.
      #
      return [expr {
          [haveConstraint System.Data.SQLite] && [haveConstraint SQLite]
      }]
    }
 
    proc matchMachine { platform } {
      #
      # NOTE: An empty string for the platform means that the build is not
      #       [primarily] a native build; therefore, it always matches.
      #
................................................................................
      if {![info exists ::no(prologue.eagle)]} then {
        #
        # NOTE: Load the "before-constraints" custom per-user and/or per-host
        #       test settings now.
        #
        uplevel 1 [list loadSQLiteTestSettings $::test_channel .before]

        #
        # NOTE: Determine the names of the native platform and architecture.
        #
        set platform [getBuildPlatform true]
        set architecture [architectureForPlatform $platform]

        #
        # NOTE: Show the platform and architecture used to help locate the
        #       native build files.
        #
        tputs $::test_channel [appendArgs \
            "---- platform for locating native build files is \"" \
            $platform \"\n]

        tputs $::test_channel [appendArgs \
            "---- architecture for locating native build files is \"" \
            $architecture \"\n]

        #
        # NOTE: Build a list of configuration files that we handle.
        #
        set configFileNames [list \
            System.Data.SQLite.dll.config]

        #
        # NOTE: Build a list of auxiliary Managed Debugging Assistants (MDA)
        #       configuration files that we handle.
        #
        set mdaConfigFileNames [list \
            Installer.exe.mda.config test.exe.mda.config \
            testlinq.exe.mda.config]

        #
        # NOTE: Build the list of native assembly files that we handle.  The
        #       reason the "System.Data.SQLite.dll" file is included here is
        #       because it could be the mixed-mode assembly.
        #
        set nativeFileNames [list \
            sqlite3.dll SQLite.Interop.dll System.Data.SQLite.dll]

        #
        # NOTE: Build the list of managed assembly files that we handle.
        #
        set managedFileNames [list \
            System.Data.SQLite.dll System.Data.SQLite.Linq.dll]

        #
        # NOTE: Remove any test constraints that refer to the native and/or
        #       managed assembly files that we handle unless forbidden from
        #       doing so.
        #
        if {![info exists ::no(sqliteRemoveConstraints)]} then {
          foreach fileName $configFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $mdaConfigFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $nativeFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $managedFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }
        }

        #
        # NOTE: Skip all System.Data.SQLite related file handling (deleting,
        #       copying, and loading) if instructed.
        #
        if {![info exists ::no(sqliteFiles)]} then {
          #
          # NOTE: Skip trying to delete any files if instructed.
          #
          if {![info exists ::no(deleteSqliteFiles)]} then {
            if {![info exists ::no(deleteSqliteConfigFiles)]} then {
              foreach fileName $configFileNames {
                tryDeleteBinaryFile $fileName
              }
            }





            if {![info exists ::no(deleteSqliteNativeFiles)]} then {
              if {![info exists ::no(deleteSqliteImplicitFiles)]} then {
                foreach fileName $nativeFileNames {
                  tryDeleteAssembly $fileName
                }
              }


              if {![info exists ::no(deleteSqlitePlatformFiles)] && \
                  [string length $platform] > 0} then {
                foreach fileName $nativeFileNames {
                  tryDeleteAssembly $fileName $platform
                }
              }

              if {![info exists ::no(deleteSqliteArchitectureFiles)] && \
                  [string length $architecture] > 0} then {
                foreach fileName $nativeFileNames {
                  tryDeleteAssembly $fileName $architecture



                }

              }
            }

            if {![info exists ::no(deleteSqliteManagedFiles)]} then {
              foreach fileName $managedFileNames {
                tryDeleteAssembly $fileName


              }
            }




          }

          #
          # NOTE: Check for the "autoSelect" runtime option.  If present,
          #       attempt to automatically select the first available
          #       build (or "release") of SQLite and System.Data.SQLite
          #       for use with the test suite.
................................................................................
          if {[hasRuntimeOption autoSelect]} then {
            if {![checkForSQLiteBuilds $::test_channel true]} then {
              checkForSQLiteReleases $::test_channel true
            }
          }

          #
          # NOTE: Skip trying to verify the build directory if instructed;
          #       otherwise, make sure it actually exists or halt the entire
          #       testing process if it does not exist.
          #
          if {![info exists ::no(verifyBuildDirectory)]} then {
            #
            # NOTE: At this point, the build directory MUST exist as a
            #       valid directory for the testing process to continue.
            #
            set directory [getBuildDirectory]
................................................................................
              error [appendArgs \
                  "could not verify build directory \"" $directory \
                  "\", all testing halted"]
            }
          }

          #
          # NOTE: Skip trying to copy any files if instructed.
          #
          if {![info exists ::no(copySqliteFiles)]} then {
            if {![info exists ::no(copySqliteConfigFiles)]} then {
              foreach fileName $configFileNames {
                tryCopyBuildFile $fileName
              }
            }

            if {![info exists ::no(copySqliteNativeFiles)]} then {
              if {![info exists ::no(copySqliteImplicitFiles)]} then {
                foreach fileName $nativeFileNames {
                  tryCopyAssembly $fileName



                }
              }

              if {![info exists ::no(copySqlitePlatformFiles)] && \
                  [string length $platform] > 0} then {
                foreach fileName $nativeFileNames {
                  tryCopyAssembly $fileName $platform
                }
              }

              if {![info exists ::no(copySqliteArchitectureFiles)] && \
                  [string length $architecture] > 0} then {
                foreach fileName $nativeFileNames {
                  tryCopyAssembly $fileName $architecture
                }
              }
            }

            if {![info exists ::no(copySqliteManagedFiles)]} then {
              foreach fileName $managedFileNames {
                tryCopyAssembly $fileName
              }
            }
          }

          #
          # NOTE: Skip trying to load any files if instructed.
          #
          if {![info exists ::no(loadSqliteFiles)]} then {
            tryLoadAssembly System.Data.SQLite.dll
            tryLoadAssembly System.Data.SQLite.Linq.dll

            if {![info exists ::no(loadSqlitePlatformFiles)] && \
                [string length $platform] > 0} then {
              tryLoadAssembly System.Data.SQLite.dll $platform
            }

            if {![info exists ::no(loadSqliteArchitectureFiles)] && \
                [string length $architecture] > 0} then {
              tryLoadAssembly System.Data.SQLite.dll $architecture
            }
          }

          #








          # NOTE: Skip trying to delete external files if instructed.
          #
          if {![info exists ::no(deleteSqliteExternalFiles)]} then {
            foreach fileName $mdaConfigFileNames {
              tryDeleteBuildFile $fileName
            }
          }

          #
          # NOTE: Skip trying to copy external files if instructed.
          #
          if {![info exists ::no(copySqliteExternalFiles)]} then {
            #
            # NOTE: Copy the Managed Debugging Assistants (MDA) configuration
            #       file for the Eagle shell to the build output directory,
            #       while using each of the names of the various legacy test
            #       executables.  This will help to make sure that all the
            #       legacy tests run with exactly the same set of Managed
            #       Debugging Assistants configured.
            #
            foreach fileName $mdaConfigFileNames {
              tryCopyBinaryFile EagleShell.exe.mda.config "" $fileName
            }
          }
        }

        catch {
          tputs $::test_channel [appendArgs \
              "---- file version of \"sqlite3.dll\"... " \
................................................................................
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" $platform \
                "/System.Data.SQLite.dll\"... " [file version \
                [getBinaryFileName System.Data.SQLite.dll $platform]] \n]
          }
        }

        if {[string length $architecture] > 0} then {
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" $architecture \
                "/sqlite3.dll\"... " [file version \
                [getBinaryFileName sqlite3.dll $architecture]] \n]
          }

          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" $architecture \
                "/SQLite.Interop.dll\"... " [file version \
                [getBinaryFileName SQLite.Interop.dll $architecture]] \n]
          }

          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" $architecture \
                "/System.Data.SQLite.dll\"... " [file version \
                [getBinaryFileName System.Data.SQLite.dll $architecture]] \n]
          }
        }

        set assemblies [object invoke AppDomain.CurrentDomain GetAssemblies]

        object foreach assembly $assemblies {
          if {[string match \{System.Data.SQLite* $assembly]} then {
            tputs $::test_channel [appendArgs \
                "---- found assembly: " $assembly \n]