System.Data.SQLite
Check-in [7d7bb0e1a3]
Not logged in

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

Overview
Comment:Enhance test suite infrastructure, mostly to support build auto-selection for the .NET Standard 2.0 build.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7d7bb0e1a3d785be38332b2b8cb9fb6ae8b54952
User & Date: mistachkin 2018-08-14 03:22:05
Context
2018-08-14
03:43
Refactoring of some diagnostic messages emitted by the test suite infrastructure. check-in: aa845495da user: mistachkin tags: trunk
03:22
Enhance test suite infrastructure, mostly to support build auto-selection for the .NET Standard 2.0 build. check-in: 7d7bb0e1a3 user: mistachkin tags: trunk
2018-08-13
22:52
In the test suite infrastructure, treat the config files as 'managed only'. check-in: 8f9c8fae4c user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.

355
356
357
358
359
360
361

362
363
364
365
366
367
368
369
370
371
372
373
374
375
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory compile_option_prefix \
        connection_flags core_library_version database_directory \
        datetime_format define_constant_prefix execute_on_setup \
        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_configuration_suffix test_constraints test_extra test_extras \
        test_machine test_native_configuration_suffix test_native_year \
        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_net_fx_2017 \
        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"
    }







>
|
|
|
|
|
|
|







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory compile_option_prefix \
        connection_flags core_library_version database_directory \
        datetime_format define_constant_prefix execute_on_setup \
        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_configuration_suffix test_configuration_suffixes \
        test_constraints test_extra test_extras test_machine test_native \
        test_native_configuration_suffix test_native_year 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_net_fx_2017 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"
    }

Changes to lib/System.Data.SQLite/common.eagle.

61
62
63
64
65
66
67















68
69
70
71
72
73
74
...
161
162
163
164
165
166
167

































168
169
170
171
172
173
174
...
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
...
322
323
324
325
326
327
328
329
330


331
332
333
334
335
336
337

338
339
340
341
342
343
344
345
346


347
348
349
350
351
352
353
...
390
391
392
393
394
395
396



















397
398
399
400
401
402
403
...
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
...
449
450
451
452
453
454
455



































456
457
458
459
460
461
462
...
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755








756
757
758
759
760
761
762
...
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
...
937
938
939
940
941
942
943
944


945
946
947
948
949
950
951
....
1850
1851
1852
1853
1854
1855
1856

1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874

1875
1876
1877
1878
1879





1880

1881
1882

1883


1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894

1895
1896
1897
1898
1899
1900
1901
1902
1903

1904




1905
1906

1907






1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920

1921
1922
1923
1924
1925
1926
1927
....
4545
4546
4547
4548
4549
4550
4551

4552
4553
4554
4555
4556

4557
4558
4559
4560
4561
4562
4563
....
4611
4612
4613
4614
4615
4616
4617
4618

4619
4620
4621
4622

4623
4624
4625


4626
4627
4628


4629
4630
4631


4632
4633
4634


4635
4636
4637
4638
4639
4640
4641
....
4659
4660
4661
4662
4663
4664
4665












4666
4667
4668
4669
4670
4671
4672
....
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
....
4901
4902
4903
4904
4905
4906
4907










4908
4909
4910
4911
4912
4913
4914
....
4942
4943
4944
4945
4946
4947
4948










4949
4950
4951
4952
4953
4954
4955
....
5242
5243
5244
5245
5246
5247
5248
















5249
5250
5251
5252
5253
5254
5255
5256
5257


5258
5259




5260
5261
5262
5263
5264


5265
5266




5267
5268
5269
5270
5271
5272
5273
5274
5275
5276


5277
5278




5279
5280
5281
5282
5283
5284
5285
5286
5287


5288
5289



5290





5291
5292























5293
5294
5295
5296
5297



5298
5299
5300
5301
5302
5303
5304
          [appendArgs [getSQLiteDefineConstantPrefix] $name]]
    }
 
    proc haveSQLiteCompileOption { name } {
      return [haveConstraint \
          [appendArgs [getSQLiteCompileOptionPrefix] $name]]
    }















 
    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, 2010, 2012, 2013, 2015, or 2017 build systems.  To
................................................................................
        #
        # NOTE: Fallback on the (normal) build year for managed binaries.
        #
        return [getBuildYear]
      }
    }
 

































    #
    # NOTE: This procedure is only used when adding shimmed test constraints.
    #
    proc getBuildClrVersion {} {
      if {[info exists ::test_clr] && [string length $::test_clr] > 0} then {
        #
        # NOTE: Use the specified test version for the CLR.  If this variable
................................................................................
            #
            return 2.0.50727; # TODO: Good "fallback" default?
          }
        }
      }
    }
 
    proc getBuildYears {} {
      #
      # NOTE: See if the list of test years has been overridden by the user
      #       (e.g. on the command line).
      #
      if {[info exists ::test_years] && [llength $::test_years] > 0} then {
        #
        # NOTE: Use the specified list of test years.
        #
        return $::test_years
      } else {
        #
        # NOTE: Use the default list of test years (i.e. all).
        #
        return [list 2005 2008 2010 2012 2013 2015 2017 NetStandard20]
      }
    }
 
    proc getBuildNetFx {} {
      #
      # NOTE: See if the test .NET Framework setting has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_net_fx] && \
          [string length $::test_net_fx] > 0} then {
................................................................................
      return true
    }
 
    proc getBuildPlatform { native } {
      if {[info exists ::test_platform] && \
          [string length $::test_platform] > 0} then {
        #
        # NOTE: Use the specified test platform.  If this variable is not set,
        #       the default value will be based on the machine architecture.


        #
        return [expr {$native ? $::test_platform : ""}]
      } elseif {[info exists ::test_machine] && \
          [string length $::test_machine] > 0} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the test machine architecture; otherwise, return an empty

        #       string.
        #
        return [expr {
          $native ? [machineToPlatform $::test_machine] : ""
        }]
      } elseif {[info exists ::tcl_platform(machine)]} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the machine architecture; otherwise, return an empty string.


        #
        return [expr {
          $native ? [machineToPlatform $::tcl_platform(machine)] : ""
        }]
      } else {
        #
        # NOTE: No machine architecture is available, return an empty string.
................................................................................
        #       test configuration variable is always set by the test suite
        #       itself; however, it can be overridden using the unset command
        #       from the -preTest option to the test suite.
        #
        return $::eagle_platform(configuration)
      }
    }



















 
    proc getBuildConfigurationSuffix {} {
      #
      # NOTE: See if the test configuration suffix has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configuration_suffix] && \
................................................................................
        # NOTE: Use the default test configuration suffix, which should be
        #       an empty string.
        #
        return ""
      }
    }
 
    proc getBuildConfigurations {} {
      #
      # NOTE: See if the list of test configurations has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configurations] && \
          [llength $::test_configurations] > 0} then {
        #
        # NOTE: Use the specified list of test configurations.
        #
        return $::test_configurations
      } else {
        #
        # NOTE: Use the default list of test configurations.
        #
        return [list Debug Release]
      }
    }
 
    proc getBuildNativeConfigurationSuffix {} {
      #
      # NOTE: See if the test native configuration suffix has been
      #       overridden by the user (e.g. on the command line).
      #
      if {[info exists ::test_native_configuration_suffix] && \
          [string length $::test_native_configuration_suffix] > 0} then {
................................................................................
        #
        # NOTE: Use the default test native configuration suffix, which
        #       should be an empty string.
        #
        return ""
      }
    }



































 
    proc getBuildExtra {} {
      if {[info exists ::test_extra] && \
          [string length $::test_extra] > 0} then {
        #
        # NOTE: Use the specified extra output directory.
        #
................................................................................
      if {[file exists $fileName]} then {
        return $fileName
      }

      return $default
    }
 
    proc isBuildAvailable { native directory {varName ""} } {
      #
      # NOTE: Build the fully qualified file name for the primary assembly
      #       containing the System.Data.SQLite managed components.  It
      #       should be noted that this assembly file may also contain the
      #       native components, if a native build is in use.
      #
      set fileName [file nativename [file join $directory \
          System.Data.SQLite.dll]]

      if {![file exists $fileName]} then {
        return false
      }









      #
      # NOTE: Attempt to automatically detect if the primary assembly
      #       contains any native components, if necessary.
      #
      if {[string length $native] == 0} then {
        if {[string length $varName] > 0} then {
................................................................................
    }
 
    proc isReleaseAvailable { directory {varName ""} } {
      if {[string length $varName] > 0} then {
        upvar 1 $varName $varName
      }

      return [isBuildAvailable "" $directory $varName]
    }
 
    proc joinBuildDirectory { native path year platform configuration extra } {
      #
      # NOTE: Figure out and then return the fully qualified path to the build
      #       directory based on all the arguments provided by our caller.
      #
................................................................................
        #
        #       Note that all of the build commands above will default to using
        #       the latest version of MSBuild available and the "test_year" may
        #       need to be adjusted accordingly to actually run the test suite.
        #       Refer to the comments in [getBuildYear] for more information on
        #       how to set this variable.
        #
        set native [expr {!$managedOnly && [hasRuntimeOption native]}]



        return [joinBuildDirectory $native [getBuildBaseDirectory] \
            [expr {$managedOnly ? [getBuildYear] : [getBuildNativeYear]}] \
            [getBuildPlatform $native] [appendArgs [getBuildConfiguration] \
            [expr {$managedOnly ? [getBuildConfigurationSuffix] : \
            [getBuildNativeConfigurationSuffix]}]] [expr {$managedOnly ? \
            [getBuildExtra] : ""}]]
................................................................................
      # NOTE: Check for every possible valid combination of values used when
      #       locating out the build output directory, showing each available
      #       build variation along the way.
      #
      foreach native [list false true] {
        foreach year [getBuildYears] {
          foreach configuration [getBuildConfigurations] {

            foreach extra [getBuildExtras] {
              #
              # NOTE: Figure out the effective build platform.  This is
              #       based on whether or not a [primarily] native build
              #       is being used.  For [primarily] non-native builds,
              #       this will be an empty string.
              #
              set platform [getBuildPlatform $native]

              tputs $channel [appendArgs \
                  "---- checking for System.Data.SQLite build \"" [expr \
                  {$native ? "native/" : ""}] [expr {[string length \
                  $platform] > 0 ? [appendArgs $platform /] : ""}] $year \
                  / $configuration "\"... "]

              #
              # NOTE: Build the fully qualified directory where the necessary
              #       components for System.Data.SQLite should be found.

              #
              set directory [joinBuildDirectory $native \
                  [getBuildBaseDirectory] $year $platform $configuration \
                  $extra]






              #

              # NOTE: Do the necessary files exist?  Currently, no other steps
              #       are taken to verify this build is actually viable.

              #


              if {[isBuildAvailable $native $directory]} then {
                #
                # NOTE: When in "select" mode, automatically select the first
                #       available build of System.Data.SQLite and then return
                #       immediately.
                #
                if {$select && [matchPlatform $platform]} then {
                  #
                  # NOTE: Manually override all the build directory selection
                  #       related test settings in order to force this build
                  #       of System.Data.SQLite to be used.

                  #
                  if {![changeNativeRuntimeOption $native]} then {
                    tputs $channel [appendArgs \
                        "no, failed to " [expr {$native ? "add" : "remove"}] \
                        " the \"native\" runtime option\n"]

                    return false
                  }


                  set ::test_year $year




                  set ::test_platform $platform
                  set ::test_configuration $configuration








                  tputs $channel [appendArgs \
                      "yes, selected (" [expr {$native ? "native/" : ""}] \
                      [expr {[string length $platform] > 0 ? [appendArgs \
                      $platform /] : ""}] $year / $configuration \
                      [expr {[string length $extra] > 0 ? [appendArgs / \
                      $extra] : ""}] ")\n"]

                  return true
                } else {
                  tputs $channel yes\n
                }
              } else {
                tputs $channel no\n

              }
            }
          }
        }
      }

      return false
................................................................................

        #
        # 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: Show the various lists of file names that are handled by this
        #       procedure.
        #
        tputs $::test_channel [appendArgs \
            "---- list of \"configuration\" file names is: " \
            $configFileNames \n]


        tputs $::test_channel [appendArgs \
            "---- list of \"MDA configuration\" file names is: " \
            $mdaConfigFileNames \n]


        tputs $::test_channel [appendArgs \
            "---- list of \"external\" file names is: " $externalFileNames \n]



        tputs $::test_channel [appendArgs \
            "---- list of \"native\" file names is: " $nativeFileNames \n]



        tputs $::test_channel [appendArgs \
            "---- list of \"mixed\" file names is: " $mixedFileNames \n]



        tputs $::test_channel [appendArgs \
            "---- list of \"managed\" file names is: " $managedFileNames \n]



        #
        # 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 {
................................................................................
            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 {
          #
................................................................................
            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 {
            #
................................................................................
                      "---- copying \"native\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false $architecture
                  }
                }










              }
            }

            if {![info exists ::no(copySqliteMixedFiles)]} then {
              #
              # NOTE: If the "native" runtime option is set, copy implicit
              #       mixed-mode assembly files as well.  The runtime option
................................................................................
                      "---- copying \"mixed\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false $architecture
                  }
                }










              }
            }

            if {![info exists ::no(copySqliteManagedFiles)]} then {
              tputs $::test_channel "---- copying \"managed\" files...\n"

              foreach fileName $managedFileNames {
................................................................................
              # NOTE: Yes, add constraint for use by the test suite.
              #
              addConstraint System.Data.SQLite.Encryption
            }
          }
        }

















        #
        # NOTE: Check the current build year.  Basically, this indicates
        #       which version of MSBuild and/or Visual Studio was used to
        #       compile the assembly binaries under test.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build year... "

        set year [getBuildYear]


        addConstraint [appendArgs buildYear. $year]
        tputs $::test_channel [appendArgs \" $year \"\n]





        tputs $::test_channel \
            "---- checking for System.Data.SQLite build native year... "

        set year [getBuildNativeYear]


        addConstraint [appendArgs buildNativeYear. $year]
        tputs $::test_channel [appendArgs \" $year \"\n]





        #
        # NOTE: Check the current build .NET Framework.  Basically, this
        #       indicates which version of the .NET Framework is being
        #       used by the assembly binaries under test.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build .NET Framework... "

        set netFx [getBuildNetFx]


        addConstraint [appendArgs buildFramework. $netFx]
        tputs $::test_channel [appendArgs \" $netFx \"\n]





        #
        # NOTE: Check the current build configuration.  This should normally
        #       be either "Debug" or "Release".
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build configuration... "

        set configuration [getBuildConfiguration]


        addConstraint [appendArgs buildConfiguration. $configuration]
        tputs $::test_channel [appendArgs \" $configuration \"\n]









        tputs $::test_channel \
            "---- checking for System.Data.SQLite build extra... "
























        #
        # NOTE: Check the current build extra directory.  This will normally
        #       be either "netstandard2.0" or an empty string.
        #



        set extra [getBuildExtra]

        if {[string length $extra] > 0} then {
          addConstraint [appendArgs buildExtra. $extra]
          tputs $::test_channel [appendArgs \" $extra \"\n]
        } else {
          addConstraint buildExtra.none







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







 







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







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
|
>
>







>
|








>
>







 







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







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







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







 







|












>
>
>
>
>
>
>
>







 







|







 







|
>
>







 







>
|
|
|
|
|
|
|
|

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

>
>
>
>
>
|
>
|
|
>
|
>
>
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|

|
|

>
|
>
>
>
>
|
|
>

>
>
>
>
>
>
|
|
|
|
|
|

|
|
|
|
|
|
>







 







>
|



|
>







 







|
>



|
>


|
>
>


|
>
>


|
>
>


|
>
>







 







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







 







<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>







 







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









>
>
|
|
>
>
>
>





>
>
|
|
>
>
>
>










>
>
|
|
>
>
>
>









>
>
|
|
>
>
>
|
>
>
>
>
>

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





>
>
>







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
...
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
...
260
261
262
263
264
265
266


















267
268
269
270
271
272
273
...
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
...
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
...
465
466
467
468
469
470
471



















472
473
474
475
476
477
478
...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
...
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
...
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
....
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
....
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946





1947

1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
....
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
....
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
....
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
....
4869
4870
4871
4872
4873
4874
4875












4876
4877
4878
4879
4880
4881
4882
....
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
....
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
....
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
          [appendArgs [getSQLiteDefineConstantPrefix] $name]]
    }
 
    proc haveSQLiteCompileOption { name } {
      return [haveConstraint \
          [appendArgs [getSQLiteCompileOptionPrefix] $name]]
    }
 
    proc getBuildNative {} {
      #
      # NOTE: Check if we are being forced to treat this as a native build.
      #       This is normally done (automatically) only when the mixed-mode
      #       assembly is in use; however, in some circumstances it is useful
      #       to force this behavior.
      #
      if {[info exists ::test_native] && \
          [string is boolean -strict $::test_native]} then {
        return $::test_native
      } else {
        return false
      }
    }
 
    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, 2010, 2012, 2013, 2015, or 2017 build systems.  To
................................................................................
        #
        # NOTE: Fallback on the (normal) build year for managed binaries.
        #
        return [getBuildYear]
      }
    }
 
    proc getBuildNativeYearForDotNetCore { year } {
      if {[isDotNetCore] && [isWindows]} then {
        return 2015; # HACK: Special case, use 2015 native binaries.
      } elseif {[string length $year] > 0} then {
        return $year
      } else {
        return [getBuildNativeYear]
      }
    }
 
    proc getBuildYears {} {
      #
      # NOTE: See if the list of test years has been overridden by the user
      #       (e.g. on the command line).
      #
      if {[info exists ::test_years] && [llength $::test_years] > 0} then {
        #
        # NOTE: Use the specified list of test years.
        #
        return $::test_years
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, prioritize its list of test years.
        #
        return [list NetStandard20]
      } else {
        #
        # NOTE: Use the default list of test years (i.e. all).
        #
        return [list 2005 2008 2010 2012 2013 2015 2017 NetStandard20]
      }
    }
 
    #
    # NOTE: This procedure is only used when adding shimmed test constraints.
    #
    proc getBuildClrVersion {} {
      if {[info exists ::test_clr] && [string length $::test_clr] > 0} then {
        #
        # NOTE: Use the specified test version for the CLR.  If this variable
................................................................................
            #
            return 2.0.50727; # TODO: Good "fallback" default?
          }
        }
      }
    }
 


















    proc getBuildNetFx {} {
      #
      # NOTE: See if the test .NET Framework setting has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_net_fx] && \
          [string length $::test_net_fx] > 0} then {
................................................................................
      return true
    }
 
    proc getBuildPlatform { native } {
      if {[info exists ::test_platform] && \
          [string length $::test_platform] > 0} then {
        #
        # NOTE: Possibly use the specified test platform.  If this variable
        #       is not set, the default value will be based on the machine
        #       architecture.  Normally, this is done for builds that involve
        #       the mixed-mode assembly.
        #
        return [expr {$native ? $::test_platform : ""}]
      } elseif {[info exists ::test_machine] && \
          [string length $::test_machine] > 0} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the test machine architecture; otherwise, return an empty
        #       string.  Normally, this is done for builds that involve the
        #       mixed-mode assembly.
        #
        return [expr {
          $native ? [machineToPlatform $::test_machine] : ""
        }]
      } elseif {[info exists ::tcl_platform(machine)]} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the machine architecture; otherwise, return an empty string.
        #       Normally, this is done for builds that involve the mixed-mode
        #       assembly.
        #
        return [expr {
          $native ? [machineToPlatform $::tcl_platform(machine)] : ""
        }]
      } else {
        #
        # NOTE: No machine architecture is available, return an empty string.
................................................................................
        #       test configuration variable is always set by the test suite
        #       itself; however, it can be overridden using the unset command
        #       from the -preTest option to the test suite.
        #
        return $::eagle_platform(configuration)
      }
    }
 
    proc getBuildConfigurations {} {
      #
      # NOTE: See if the list of test configurations has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configurations] && \
          [llength $::test_configurations] > 0} then {
        #
        # NOTE: Use the specified list of test configurations.
        #
        return $::test_configurations
      } else {
        #
        # NOTE: Use the default list of test configurations.
        #
        return [list Debug Release]
      }
    }
 
    proc getBuildConfigurationSuffix {} {
      #
      # NOTE: See if the test configuration suffix has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configuration_suffix] && \
................................................................................
        # NOTE: Use the default test configuration suffix, which should be
        #       an empty string.
        #
        return ""
      }
    }
 



















    proc getBuildNativeConfigurationSuffix {} {
      #
      # NOTE: See if the test native configuration suffix has been
      #       overridden by the user (e.g. on the command line).
      #
      if {[info exists ::test_native_configuration_suffix] && \
          [string length $::test_native_configuration_suffix] > 0} then {
................................................................................
        #
        # NOTE: Use the default test native configuration suffix, which
        #       should be an empty string.
        #
        return ""
      }
    }
 
    proc getBuildNativeConfigurationSuffixForDotNetCore { suffix } {
      if {[isDotNetCore] && [isWindows]} then {
        return NativeOnly; # HACK: Special case, use 2015 native binaries.
      } elseif {[string length $suffix] > 0} then {
        return $suffix
      } else {
        return [getBuildNativeConfigurationSuffix]
      }
    }
 
    proc getBuildConfigurationSuffixes {} {
      #
      # NOTE: See if the list of test configuration suffixes has been
      #       overridden by the user (e.g. on the command line).
      #
      if {[info exists ::test_configuration_suffixes] && \
          [llength $::test_configuration_suffixes] > 0} then {
        #
        # NOTE: Use the specified list of test configurations suffixes.
        #
        return $::test_configuration_suffixes
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, prioritize its test configuration
        #       suffixes for library files.
        #
        return [list NetStandard20 ""]
      } else {
        #
        # NOTE: Use the default list of test configurations suffixes.
        #
        return [list ""]
      }
    }
 
    proc getBuildExtra {} {
      if {[info exists ::test_extra] && \
          [string length $::test_extra] > 0} then {
        #
        # NOTE: Use the specified extra output directory.
        #
................................................................................
      if {[file exists $fileName]} then {
        return $fileName
      }

      return $default
    }
 
    proc isBuildAvailable { native skipNative directory {varName ""} } {
      #
      # NOTE: Build the fully qualified file name for the primary assembly
      #       containing the System.Data.SQLite managed components.  It
      #       should be noted that this assembly file may also contain the
      #       native components, if a native build is in use.
      #
      set fileName [file nativename [file join $directory \
          System.Data.SQLite.dll]]

      if {![file exists $fileName]} then {
        return false
      }

      #
      # NOTE: If we are skipping looking for the native components, stop
      #       now.
      #
      if {$skipNative} then {
        return true
      }

      #
      # NOTE: Attempt to automatically detect if the primary assembly
      #       contains any native components, if necessary.
      #
      if {[string length $native] == 0} then {
        if {[string length $varName] > 0} then {
................................................................................
    }
 
    proc isReleaseAvailable { directory {varName ""} } {
      if {[string length $varName] > 0} then {
        upvar 1 $varName $varName
      }

      return [isBuildAvailable "" false $directory $varName]
    }
 
    proc joinBuildDirectory { native path year platform configuration extra } {
      #
      # NOTE: Figure out and then return the fully qualified path to the build
      #       directory based on all the arguments provided by our caller.
      #
................................................................................
        #
        #       Note that all of the build commands above will default to using
        #       the latest version of MSBuild available and the "test_year" may
        #       need to be adjusted accordingly to actually run the test suite.
        #       Refer to the comments in [getBuildYear] for more information on
        #       how to set this variable.
        #
        set native [expr {
          !$managedOnly && ([getBuildNative] || [hasRuntimeOption native])
        }]

        return [joinBuildDirectory $native [getBuildBaseDirectory] \
            [expr {$managedOnly ? [getBuildYear] : [getBuildNativeYear]}] \
            [getBuildPlatform $native] [appendArgs [getBuildConfiguration] \
            [expr {$managedOnly ? [getBuildConfigurationSuffix] : \
            [getBuildNativeConfigurationSuffix]}]] [expr {$managedOnly ? \
            [getBuildExtra] : ""}]]
................................................................................
      # NOTE: Check for every possible valid combination of values used when
      #       locating out the build output directory, showing each available
      #       build variation along the way.
      #
      foreach native [list false true] {
        foreach year [getBuildYears] {
          foreach configuration [getBuildConfigurations] {
            foreach suffix [getBuildConfigurationSuffixes] {
              foreach extra [getBuildExtras] {
                #
                # NOTE: Figure out the effective build platform.  This is
                #       based on whether or not a [primarily] native build
                #       is being used.  For [primarily] non-native builds,
                #       this will be an empty string.
                #
                set platform [getBuildPlatform $native]






                #

                # NOTE: Build the fully qualified directory where the
                #       necessary components for System.Data.SQLite should
                #       be found.
                #
                set directory [joinBuildDirectory $native \
                    [getBuildBaseDirectory] $year $platform [appendArgs \
                    $configuration $suffix] $extra]

                tputs $channel [appendArgs \
                    "---- checking for System.Data.SQLite build \"" [expr \
                    {$native ? "native/" : ""}] [expr {[string length \
                    $platform] > 0 ? [appendArgs $platform /] : ""}] \
                    $year / [appendArgs $configuration $suffix] "\"... "]

                #
                # NOTE: Do the necessary files exist?  Currently, no other
                #       steps are taken to verify this build is actually
                #       viable.
                #
                set skipNative [expr {[isDotNetCore] && [isWindows]}]

                if {[isBuildAvailable $native $skipNative $directory]} then {
                  #
                  # NOTE: When in "select" mode, automatically select the
                  #       first available build of System.Data.SQLite and
                  #       then return immediately.
                  #
                  if {$select && [matchPlatform $platform]} then {
                    #
                    # NOTE: Manually override all the build directory
                    #       selection related test settings in order to
                    #       force this build of System.Data.SQLite to be
                    #       used.
                    #
                    if {![changeNativeRuntimeOption $native]} then {
                      tputs $channel [appendArgs \
                          "no, failed to " [expr {$native ? "add" : \
                          "remove"}] " the \"native\" runtime option\n"]

                      return false
                    }

                    set ::test_native $skipNative
                    set ::test_year $year

                    set ::test_native_year \
                        [getBuildNativeYearForDotNetCore $year]

                    set ::test_platform $platform
                    set ::test_configuration $configuration
                    set ::test_configuration_suffix $suffix

                    set ::test_native_configuration_suffix \
                        [getBuildNativeConfigurationSuffixForDotNetCore \
                        $suffix]

                    set ::test_extra $extra

                    tputs $channel [appendArgs \
                        "yes, selected (" [expr {$native ? "native/" : ""}] \
                        [expr {[string length $platform] > 0 ? [appendArgs \
                        $platform /] : ""}] $year / [appendArgs \
                        $configuration $suffix] [expr {[string length \
                        $extra] > 0 ? [appendArgs / $extra] : ""}] ")\n"]

                    return true
                  } else {
                    tputs $channel yes\n
                  }
                } else {
                  tputs $channel no\n
                }
              }
            }
          }
        }
      }

      return false
................................................................................

        #
        # 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 \"" \
            [expr {[string length $platform] > 0 ? $platform : "<none>"}] \
            \"\n]

        tputs $::test_channel [appendArgs \
            "---- architecture for locating native build files is \"" \
            [expr {[string length $architecture] > 0 ? $architecture : \
            "<none>"}] \"\n]

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

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

        #
        # NOTE: Show the various lists of file names that are handled by this
        #       procedure.
        #
        tputs $::test_channel [appendArgs \
            "---- list of \"configuration\" file names is: " \
            [expr {[llength $configFileNames] > 0 ? $configFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"MDA configuration\" file names is: " \
            [expr {[llength $mdaConfigFileNames] > 0 ? $mdaConfigFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"external\" file names is: " \
            [expr {[llength $externalFileNames] > 0 ? $externalFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"native\" file names is: " \
            [expr {[llength $nativeFileNames] > 0 ? $nativeFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"mixed\" file names is: " \
            [expr {[llength $mixedFileNames] > 0 ? $mixedFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"managed\" file names is: " \
            [expr {[llength $managedFileNames] > 0 ? $managedFileNames : \
            "<none>"}] \n]

        #
        # 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 {
................................................................................
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $managedFileNames {
            removeConstraint [appendArgs file_ $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 all System.Data.SQLite related file handling (deleting,
        #       copying, and loading) if instructed.
        #
        if {![info exists ::no(sqliteFiles)]} then {
          #
................................................................................
            if {![info exists ::no(deleteSqliteManagedFiles)]} then {
              foreach fileName $managedFileNames {
                tryDeleteAssembly $fileName
              }
            }
          }













          #
          # 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 {
            #
................................................................................
                      "---- copying \"native\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false $architecture
                  }
                }

                if {![info exists ::no(copySqliteForcedNativeFiles)] && \
                    [getBuildNative]} then {
                  tputs $::test_channel \
                      "---- copying forced \"native\" files...\n"

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false
                  }
                }
              }
            }

            if {![info exists ::no(copySqliteMixedFiles)]} then {
              #
              # NOTE: If the "native" runtime option is set, copy implicit
              #       mixed-mode assembly files as well.  The runtime option
................................................................................
                      "---- copying \"mixed\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false $architecture
                  }
                }

                if {![info exists ::no(copySqliteForcedMixedFiles)] && \
                    [getBuildNative]} then {
                  tputs $::test_channel \
                      "---- copying forced \"mixed\" files...\n"

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false
                  }
                }
              }
            }

            if {![info exists ::no(copySqliteManagedFiles)]} then {
              tputs $::test_channel "---- copying \"managed\" files...\n"

              foreach fileName $managedFileNames {
................................................................................
              # NOTE: Yes, add constraint for use by the test suite.
              #
              addConstraint System.Data.SQLite.Encryption
            }
          }
        }

        #
        # NOTE: Check if the native build flag has been forcibly set.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build native flag... "

        set native [getBuildNative]

        if {[string length $native] > 0} then {
          addConstraint [appendArgs buildNative. $native]
          tputs $::test_channel [appendArgs \" $native \"\n]
        } else {
          addConstraint buildNative.none
          tputs $::test_channel <none>\n
        }

        #
        # NOTE: Check the current build year.  Basically, this indicates
        #       which version of MSBuild and/or Visual Studio was used to
        #       compile the assembly binaries under test.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build year... "

        set year [getBuildYear]

        if {[string length $year] > 0} then {
          addConstraint [appendArgs buildYear. $year]
          tputs $::test_channel [appendArgs \" $year \"\n]
        } else {
          addConstraint buildYear.none
          tputs $::test_channel <none>\n
        }

        tputs $::test_channel \
            "---- checking for System.Data.SQLite build native year... "

        set year [getBuildNativeYear]

        if {[string length $year] > 0} then {
          addConstraint [appendArgs buildNativeYear. $year]
          tputs $::test_channel [appendArgs \" $year \"\n]
        } else {
          addConstraint buildNativeYear.none
          tputs $::test_channel <none>\n
        }

        #
        # NOTE: Check the current build .NET Framework.  Basically, this
        #       indicates which version of the .NET Framework is being
        #       used by the assembly binaries under test.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build .NET Framework... "

        set netFx [getBuildNetFx]

        if {[string length $netFx] > 0} then {
          addConstraint [appendArgs buildFramework. $netFx]
          tputs $::test_channel [appendArgs \" $netFx \"\n]
        } else {
          addConstraint buildFramework.none
          tputs $::test_channel <none>\n
        }

        #
        # NOTE: Check the current build configuration.  This should normally
        #       be either "Debug" or "Release".
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build configuration... "

        set configuration [getBuildConfiguration]

        if {[string length $configuration] > 0} then {
          addConstraint [appendArgs buildConfiguration. $configuration]
          tputs $::test_channel [appendArgs \" $configuration \"\n]
        } else {
          addConstraint buildConfiguration.none
          tputs $::test_channel <none>\n
        }

        #
        # NOTE: Check the current build configuration suffix.  This will
        #       normally be either "NetStandard20" or an empty string.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build configuration suffix... "

        set suffix [getBuildConfigurationSuffix]

        if {[string length $suffix] > 0} then {
          addConstraint [appendArgs buildConfigurationSuffix. $suffix]
          tputs $::test_channel [appendArgs \" $suffix \"\n]
        } else {
          addConstraint buildConfigurationSuffix.none
          tputs $::test_channel <none>\n
        }

        tputs $::test_channel \
            "---- checking for System.Data.SQLite build native configuration suffix... "

        set suffix [getBuildNativeConfigurationSuffix]

        if {[string length $suffix] > 0} then {
          addConstraint [appendArgs buildNativeConfigurationSuffix. $suffix]
          tputs $::test_channel [appendArgs \" $suffix \"\n]
        } else {
          addConstraint buildNativeConfigurationSuffix.none
          tputs $::test_channel <none>\n
        }

        #
        # NOTE: Check the current build extra directory.  This will normally
        #       be either "netstandard2.0" or an empty string.
        #
        tputs $::test_channel \
            "---- checking for System.Data.SQLite build extra... "

        set extra [getBuildExtra]

        if {[string length $extra] > 0} then {
          addConstraint [appendArgs buildExtra. $extra]
          tputs $::test_channel [appendArgs \" $extra \"\n]
        } else {
          addConstraint buildExtra.none