Ensure ReadyToRun test verifies version resiliency
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 28 Aug 2015 10:12:28 +0000 (12:12 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 28 Aug 2015 17:57:29 +0000 (19:57 +0200)
This change modifies the ReadyToRun test so that it verifies assembly version resiliency.

tests/src/readytorun/main.cs
tests/src/readytorun/mainv1.csproj
tests/src/readytorun/mainv2.csproj
tests/src/readytorun/testv1/app.config [new file with mode: 0644]
tests/src/readytorun/testv1/packages.config [new file with mode: 0644]
tests/src/readytorun/testv1/testv1.csproj [moved from tests/src/readytorun/testv1.csproj with 93% similarity]
tests/src/readytorun/testv2/app.config [new file with mode: 0644]
tests/src/readytorun/testv2/packages.config [new file with mode: 0644]
tests/src/readytorun/testv2/testv2.csproj [moved from tests/src/readytorun/testv2.csproj with 94% similarity]

index 8604a3e..0a386ca 100644 (file)
@@ -237,12 +237,7 @@ class Program
 
         public void TestMultipleLoads()
         {
-#if V2
-            string testVersion = "2";
-#else
-            string testVersion = "1";
-#endif            
-            Assembly a = LoadFromAssemblyPath(Path.Combine(Directory.GetCurrentDirectory(), "NI", "testv" + testVersion + ".ni.dll"));
+            Assembly a = LoadFromAssemblyPath(Path.Combine(Directory.GetCurrentDirectory(), "NI", "test.ni.dll"));
             Assert.AreEqual(AssemblyLoadContext.GetLoadContext(a), this);
         }
 
index cc47339..a64c4a2 100644 (file)
@@ -28,7 +28,7 @@
     </CodeAnalysisDependentAssemblyPaths>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="testv1.csproj">
+    <ProjectReference Include="testv1\testv1.csproj">
        <Project>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</Project>
     </ProjectReference>
   </ItemGroup>
     <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
   </ItemGroup>
   <ItemGroup>
-    <Reference Include="testv1">
-      <HintPath>$(TargetDir)\testv1.dll</HintPath>
+    <Reference Include="test">
+      <HintPath>$(TargetDir)\testv1\test.dll</HintPath>
     </Reference>
   </ItemGroup>
   <PropertyGroup>
     <_CLRTestPreCommands><![CDATA[
 $(_CLRTestPreCommands)
 IF not exist NI mkdir NI
-%Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\testv1.ni.dll testv1.dll 
+COPY /Y testv1\test.dll test.dll
+%Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\test.ni.dll test.dll 
 %Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\mainv1.ni.exe mainv1.exe
-    ]]></_CLRTestPreCommands>
+]]></_CLRTestPreCommands>
   </PropertyGroup>  
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
 </Project>
index d522653..dab3678 100644 (file)
@@ -15,7 +15,7 @@
     <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
     <RestorePackages>true</RestorePackages>
     <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
-    <DefineConstants>$(DefineConstants);STATIC;CORECLR;V2</DefineConstants>
+    <DefineConstants>$(DefineConstants);STATIC;CORECLR</DefineConstants>
   </PropertyGroup>
   <!-- Default configurations to help VS understand the configurations -->
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
@@ -28,8 +28,8 @@
     </CodeAnalysisDependentAssemblyPaths>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="testv2.csproj">
-       <Project>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</Project>
+    <ProjectReference Include="testv1\testv1.csproj">
+       <Project>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</Project>
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
   </ItemGroup>
   <ItemGroup>
-    <Reference Include="testv2">
-      <HintPath>$(TargetDir)\testv2.dll</HintPath>
+    <Reference Include="test">
+      <HintPath>$(TargetDir)\testv1\test.dll</HintPath>
     </Reference>
   </ItemGroup>
   <PropertyGroup>
     <_CLRTestPreCommands><![CDATA[
 $(_CLRTestPreCommands)
 IF not exist NI mkdir NI
-%Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\testv2.ni.dll testv2.dll 
+COPY /Y testv1\test.dll test.dll
 %Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\mainv2.ni.exe mainv2.exe
+COPY /Y testv2\test.dll test.dll
+%Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out NI\test.ni.dll test.dll 
 ]]></_CLRTestPreCommands>
   </PropertyGroup>  
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/readytorun/testv1/app.config b/tests/src/readytorun/testv1/app.config
new file mode 100644 (file)
index 0000000..7f13fbc
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Collections" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>
\ No newline at end of file
diff --git a/tests/src/readytorun/testv1/packages.config b/tests/src/readytorun/testv1/packages.config
new file mode 100644 (file)
index 0000000..a1da698
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+    <package id="System.Collections" version="4.0.10-beta-22512" />
+    <package id="System.Console" version="4.0.0-beta-22405" />
+    <package id="System.IO" version="4.0.10-beta-22412" />
+    <package id="System.IO.FileSystem" version="4.0.0-beta-22412" />
+    <package id="System.Reflection" version="4.0.10-beta-22512" />
+    <package id="System.Reflection.Extensions" version="4.0.0-beta-22412" />
+    <package id="System.Runtime" version="4.0.20-beta-22412" />
+    <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" />
+    <package id="System.Runtime.InteropServices" version="4.0.20-beta-22412" />
+    <package id="System.Runtime.Loader" version="4.0.0-beta-22512" />
+</packages>
similarity index 93%
rename from tests/src/readytorun/testv1.csproj
rename to tests/src/readytorun/testv1/testv1.csproj
index 041f92e..4d881e6 100644 (file)
@@ -4,7 +4,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <AssemblyName>testv1</AssemblyName>
+    <AssemblyName>test</AssemblyName>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</ProjectGuid>
     <OutputType>library</OutputType>
@@ -12,7 +12,7 @@
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
     <RestorePackages>true</RestorePackages>
     <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
     <DefineConstants>$(DefineConstants);STATIC;CORECLR</DefineConstants>
@@ -28,7 +28,7 @@
     </CodeAnalysisDependentAssemblyPaths>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="test.cs" />
+    <Compile Include="..\test.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="packages.config" />
diff --git a/tests/src/readytorun/testv2/app.config b/tests/src/readytorun/testv2/app.config
new file mode 100644 (file)
index 0000000..7f13fbc
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Collections" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>
\ No newline at end of file
diff --git a/tests/src/readytorun/testv2/packages.config b/tests/src/readytorun/testv2/packages.config
new file mode 100644 (file)
index 0000000..a1da698
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+    <package id="System.Collections" version="4.0.10-beta-22512" />
+    <package id="System.Console" version="4.0.0-beta-22405" />
+    <package id="System.IO" version="4.0.10-beta-22412" />
+    <package id="System.IO.FileSystem" version="4.0.0-beta-22412" />
+    <package id="System.Reflection" version="4.0.10-beta-22512" />
+    <package id="System.Reflection.Extensions" version="4.0.0-beta-22412" />
+    <package id="System.Runtime" version="4.0.20-beta-22412" />
+    <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" />
+    <package id="System.Runtime.InteropServices" version="4.0.20-beta-22412" />
+    <package id="System.Runtime.Loader" version="4.0.0-beta-22512" />
+</packages>
similarity index 94%
rename from tests/src/readytorun/testv2.csproj
rename to tests/src/readytorun/testv2/testv2.csproj
index 8771df0..c236298 100644 (file)
@@ -4,7 +4,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <AssemblyName>testv2</AssemblyName>
+    <AssemblyName>test</AssemblyName>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
     <OutputType>library</OutputType>
@@ -12,7 +12,7 @@
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
     <RestorePackages>true</RestorePackages>
     <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
     <DefineConstants>$(DefineConstants);STATIC;CORECLR;V2</DefineConstants>
@@ -28,7 +28,7 @@
     </CodeAnalysisDependentAssemblyPaths>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="test.cs" />
+    <Compile Include="..\test.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="packages.config" />