diff options
author | Egor Chesakov <Egor.Chesakov@microsoft.com> | 2019-01-11 14:45:25 -0800 |
---|---|---|
committer | Egor Chesakov <Egor.Chesakov@microsoft.com> | 2019-01-16 09:07:25 -0800 |
commit | 81e110d5557e5aa3cc21a9d8c32114bfa2ed0836 (patch) | |
tree | dd70cd59331cce9fd6b9f88d6e7ec5c18137e9ed | |
parent | 6515cf8e1a3027cd81c6eb2a9307ca7259b46730 (diff) | |
download | coreclr-81e110d5557e5aa3cc21a9d8c32114bfa2ed0836.tar.gz coreclr-81e110d5557e5aa3cc21a9d8c32114bfa2ed0836.tar.bz2 coreclr-81e110d5557e5aa3cc21a9d8c32114bfa2ed0836.zip |
Make JIT\superpmi\superpmicollect compatible with Helix
Related issue: https://github.com/dotnet/coreclr/issues/21698
-rw-r--r-- | tests/issues.targets | 15 | ||||
-rw-r--r-- | tests/src/JIT/superpmi/TestProjects.txt | 3 | ||||
-rw-r--r-- | tests/src/JIT/superpmi/superpmicollect.cs | 40 | ||||
-rw-r--r-- | tests/src/JIT/superpmi/superpmicollect.csproj | 26 |
4 files changed, 46 insertions, 38 deletions
diff --git a/tests/issues.targets b/tests/issues.targets index 5df62e4ded..e6b6203546 100644 --- a/tests/issues.targets +++ b/tests/issues.targets @@ -780,9 +780,6 @@ <!-- The following are tests that fail when building tests against packages --> <ItemGroup Condition="'$(XunitTestBinBase)' != '' and '$(BuildTestsAgainstPackages)' == 'true'"> - <ExcludeList Include="$(XunitTestBinBase)/JIT/superpmi/superpmicollect/*"> - <Issue>needs triage</Issue> - </ExcludeList> <ExcludeList Include="$(XunitTestBinBase)/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1/k-nucleotide-1*"> <Issue>9314</Issue> </ExcludeList> @@ -2112,5 +2109,15 @@ <Issue>Bug</Issue> </ExcludeList> </ItemGroup> - + + <!-- runtest.proj finds all the *.cmd/*.sh scripts in a test folder and creates corresponding test methods. + Exclude these scripts to avoid creating such methods for the superpmicollect dependent test projects + and running them separately from superpmicollect test. --> + + <ItemGroup Condition="'$(XunitTestBinBase)' != ''"> + <ExcludeList Include="$(XunitTestBinBase)/JIT/superpmi/superpmicollect/*" Exclude="$(XunitTestBinBase)/JIT/superpmi/superpmicollect/superpmicollect.*"> + <Issue>Do not run these scripts separately from superpmicollect test</Issue> + </ExcludeList> + </ItemGroup> + </Project> diff --git a/tests/src/JIT/superpmi/TestProjects.txt b/tests/src/JIT/superpmi/TestProjects.txt new file mode 100644 index 0000000000..fd29fd9c69 --- /dev/null +++ b/tests/src/JIT/superpmi/TestProjects.txt @@ -0,0 +1,3 @@ +..\Performance\CodeQuality\Bytemark\Bytemark.csproj +..\Methodical\fp\exgen\10w5d_cs_do.csproj +..\Generics\Coverage\chaos65204782cs.csproj
\ No newline at end of file diff --git a/tests/src/JIT/superpmi/superpmicollect.cs b/tests/src/JIT/superpmi/superpmicollect.cs index 8faec4c00c..7732dc7319 100644 --- a/tests/src/JIT/superpmi/superpmicollect.cs +++ b/tests/src/JIT/superpmi/superpmicollect.cs @@ -3,8 +3,10 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; using System.IO; using System.Diagnostics; +using System.Reflection; using System.Runtime.InteropServices; namespace SuperPMICollection @@ -251,41 +253,27 @@ namespace SuperPMICollection // Run all the programs from the CoreCLR test binary drop we wish to run while collecting MC files. private static void RunTestProgramsWhileCollecting() { - // The list of all programs from the CoreCLR repo test binary drop that - // we should run when doing the SuperPMI collection. This is currently a - // hard-coded list of the relative paths within the test build binaries - // directory of the Windows .cmd files used to run a test. For non-Windows - // platforms, the .cmd is replaced by .sh, and the path separator character - // is changed. - // - // TODO: this should probably be loaded dynamically from a .json/.xml file. - // // 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. - string[] SuperPMICollectionTestProgramsList = - { - @"JIT\Performance\CodeQuality\Bytemark\Bytemark\Bytemark.cmd", - @"JIT\Methodical\fp\exgen\10w5d_cs_do\10w5d_cs_do.cmd", - @"JIT\Generics\Coverage\chaos56200037cs\chaos56200037cs.cmd" - }; + var superPMICollectionTestProgramsList = new List<string>(); - // Figure out the root of the test binaries directory. - // Perhaps this (or something similar) would be a better way to figure out the binary root dir: - // testBinaryRootDir = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); - - string thisTestDir = Directory.GetCurrentDirectory(); - int lastIndex = thisTestDir.LastIndexOf("JIT"); - if (lastIndex == -1) + using (var resourceStream = typeof(SuperPMICollectionClass).GetTypeInfo().Assembly.GetManifestResourceStream("TestProjects")) + using (var streamReader = new StreamReader(resourceStream)) { - throw new SpmiException("we expect the current directory when the test is run to be within the JIT test binaries tree, but it is not: " + thisTestDir); + string currentDirectory = Directory.GetCurrentDirectory(); + string csprojRelativePath; + while ((csprojRelativePath = streamReader.ReadLine()) != null) + { + string cmdFileName = Path.ChangeExtension(Path.GetFileName(csprojRelativePath), ".cmd"); + cmdFileName = Path.Combine(currentDirectory, cmdFileName); + superPMICollectionTestProgramsList.Add(cmdFileName); + } } - string testBinaryRootDir = thisTestDir.Substring(0, lastIndex); // Run the tests - foreach (string test in SuperPMICollectionTestProgramsList) + foreach (string testFullPath in superPMICollectionTestProgramsList) { - string testFullPath = Path.Combine(testBinaryRootDir, test); try { RunTest(testFullPath); diff --git a/tests/src/JIT/superpmi/superpmicollect.csproj b/tests/src/JIT/superpmi/superpmicollect.csproj index f9e8bb1313..591bb9b39c 100644 --- a/tests/src/JIT/superpmi/superpmicollect.csproj +++ b/tests/src/JIT/superpmi/superpmicollect.csproj @@ -29,17 +29,27 @@ <ItemGroup> <Compile Include="superpmicollect.cs" /> </ItemGroup> - - <!-- Add project references to those tests that we run as part of the test --> - <!-- Don't do this now; it simply builds and copies these EXE/PDB, but not the .cmd/.sh, which we use. - <ProjectReference Include="..\Performance\CodeQuality\Roslyn\CscBench.csproj" /> - <ProjectReference Include="..\Methodical\fp\exgen\10w5d_cs_do.csproj" /> - <ProjectReference Include="..\Generics\Coverage\chaos65204782cs.csproj" /> - --> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> + </PropertyGroup> + <!-- TestProjects file contains the relative paths to the test projects that are used by superpmicollect test. --> + <PropertyGroup> + <_TestProjectsFileName>TestProjects.txt</_TestProjectsFileName> + </PropertyGroup> + <!-- In order to avoid hard-coding of those paths in C# file we embed the file as an assembly resource. --> + <ItemGroup> + <EmbeddedResource Include="$(_TestProjectsFileName)"> + <LogicalName>TestProjects</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> |