summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Performance/CodeQuality
diff options
context:
space:
mode:
authorEgor Chesakov <Egor.Chesakov@microsoft.com>2018-12-17 11:11:25 -0800
committerGitHub <noreply@github.com>2018-12-17 11:11:25 -0800
commit7c2d9aa7e35ab119eaf907514fa1ff765317ec11 (patch)
tree5e899b9786176eef0eca6aec0d2b0be11e8a926d /tests/src/JIT/Performance/CodeQuality
parentad561d0dee8345a1a1b6105b44be527970c0b27f (diff)
downloadcoreclr-7c2d9aa7e35ab119eaf907514fa1ff765317ec11.tar.gz
coreclr-7c2d9aa7e35ab119eaf907514fa1ff765317ec11.tar.bz2
coreclr-7c2d9aa7e35ab119eaf907514fa1ff765317ec11.zip
Switch to using resources in BenchmarksGames tests (#21554)
Embed the following test files as the resources in their corresponding test assemblies: * regexdna-input25.txt regexdna-input25000.txt in BenchmarksGame/regex-redux * knucleotide-input.txt knucleotide-input-big.txt in BenchmarksGame/k-nucleotide * revcomp-input25.txt revcomp-input25000.txt in BenchmarksGame/reverse-complement
Diffstat (limited to 'tests/src/JIT/Performance/CodeQuality')
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/harness-helpers.cs71
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.csproj8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs2
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.csproj8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/harness-helpers.cs73
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.cs4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.csproj8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.cs4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.csproj8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/harness-helpers.cs69
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.cs12
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.csproj8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.cs12
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.csproj8
15 files changed, 57 insertions, 246 deletions
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/harness-helpers.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/harness-helpers.cs
index d7b9a5754c..bae16984ac 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/harness-helpers.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/harness-helpers.cs
@@ -7,96 +7,41 @@
using System;
using System.IO;
-using System.Text;
+using System.Reflection;
namespace BenchmarksGame
{
class TestHarnessHelpers
{
- public string InputFile;
public int[] expectedCountLetter;
public int[] expectedCountPairs;
public int[] expectedCountFragments;
public int[][] expectedFrequencies;
+ private readonly string resourceName;
- public TestHarnessHelpers(bool bigInput, [System.Runtime.CompilerServices.CallerFilePath] string csFileName = "")
+ public TestHarnessHelpers(bool bigInput)
{
if (bigInput)
{
- InputFile = FindInputFile("knucleotide-input-big.txt", csFileName);
expectedCountLetter = new int[] { 302923, 301375, 198136, 197566 };
expectedCountPairs = new int[] { 91779, 91253, 91225, 90837, 60096, 60030, 59889, 59795, 59756, 59713, 59572, 59557, 39203, 39190, 39081, 39023 };
expectedCountFragments = new int[] { 11765, 3572, 380, 7, 7 };
+ resourceName = "knucleotide-input-big.txt";
}
else
{
- InputFile = FindInputFile("knucleotide-input.txt", csFileName);
expectedCountLetter = new int[] { 1576, 1480, 974, 970 };
expectedCountPairs = new int[] { 496, 480, 470, 420, 316, 315, 310, 302, 298, 292, 273, 272, 202, 201, 185, 167 };
expectedCountFragments = new int[] { 54, 24, 4, 0, 0 };
+ resourceName = "knucleotide-input.txt";
}
expectedFrequencies = new int[][] { expectedCountLetter, expectedCountPairs };
}
- public string FindInputFile(string inputFile, string csFileName)
+ public Stream GetInputStream()
{
- string CoreRoot = System.Environment.GetEnvironmentVariable("CORE_ROOT");
-
- if (CoreRoot == null)
- {
- Console.WriteLine("This benchmark requries CORE_ROOT to be set");
- return null;
- }
-
- // The convention is that the csproj file has the same name as the cs file.
- string projectName = Path.GetFileNameWithoutExtension(csFileName);
- int slashIndex = projectName.LastIndexOfAny(new char[] { '/', '\\' });
- if (slashIndex != -1)
- {
- // csFileName was generated by the C# compiler, which may have run on
- // a different host system with different path separator than the
- // currently executing host, which dictates GetFileNameWithoutExtension's
- // behavior... so hope that the slash here is a cross-host path separator,
- // and chop of what were likely direcotires.
- projectName = projectName.Substring(slashIndex + 1);
- }
-
- // Normal testing -- input file will end up next to the assembly
- // and CoreRoot points at the test overlay dir
- string[] pathPartsNormal = new string[] {
- CoreRoot, "..", "..", "JIT", "Performance",
- "CodeQuality", "BenchmarksGame", "k-nucleotide", projectName, inputFile
- };
-
- string inputPathNormal = Path.Combine(pathPartsNormal);
-
- // Perf testing -- input file will end up next to the assembly
- // and CoreRoot points at this directory
- string[] pathPartsPerf = new string[] { CoreRoot, inputFile };
-
- string inputPathPerf = Path.Combine(pathPartsPerf);
-
- string inputPath = null;
-
- if (File.Exists(inputPathNormal))
- {
- inputPath = inputPathNormal;
- }
- else if (File.Exists(inputPathPerf))
- {
- inputPath = inputPathPerf;
- }
-
- if (inputPath != null)
- {
- Console.WriteLine("Using input file {0}", inputFile);
- }
- else
- {
- throw new Exception($"Unable to find input file {inputFile}. Tried {inputPathNormal} and {inputPathPerf}; csFileName was {csFileName}, so projectName was {projectName}.");
- }
-
- return inputPath;
+ var assembly = typeof(TestHarnessHelpers).GetTypeInfo().Assembly;
+ return assembly.GetManifestResourceStream(resourceName);
}
}
}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs
index 96d49f702e..449baa2da2 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs
@@ -92,9 +92,9 @@ namespace BenchmarksGame
{
var helpers = new TestHarnessHelpers(bigInput: false);
- using (var inputFile = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
{
- if (!Bench(inputFile, helpers, true))
+ if (!Bench(inputStream, helpers, true))
{
return -1;
}
@@ -111,9 +111,9 @@ namespace BenchmarksGame
Benchmark.Iterate(() =>
{
- using (var inputFile = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
{
- ok &= Bench(inputFile, helpers, false);
+ ok &= Bench(inputStream, helpers, false);
}
});
Assert.True(ok);
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.csproj
index d65aaae57d..f796668987 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="knucleotide-input.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="knucleotide-input-big.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="knucleotide-input.txt" />
+ <EmbeddedResource Include="knucleotide-input-big.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs
index e6dd21243f..0b787bfb79 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs
@@ -291,7 +291,7 @@ namespace BenchmarksGame
tonum['t'] = 3; tonum['T'] = 3;
tonum['\n'] = 255; tonum['>'] = 255; tonum[255] = 255;
- using (var inputStream = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
{
loadThreeData(inputStream);
}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.csproj
index 9e72ba4a0f..e9942d9fe3 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="knucleotide-input.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="knucleotide-input-big.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="knucleotide-input.txt" />
+ <EmbeddedResource Include="knucleotide-input-big.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/harness-helpers.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/harness-helpers.cs
index 25627bad5a..5f8cd95ad1 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/harness-helpers.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/harness-helpers.cs
@@ -7,88 +7,33 @@
using System;
using System.IO;
-using System.Text;
+using System.Reflection;
namespace BenchmarksGame
{
class TestHarnessHelpers
{
- public string InputFile;
- public int ExpectedLength;
+ public readonly int ExpectedLength;
+ private readonly string resourceName;
- public TestHarnessHelpers(bool bigInput, [System.Runtime.CompilerServices.CallerFilePath] string csFileName = "")
+ public TestHarnessHelpers(bool bigInput)
{
if (bigInput)
{
- InputFile = FindInputFile("regexdna-input25000.txt", csFileName);
ExpectedLength = 136381;
+ resourceName = "regexdna-input25000.txt";
}
else
{
- InputFile = FindInputFile("regexdna-input25.txt", csFileName);
ExpectedLength = 152;
+ resourceName = "regexdna-input25.txt";
}
}
- public string FindInputFile(string inputFile, string csFileName)
+ public Stream GetInputStream()
{
- string CoreRoot = System.Environment.GetEnvironmentVariable("CORE_ROOT");
-
- if (CoreRoot == null)
- {
- Console.WriteLine("This benchmark requries CORE_ROOT to be set");
- return null;
- }
-
- // The convention is that the csproj file has the same name as the cs file.
- string projectName = Path.GetFileNameWithoutExtension(csFileName);
- int slashIndex = projectName.LastIndexOfAny(new char[] { '/', '\\' });
- if (slashIndex != -1)
- {
- // csFileName was generated by the C# compiler, which may have run on
- // a different host system with different path separator than the
- // currently executing host, which dictates GetFileNameWithoutExtension's
- // behavior... so hope that the slash here is a cross-host path separator,
- // and chop of what were likely direcotires.
- projectName = projectName.Substring(slashIndex + 1);
- }
-
- // Normal testing -- input file will end up next to the assembly
- // and CoreRoot points at the test overlay dir
- string[] pathPartsNormal = new string[] {
- CoreRoot, "..", "..", "JIT", "Performance",
- "CodeQuality", "BenchmarksGame", "regex-redux", projectName, inputFile
- };
-
- string inputPathNormal = Path.Combine(pathPartsNormal);
-
- // Perf testing -- input file will end up next to the assembly
- // and CoreRoot points at this directory
- string[] pathPartsPerf = new string[] { CoreRoot, inputFile };
-
- string inputPathPerf = Path.Combine(pathPartsPerf);
-
- string inputPath = null;
-
- if (File.Exists(inputPathNormal))
- {
- inputPath = inputPathNormal;
- }
- else if (File.Exists(inputPathPerf))
- {
- inputPath = inputPathPerf;
- }
-
- if (inputPath != null)
- {
- Console.WriteLine("Using input file {0}", inputFile);
- }
- else
- {
- throw new Exception($"Unable to find input file {inputFile}. Tried {inputPathNormal} and {inputPathPerf}; csFileName was {csFileName}, so projectName was {projectName}.");
- }
-
- return inputPath;
+ var assembly = typeof(TestHarnessHelpers).GetTypeInfo().Assembly;
+ return assembly.GetManifestResourceStream(resourceName);
}
}
}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.cs
index 730100284e..12c3529051 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.cs
@@ -31,7 +31,7 @@ namespace BenchmarksGame
{
var helpers = new TestHarnessHelpers(bigInput: false);
- using (var inputStream = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
using (var input = new StreamReader(inputStream))
{
if (Bench(input, true) != helpers.ExpectedLength)
@@ -50,7 +50,7 @@ namespace BenchmarksGame
Benchmark.Iterate(() =>
{
- using (var inputStream = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
using (var input = new StreamReader(inputStream))
{
Assert.Equal(helpers.ExpectedLength, Bench(input, false));
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.csproj
index a2acf1f1fe..326811be49 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-1.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="regexdna-input25.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="regexdna-input25000.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="regexdna-input25.txt" />
+ <EmbeddedResource Include="regexdna-input25000.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.cs
index 8eb5f9ed82..841db0897a 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.cs
@@ -45,7 +45,7 @@ namespace BenchmarksGame
{
var helpers = new TestHarnessHelpers(bigInput: false);
- using (var inputStream = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
using (var input = new StreamReader(inputStream))
{
if (Bench(input, true) != helpers.ExpectedLength)
@@ -64,7 +64,7 @@ namespace BenchmarksGame
Benchmark.Iterate(() =>
{
- using (var inputStream = new FileStream(helpers.InputFile, FileMode.Open))
+ using (var inputStream = helpers.GetInputStream())
using (var input = new StreamReader(inputStream))
{
Assert.Equal(helpers.ExpectedLength, Bench(input, false));
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.csproj
index cd45a0937c..f96f2e8828 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/regex-redux/regex-redux-5.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="regexdna-input25.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="regexdna-input25000.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="regexdna-input25.txt" />
+ <EmbeddedResource Include="regexdna-input25000.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/harness-helpers.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/harness-helpers.cs
index c494982cc9..0024f56843 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/harness-helpers.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/harness-helpers.cs
@@ -7,91 +7,36 @@
using System;
using System.IO;
-using System.Text;
+using System.Reflection;
namespace BenchmarksGame
{
class TestHarnessHelpers
{
- public string InputFile;
public int FileLength;
public string CheckSum;
+ private readonly string resourceName;
public TestHarnessHelpers(bool bigInput, [System.Runtime.CompilerServices.CallerFilePath] string csFileName = "")
{
if (bigInput)
{
- InputFile = FindInputFile("revcomp-input25000.txt", csFileName);
FileLength = 254245;
CheckSum = "61-A4-CC-6D-15-8D-26-77-88-93-4F-E2-29-A2-8D-FB";
+ resourceName = "revcomp-input25000.txt";
}
else
{
- InputFile = FindInputFile("revcomp-input25.txt", csFileName);
FileLength = 333;
CheckSum = "62-45-8E-09-2E-89-A0-69-8C-17-F5-D8-C7-63-5B-50";
+ resourceName = "revcomp-input25.txt";
}
}
- public string FindInputFile(string inputFile, string csFileName)
+ public Stream GetInputStream()
{
- string CoreRoot = System.Environment.GetEnvironmentVariable("CORE_ROOT");
-
- if (CoreRoot == null)
- {
- Console.WriteLine("This benchmark requries CORE_ROOT to be set");
- return null;
- }
-
- // The convention is that the csproj file has the same name as the cs file.
- string projectName = Path.GetFileNameWithoutExtension(csFileName);
- int slashIndex = projectName.LastIndexOfAny(new char[] { '/', '\\' });
- if (slashIndex != -1)
- {
- // csFileName was generated by the C# compiler, which may have run on
- // a different host system with different path separator than the
- // currently executing host, which dictates GetFileNameWithoutExtension's
- // behavior... so hope that the slash here is a cross-host path separator,
- // and chop of what were likely direcotires.
- projectName = projectName.Substring(slashIndex + 1);
- }
-
- // Normal testing -- input file will end up next to the assembly
- // and CoreRoot points at the test overlay dir
- string[] pathPartsNormal = new string[] {
- CoreRoot, "..", "..", "JIT", "Performance",
- "CodeQuality", "BenchmarksGame", "reverse-complement", projectName, inputFile
- };
-
- string inputPathNormal = Path.Combine(pathPartsNormal);
-
- // Perf testing -- input file will end up next to the assembly
- // and CoreRoot points at this directory
- string[] pathPartsPerf = new string[] { CoreRoot, inputFile };
-
- string inputPathPerf = Path.Combine(pathPartsPerf);
-
- string inputPath = null;
-
- if (File.Exists(inputPathNormal))
- {
- inputPath = inputPathNormal;
- }
- else if (File.Exists(inputPathPerf))
- {
- inputPath = inputPathPerf;
- }
-
- if (inputPath != null)
- {
- Console.WriteLine("Using input file {0}", inputFile);
- }
- else
- {
- throw new Exception($"Unable to find input file {inputFile}. Tried {inputPathNormal} and {inputPathPerf}; csFileName was {csFileName}, so projectName was {projectName}.");
- }
-
- return inputPath;
+ var assembly = typeof(TestHarnessHelpers).GetTypeInfo().Assembly;
+ return assembly.GetManifestResourceStream(resourceName);
}
}
}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.cs
index 902aee39ce..edf405d9fa 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.cs
@@ -53,10 +53,10 @@ namespace BenchmarksGame
{
var helpers = new TestHarnessHelpers(bigInput: false);
var outBytes = new byte[helpers.FileLength];
- using (var input = new FileStream(helpers.InputFile, FileMode.Open))
- using (var output = new MemoryStream(outBytes))
+ using (var inputStream = helpers.GetInputStream())
+ using (var outputStream = new MemoryStream(outBytes))
{
- Bench(input, output);
+ Bench(inputStream, outputStream);
}
Console.WriteLine(System.Text.Encoding.UTF8.GetString(outBytes));
if (!MatchesChecksum(outBytes, helpers.CheckSum))
@@ -74,10 +74,10 @@ namespace BenchmarksGame
Benchmark.Iterate(() =>
{
- using (var input = new FileStream(helpers.InputFile, FileMode.Open))
- using (var output = new MemoryStream(outBytes))
+ using (var inputStream = helpers.GetInputStream())
+ using (var outputStream = new MemoryStream(outBytes))
{
- Bench(input, output);
+ Bench(inputStream, outputStream);
}
});
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.csproj
index 5e0c567553..756177fcad 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-1.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="revcomp-input25.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="revcomp-input25000.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="revcomp-input25.txt" />
+ <EmbeddedResource Include="revcomp-input25000.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.cs
index 70d84d4f90..4ce5634869 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.cs
@@ -236,10 +236,10 @@ namespace BenchmarksGame
{
var helpers = new TestHarnessHelpers(bigInput: false);
var outBytes = new byte[helpers.FileLength];
- using (var input = new FileStream(helpers.InputFile, FileMode.Open))
- using (var output = new MemoryStream(outBytes))
+ using (var inputStream = helpers.GetInputStream())
+ using (var outputStream = new MemoryStream(outBytes))
{
- Bench(input, output);
+ Bench(inputStream, outputStream);
}
Console.WriteLine(System.Text.Encoding.UTF8.GetString(outBytes));
if (!MatchesChecksum(outBytes, helpers.CheckSum))
@@ -257,10 +257,10 @@ namespace BenchmarksGame
Benchmark.Iterate(() =>
{
- var input = new FileStream(helpers.InputFile, FileMode.Open);
- var output = new MemoryStream(outBytes);
+ using (var inputStream = helpers.GetInputStream())
+ using (var outputStream = new MemoryStream(outBytes))
{
- Bench(input, output);
+ Bench(inputStream, outputStream);
}
});
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.csproj b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.csproj
index b1be51cf12..f15f473009 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.csproj
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/reverse-complement-6.csproj
@@ -34,12 +34,8 @@
<Compile Include="harness-helpers.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="revcomp-input25.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="revcomp-input25000.txt">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
+ <EmbeddedResource Include="revcomp-input25.txt" />
+ <EmbeddedResource Include="revcomp-input25000.txt" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>