Index: Tests/common.eagle ================================================================== --- Tests/common.eagle +++ Tests/common.eagle @@ -300,16 +300,23 @@ proc tryLoadAssembly { fileName } { set fileName [getBinaryFileName $fileName] if {[catch {set assembly \ - [object load -loadtype File $fileName]}] == 0} then { + [object load -loadtype File -alias $fileName]}] == 0} then { # # NOTE: Now, add the necessary test constraint. # addConstraint [file rootname [file tail $fileName]] + # + # NOTE: Grab the image runtime version from the assembly because + # several tests rely on it having a certain value. + # + addConstraint [appendArgs [file tail $fileName] _ \ + [$assembly ImageRuntimeVersion]] + # # NOTE: Return the full path of the loaded file. # return $fileName } @@ -705,10 +712,16 @@ # # NOTE: Report the resource usage prior to running any tests. # reportSQLiteResources $::test_channel + + # + # NOTE: Show the active test constraints. + # + tputs $::test_channel [appendArgs "---- constraints: " \ + [formatList [lsort [getConstraints]]] \n] } } proc runSQLiteTestEpilogue {} { # Index: Tests/installer.eagle ================================================================== --- Tests/installer.eagle +++ Tests/installer.eagle @@ -88,13 +88,12 @@ [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}] } -cleanup { catch {file delete $fileName} unset -nocomplain code output error fileName -} -constraints \ -{eagle visualStudio2008 file_Installer.exe file_Installer_Test_Vs2008.log} \ --result {0 True}} +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\ +file_Installer.exe file_Installer_Test_Vs2008.log} -result {0 True}} ############################################################################### runTest {test installer-1.2 {uninstaller tool / Visual Studio 2008} -setup { set fileName [file join [getTemporaryPath] \ @@ -120,13 +119,12 @@ [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}] } -cleanup { catch {file delete $fileName} unset -nocomplain code output error fileName -} -constraints \ -{eagle visualStudio2008 file_Installer.exe file_Uninstaller_Test_Vs2008.log} \ --result {0 True}} +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\ +file_Installer.exe file_Uninstaller_Test_Vs2008.log} -result {0 True}} ############################################################################### runTest {test installer-1.3 {installer tool / Visual Studio 2010} -setup { set fileName [file join [getTemporaryPath] \ @@ -152,13 +150,12 @@ [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}] } -cleanup { catch {file delete $fileName} unset -nocomplain code output error fileName -} -constraints \ -{eagle visualStudio2010 file_Installer.exe file_Installer_Test_Vs2010.log} \ --result {0 True}} +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\ +file_Installer.exe file_Installer_Test_Vs2010.log} -result {0 True}} ############################################################################### runTest {test installer-1.4 {uninstaller tool / Visual Studio 2010} -setup { set fileName [file join [getTemporaryPath] \ @@ -184,13 +181,12 @@ [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}] } -cleanup { catch {file delete $fileName} unset -nocomplain code output error fileName -} -constraints \ -{eagle visualStudio2010 file_Installer.exe file_Uninstaller_Test_Vs2010.log} \ --result {0 True}} +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\ +file_Installer.exe file_Uninstaller_Test_Vs2010.log} -result {0 True}} ############################################################################### unset -nocomplain testUninstallVs2010LogFile testUninstallVs2008LogFile \ testInstallVs2010LogFile testInstallVs2008LogFile installerExeFile \ Index: tools/install/Installer.cs ================================================================== --- tools/install/Installer.cs +++ tools/install/Installer.cs @@ -2134,11 +2134,11 @@ // string location = assembly.Location; TraceOps.Trace( TracePriority.Medium, traceCallback, String.Format( - "Running from: {0}", ForDisplay(location)), + "Running executable is: {0}", ForDisplay(location)), traceCategory); TraceOps.Trace( TracePriority.Medium, traceCallback, String.Format( "Original command line is: {0}", @@ -2195,13 +2195,12 @@ return false; } /////////////////////////////////////////////////////////////////// - public static bool CheckImageRuntimeVersion( + public static bool CheckRuntimeVersion( Configuration configuration, - VsList vsList, bool strict, ref string error ) { try @@ -2232,10 +2231,71 @@ // TODO: Restrict the configuration based on which image // runtime versions (which more-or-less correspond // to .NET Framework versions) are supported by the // versions of Visual Studio that are installed. // + if (String.IsNullOrEmpty(coreImageRuntimeVersion)) + { + error = "invalid core file image runtime version"; + return false; + } + else if (String.Equals( + coreImageRuntimeVersion, CLR2ImageRuntimeVersion, + StringComparison.InvariantCulture)) + { + // + // NOTE: For the CLR v2.0 runtime, make sure we disable + // any attempt to use it for things that require + // an assembly compiled for the CLR v4.0. It is + // uncertain if this is actually a problem in + // practice as the CLR v4.0 can load and use an + // assembly compiled with the CLR v2.0; however, + // since this project offers both configurations, + // we currently disallow this mismatch. + // + configuration.noNetFx40 = true; + configuration.noVs2010 = true; + + TraceOps.Trace( + TracePriority.Medium, traceCallback, String.Format( + "Assembly is compiled for the .NET Framework {0}, " + + "support for .NET Framework {1} is now disabled.", + CLR2ImageRuntimeVersion, CLR4ImageRuntimeVersion), + traceCategory); + } + else if (String.Equals( + coreImageRuntimeVersion, CLR4ImageRuntimeVersion, + StringComparison.InvariantCulture)) + { + // + // NOTE: For the CLR v4.0 runtime, make sure we disable + // any attempt to use it for things that require + // an assembly compiled for the CLR v2.0. + // + configuration.noNetFx20 = true; + configuration.noVs2008 = true; + + TraceOps.Trace( + TracePriority.Medium, traceCallback, String.Format( + "Assembly is compiled for the .NET Framework {0}, " + + "support for .NET Framework {1} is now disabled.", + ForDisplay(CLR4ImageRuntimeVersion), + ForDisplay(CLR2ImageRuntimeVersion)), + traceCategory); + } + else + { + error = String.Format( + "unsupported core file image runtime version " + + "{0}, must be {1} or {2}", + ForDisplay(coreImageRuntimeVersion), + ForDisplay(CLR2ImageRuntimeVersion), + ForDisplay(CLR4ImageRuntimeVersion)); + + return false; + } + return true; } catch (Exception e) { TraceOps.Trace( @@ -2677,10 +2737,15 @@ private const string ProjectName = "System.Data.SQLite"; private const string LegacyProjectName = "SQLite"; private const string InvariantName = "System.Data.SQLite"; private const string FactoryTypeName = "System.Data.SQLite.SQLiteFactory"; private const string Description = ".NET Framework Data Provider for SQLite"; + + /////////////////////////////////////////////////////////////////////// + + private const string CLR2ImageRuntimeVersion = "v2.0.50727"; + private const string CLR4ImageRuntimeVersion = "v4.0.30319"; /////////////////////////////////////////////////////////////////////// private const string NameAndValueFormat = "{0}: {1}"; private const string LogFileSuffix = ".log"; @@ -4628,72 +4693,46 @@ #region Application Entry Point private static int Main( string[] args ) { - Package package = null; - FrameworkList frameworkList = null; - VsList vsList = null; Configuration configuration = null; string error = null; /////////////////////////////////////////////////////////////////// #region Command Line Processing if (!Configuration.FromArgs( args, true, ref configuration, ref error) || !Configuration.Process( - args, configuration, true, ref error)) + args, configuration, true, ref error) || + !Configuration.CheckRuntimeVersion( + configuration, true, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, thisAssembly, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } + #endregion + + /////////////////////////////////////////////////////////////////// + + #region .NET Framework / Visual Studio Data + Package package = null; + FrameworkList frameworkList = null; + VsList vsList = null; /////////////////////////////////////////////////////////////////// InitializeVsPackage(ref package); InitializeFrameworkList(configuration, ref frameworkList); InitializeVsList(configuration, ref vsList); #endregion - /////////////////////////////////////////////////////////////////// - -#if false - #region Check Installed VS Versions - if (configuration.HasFlags(InstallFlags.All, /* any */ false)) - { - if (!ForEachVsVersionRegistry( - vsList, AddVsVersion, null, vsList, - configuration.WhatIf, configuration.Verbose, - ref error)) - { - TraceOps.ShowMessage( - TracePriority.Highest, traceCallback, null, - error, traceCategory, MessageBoxButtons.OK, - MessageBoxIcon.Error); - - return 1; /* FAILURE */ - } - - if (!Configuration.CheckImageRuntimeVersion( - configuration, vsList, true, ref error)) - { - TraceOps.ShowMessage( - TracePriority.Highest, traceCallback, null, - error, traceCategory, MessageBoxButtons.OK, - MessageBoxIcon.Error); - - return 1; /* FAILURE */ - } - } - #endregion -#endif - /////////////////////////////////////////////////////////////////// AssemblyName assemblyName = AssemblyName.GetAssemblyName( configuration.CoreFileName); /* throw */