Fix JIT.superpmi\superpmicollect broken on ReadyToRun jobs (dotnet/coreclr#25218)
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Wed, 16 Oct 2019 15:48:02 +0000 (08:48 -0700)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2019 15:48:02 +0000 (08:48 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/e153d5dfd52bf4f6083b1d741c95e3a70868a963

src/coreclr/tests/src/JIT/superpmi/TestProjects.txt [deleted file]
src/coreclr/tests/src/JIT/superpmi/superpmicollect.cs
src/coreclr/tests/src/JIT/superpmi/superpmicollect.csproj

diff --git a/src/coreclr/tests/src/JIT/superpmi/TestProjects.txt b/src/coreclr/tests/src/JIT/superpmi/TestProjects.txt
deleted file mode 100644 (file)
index 84f3445..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-../Performance/CodeQuality/Bytemark/Bytemark.csproj
-../Methodical/fp/exgen/10w5d_cs_do.csproj
-../Generics/Coverage/chaos65204782cs.csproj
index 7732dc7..8d65865 100644 (file)
@@ -250,33 +250,35 @@ namespace SuperPMICollection
             }
         }
 
-        // Run all the programs from the CoreCLR test binary drop we wish to run while collecting MC files.
-        private static void RunTestProgramsWhileCollecting()
+        private static string[] GetSpmiTestFullPaths()
         {
-            // Note: We previously used
-            //      JIT\Performance\CodeQuality\Roslyn\CscBench\CscBench.cmd
-            // but it doesn't currently run on x86 due to this issue: https://github.com/dotnet/coreclr/issues/6844.
-            var superPMICollectionTestProgramsList = new List<string>();
+            var spmiTestFullPaths = new List<string>();
 
-            using (var resourceStream = typeof(SuperPMICollectionClass).GetTypeInfo().Assembly.GetManifestResourceStream("TestProjects"))
+            using (var resourceStream = typeof(SuperPMICollectionClass).GetTypeInfo().Assembly.GetManifestResourceStream("SpmiTestNames"))
             using (var streamReader = new StreamReader(resourceStream))
             {
                 string currentDirectory = Directory.GetCurrentDirectory();
-                string csprojRelativePath;
-                while ((csprojRelativePath = streamReader.ReadLine()) != null)
+                string spmiTestName;
+                while ((spmiTestName = streamReader.ReadLine()) != null)
                 {
-                    string cmdFileName = Path.ChangeExtension(Path.GetFileName(csprojRelativePath), ".cmd");
-                    cmdFileName = Path.Combine(currentDirectory, cmdFileName);
-                    superPMICollectionTestProgramsList.Add(cmdFileName);
+                    string spmiTestFullPath = Path.Combine(currentDirectory, spmiTestName, Path.ChangeExtension(spmiTestName, ".cmd"));
+                    spmiTestFullPaths.Add(spmiTestFullPath);
                 }
             }
 
+            return spmiTestFullPaths.ToArray();
+        }
+
+        // Run all the programs from the CoreCLR test binary drop we wish to run while collecting MC files.
+        private static void RunTestProgramsWhileCollecting()
+        {
+
             // Run the tests
-            foreach (string testFullPath in superPMICollectionTestProgramsList)
+            foreach (string spmiTestPath in GetSpmiTestFullPaths())
             {
                 try
                 {
-                    RunTest(testFullPath);
+                    RunTest(spmiTestPath);
                 }
                 catch (SpmiException ex)
                 {
@@ -762,4 +764,4 @@ namespace SuperPMICollection
         }
     }
 
-}
\ No newline at end of file
+}
index ae12d34..4839b99 100644 (file)
@@ -2,7 +2,6 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <GCStressIncompatible>true</GCStressIncompatible>
-    <CrossGenTest>false</CrossGenTest>
     <!-- This test takes a long time to complete -->
     <UnloadabilityIncompatible>true</UnloadabilityIncompatible>
     <!-- https://github.com/dotnet/coreclr/issues/24633 -->
   <ItemGroup>
     <Compile Include="superpmicollect.cs" />
   </ItemGroup>
-  <!-- TestProjects file contains the relative paths to the test projects that are used by superpmicollect test. -->
+
+  <ItemGroup>
+    <_SpmiTestProjects Include="..\Performance\CodeQuality\Bytemark\Bytemark.csproj" />
+    <_SpmiTestProjects Include="..\Methodical\fp\exgen\10w5d_cs_do.csproj" />
+    <_SpmiTestProjects Update="@(_SpmiTestProjects)">
+      <Properties>OutputPath=$(OutputPath)\%(FileName)</Properties>
+    </_SpmiTestProjects>
+  </ItemGroup>
+
+  <!-- This target builds the executables and test running scripts for the _SpmiTestProjects
+       to the output directory of the current project. -->
+  <Target Name="_BuildSpmiTestProjects" BeforeTargets="Build">
+    <MSBuild Projects="@(_SpmiTestProjects)" />
+  </Target>
+
+  <!-- _SpmiTestNamesFile contains the file names of the _SpmiTestProjects. -->
   <PropertyGroup>
-    <_TestProjectsFileName>TestProjects.txt</_TestProjectsFileName>
+    <_SpmiTestNamesFile>$(IntermediateOutputPath)\SpmiTestNames.txt</_SpmiTestNamesFile>
   </PropertyGroup>
-  <!-- In order to avoid hard-coding of those paths in C# file we embed the file as an assembly resource. -->
+
+  <!-- In order to avoid hard-coding of the _SpmiTestProjects names in a C# file
+       we will write them to a file and embed the file as an assembly resource. -->
+  <Target Name="_WriteSpmiTestNamesToFile" BeforeTargets="ResGen">
+    <ItemGroup>
+      <_SpmiTestNames Include="@(_SpmiTestProjects->'%(FileName)')" />
+    </ItemGroup>
+    <WriteLinesToFile File="$(_SpmiTestNamesFile)" Lines="@(_SpmiTestNames)" Overwrite="True" />
+  </Target>
+
   <ItemGroup>
-    <EmbeddedResource Include="$(_TestProjectsFileName)">
-      <LogicalName>TestProjects</LogicalName>
+    <EmbeddedResource Include="$(_SpmiTestNamesFile)">
+      <LogicalName>SpmiTestNames</LogicalName>
     </EmbeddedResource>
   </ItemGroup>
-  <!-- This target builds the executables and test running scripts for the TestProjects to output directory of the current project. -->
-  <Target Name="_BuildTestProjects" AfterTargets="Build">
-    <ReadLinesFromFile File="$(_TestProjectsFileName)">
-      <Output TaskParameter="Lines" ItemName="_TestProjectsToBuild" />
-    </ReadLinesFromFile>
-    <MSBuild Projects="@(_TestProjectsToBuild)" Properties="OutputPath=$(OutputPath)" />
-  </Target>
 </Project>