Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the Eagle core script library and test suite infrastructure to better support testing the native library pre-loading code. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | refactorNativeLibraryPreLoader |
Files: | files | file ages | folders |
SHA1: |
9e3b23cb78270383fc64ca9c7a85fd60 |
User & Date: | mistachkin 2013-12-27 07:41:37.239 |
Context
2013-12-27
| ||
08:36 | Adjustments to the native library pre-loading logic for the .NET Compact Framework. check-in: e90af0978f user: mistachkin tags: refactorNativeLibraryPreLoader | |
07:41 | Update the Eagle core script library and test suite infrastructure to better support testing the native library pre-loading code. check-in: 9e3b23cb78 user: mistachkin tags: refactorNativeLibraryPreLoader | |
04:57 | Merge updates from trunk. check-in: f2075b5036 user: mistachkin tags: refactorNativeLibraryPreLoader | |
Changes
Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.
︙ | ︙ | |||
1952 1953 1954 1955 1956 1957 1958 | proc machineToPlatform { machine {architecture false} } { # # NOTE: Cannot use "-nocase" option here because Tcl 8.4 does not # support it (i.e. because it is pre-TIP #241). # switch -exact -- [string tolower $machine] { | < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | proc machineToPlatform { machine {architecture false} } { # # NOTE: Cannot use "-nocase" option here because Tcl 8.4 does not # support it (i.e. because it is pre-TIP #241). # switch -exact -- [string tolower $machine] { intel { if {!$architecture && \ [info exists ::tcl_platform(platform)] && \ $::tcl_platform(platform) eq "windows"} then { return Win32 } else { return x86 } } arm { return arm } ia64 { return itanium } msil { return clr } amd64 { return x64 } ia32_on_win64 { return wow64 } default { return unknown } } } proc architectureForPlatform { platform } { # # NOTE: Cannot use "-nocase" option here because Tcl 8.4 does not # support it (i.e. because it is pre-TIP #241). # switch -exact -- [string tolower $platform] { intel - win32 - x86 { return x86 } arm { return arm } ia64 - itanium { return ia64 } msil - clr { return msil } amd64 - x64 { return x64 } ia32_on_win64 - wow64 { return ia32_on_win64 } default { return unknown } } } if {[isEagle]} then { |
︙ | ︙ |
Changes to Externals/Eagle/lib/Test1.0/prologue.eagle.
︙ | ︙ | |||
1966 1967 1968 1969 1970 1971 1972 | # # NOTE: Has checking for the extra files needed by various tests been # disabled? # if {![info exists no(checkForFile)]} then { # | | | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | # # NOTE: Has checking for the extra files needed by various tests been # disabled? # if {![info exists no(checkForFile)]} then { # # NOTE: For tests "benchmark-1.3[89]" and "benchmark-1.40". # if {![info exists no(benchmark.txt)]} then { checkForFile $test_channel [file join $test_path benchmark.txt] } # # NOTE: For test "garuda-1.1". |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 | /// Stores the mappings between processor architecture names and platform /// names. /// </summary> private static Dictionary<string, string> processorArchitecturePlatforms; ///////////////////////////////////////////////////////////////////////// /// <summary> /// The native module handle for the native SQLite library or the value /// IntPtr.Zero. /// </summary> | > > > > > > | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | /// Stores the mappings between processor architecture names and platform /// names. /// </summary> private static Dictionary<string, string> processorArchitecturePlatforms; ///////////////////////////////////////////////////////////////////////// /// <summary> /// The native module file name for the native SQLite library or null. /// </summary> private static string _SQLiteNativeModuleFileName = null; ///////////////////////////////////////////////////////////////////////// /// <summary> /// The native module handle for the native SQLite library or the value /// IntPtr.Zero. /// </summary> private static IntPtr _SQLiteNativeModuleHandle = IntPtr.Zero; ///////////////////////////////////////////////////////////////////////// /// <summary> /// For now, this method simply calls the Initialize method. /// </summary> static UnsafeNativeMethods() { |
︙ | ︙ | |||
451 452 453 454 455 456 457 | processorArchitecturePlatforms.Add("IA64", "Itanium"); processorArchitecturePlatforms.Add("ARM", "WinCE"); } // // BUGBUG: What about other application domains? // | | > > > > > > > | > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | processorArchitecturePlatforms.Add("IA64", "Itanium"); processorArchitecturePlatforms.Add("ARM", "WinCE"); } // // BUGBUG: What about other application domains? // if (_SQLiteNativeModuleHandle == IntPtr.Zero) { // // NOTE: Attempt to pre-load the SQLite core library (or // interop assembly) and store both the file name // and native module handle for later usage. // /* IGNORED */ PreLoadSQLiteDll( null, null, ref _SQLiteNativeModuleFileName, ref _SQLiteNativeModuleHandle); } } } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Queries and returns the base directory of the current application /// domain. |
︙ | ︙ | |||
717 718 719 720 721 722 723 | /// processor architecture specific sub-directories. /// </param> /// <param name="processorArchitecture"> /// The requested processor architecture, null for default (the /// processor architecture of the current process). This caller should /// almost always specify null for this parameter. /// </param> | > > > | > | > | > > > > | | > > | | | | 733 734 735 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 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | /// processor architecture specific sub-directories. /// </param> /// <param name="processorArchitecture"> /// The requested processor architecture, null for default (the /// processor architecture of the current process). This caller should /// almost always specify null for this parameter. /// </param> /// <param name="nativeModuleFileName"> /// The candidate native module file name to load will be stored here, /// if necessary. /// </param> /// <param name="nativeModuleHandle"> /// The native module handle as returned by LoadLibrary will be stored /// here, if necessary. This value will be IntPtr.Zero if the call to /// LoadLibrary fails. /// </param> /// <returns> /// Non-zero if the native module was loaded successfully; otherwise, /// zero. /// </returns> private static bool PreLoadSQLiteDll( string directory, string processorArchitecture, ref string nativeModuleFileName, ref IntPtr nativeModuleHandle ) { // // NOTE: If the specified base directory is null, use the default // (i.e. attempt to automatically detect it). // if (directory == null) directory = GetBaseDirectory(); // // NOTE: If we failed to query the base directory, stop now. // if (directory == null) return false; // // NOTE: If the native SQLite library exists in the base directory // itself, stop now. // string fileName = FixUpDllFileName(Path.Combine(directory, SQLITE_DLL)); if (File.Exists(fileName)) return false; // // NOTE: If the specified processor architecture is null, use the // default. // if (processorArchitecture == null) processorArchitecture = GetProcessorArchitecture(); // // NOTE: If we failed to query the processor architecture, stop now. // if (processorArchitecture == null) return false; // // NOTE: Build the full path and file name for the native SQLite // library using the processor architecture name. // fileName = FixUpDllFileName(Path.Combine(Path.Combine(directory, processorArchitecture), SQLITE_DLL)); |
︙ | ︙ | |||
785 786 787 788 789 790 791 | // string platformName = GetPlatformName(processorArchitecture); // // NOTE: If we failed to translate the platform name, stop now. // if (platformName == null) | | | | 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 | // string platformName = GetPlatformName(processorArchitecture); // // NOTE: If we failed to translate the platform name, stop now. // if (platformName == null) return false; // // NOTE: Build the full path and file name for the native SQLite // library using the platform name. // fileName = FixUpDllFileName(Path.Combine(Path.Combine(directory, platformName), SQLITE_DLL)); // // NOTE: If the file does not exist, skip trying to load it. // if (!File.Exists(fileName)) return false; } try { #if !NET_COMPACT_20 && TRACE_PRELOAD try { |
︙ | ︙ | |||
826 827 828 829 830 831 832 | #endif // // NOTE: Attempt to load the native library. This will either // return a valid native module handle, return IntPtr.Zero, // or throw an exception. // | > | > > | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | #endif // // NOTE: Attempt to load the native library. This will either // return a valid native module handle, return IntPtr.Zero, // or throw an exception. // nativeModuleFileName = fileName; nativeModuleHandle = LoadLibrary(fileName); return (nativeModuleHandle != IntPtr.Zero); } #if !NET_COMPACT_20 && TRACE_PRELOAD catch (Exception e) #else catch (Exception) #endif { |
︙ | ︙ | |||
860 861 862 863 864 865 866 | catch { // do nothing. } #endif } | | | 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | catch { // do nothing. } #endif } return false; } #endif #endif #endregion ///////////////////////////////////////////////////////////////////////// |
︙ | ︙ |
Changes to Tests/common.eagle.
︙ | ︙ | |||
539 540 541 542 543 544 545 | # return [file nativename \ [file join [getBinaryDirectory] $platform [file tail $fileName]]] } proc getCoreBinaryFileName { {platform ""} {standard false} } { # | | | > > > > > > > > > > > > > > > | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | # return [file nativename \ [file join [getBinaryDirectory] $platform [file tail $fileName]]] } proc getCoreBinaryFileName { {platform ""} {standard false} } { # # NOTE: Returns the full path for the file containing the SQLite core # native library code for this platform. First, check and see if # the SQLite core native library has already been loaded. Next, # fallback to what the full path should be, based on whether the # mixed-mode assembly is being used and the name of the current # platform. # if {[catch {object invoke -flags +NonPublic \ System.Data.SQLite.UnsafeNativeMethods \ _SQLiteNativeModuleFileName} fileName] == 0 && \ [string length $fileName] > 0} then { # # NOTE: The SQLite core native library has already been loaded via # the native library pre-loader. Return that file name now. # return $fileName } if {[hasRuntimeOption native]} then { # # NOTE: Return the mixed-mode assembly file name. # return [file nativename \ [file join [getBinaryDirectory] $platform System.Data.SQLite.dll]] } elseif {$standard} then { |
︙ | ︙ | |||
2193 2194 2195 2196 2197 2198 2199 | # 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. # | | > > > > > > > > | 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 | # 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 |
︙ | ︙ | |||
2320 2321 2322 2323 2324 2325 2326 | # 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 { | < | | 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | # 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\"... " \ |
︙ | ︙ |