Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-09-07 20:39:28 +0300
committerGitHub <noreply@github.com>2018-09-07 20:39:28 +0300
commit572f4e6d6e52a9ea8931f714f797ce5d311a4f8a (patch)
treec16a2211e0a9a497ac130956a5bbe6f2aa718fee
parenta59cf6889680bb7e5fe40cc654912be160ca3320 (diff)
Enable building and running ILVerification tests by default (#6307)
-rw-r--r--src/ILVerification/tests/ILTests/AccessTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ArrayTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/BranchingTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/CallTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/CastingTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ComparisonTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/DelegateTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/FieldTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/FtnTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ILTests.targets17
-rw-r--r--src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/NewobjTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/PrefixTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ReturnTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ShiftTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ThisStateTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ValueTypeTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILVerification.Tests.csproj7
-rw-r--r--src/ILVerification/tests/TestDataLoader.cs18
-rw-r--r--src/ILVerify/README.md12
-rw-r--r--src/dirs.proj6
25 files changed, 94 insertions, 26 deletions
diff --git a/src/ILVerification/tests/ILTests/AccessTests.ilproj b/src/ILVerification/tests/ILTests/AccessTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj b/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj b/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ArrayTests.ilproj b/src/ILVerification/tests/ILTests/ArrayTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ArrayTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj b/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/BranchingTests.ilproj b/src/ILVerification/tests/ILTests/BranchingTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/BranchingTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/CallTests.ilproj b/src/ILVerification/tests/ILTests/CallTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/CallTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/CastingTests.ilproj b/src/ILVerification/tests/ILTests/CastingTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/CastingTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ComparisonTests.ilproj b/src/ILVerification/tests/ILTests/ComparisonTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ComparisonTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/DelegateTests.ilproj b/src/ILVerification/tests/ILTests/DelegateTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/DelegateTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj b/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/FieldTests.ilproj b/src/ILVerification/tests/ILTests/FieldTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/FieldTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/FtnTests.ilproj b/src/ILVerification/tests/ILTests/FtnTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/FtnTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ILTests.targets b/src/ILVerification/tests/ILTests/ILTests.targets
new file mode 100644
index 000000000..22983bd3a
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ILTests.targets
@@ -0,0 +1,17 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <OutputPath>$(BaseOutputPath)$(OSPlatformConfig)/ILVerification.Tests/Tests</OutputPath>
+ <SkipTestRun>true</SkipTestRun>
+ <SkipSigning>true</SkipSigning>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj b/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/NewobjTests.ilproj b/src/ILVerification/tests/ILTests/NewobjTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/NewobjTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/PrefixTests.ilproj b/src/ILVerification/tests/ILTests/PrefixTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/PrefixTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ReturnTests.ilproj b/src/ILVerification/tests/ILTests/ReturnTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ReturnTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ShiftTests.ilproj b/src/ILVerification/tests/ILTests/ShiftTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ShiftTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ThisStateTests.ilproj b/src/ILVerification/tests/ILTests/ThisStateTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ThisStateTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj b/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILVerification.Tests.csproj b/src/ILVerification/tests/ILVerification.Tests.csproj
index 5fe81b129..237655ccc 100644
--- a/src/ILVerification/tests/ILVerification.Tests.csproj
+++ b/src/ILVerification/tests/ILVerification.Tests.csproj
@@ -23,6 +23,13 @@
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="ILTests\*.ilproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <OutputItemType>Content</OutputItemType>
+ </ProjectReference>
+ </ItemGroup>
+
+ <ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
diff --git a/src/ILVerification/tests/TestDataLoader.cs b/src/ILVerification/tests/TestDataLoader.cs
index a91132b91..4184a5f6f 100644
--- a/src/ILVerification/tests/TestDataLoader.cs
+++ b/src/ILVerification/tests/TestDataLoader.cs
@@ -20,19 +20,17 @@ namespace ILVerification.Tests
{
/// <summary>
/// Parses the methods in the test assemblies.
- /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TESTASSEMBLYPATH</code>
+ /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TestAssemblyPath</code>
/// This class feeds the xunit Theories
/// </summary>
class TestDataLoader
{
/// <summary>
- /// The folder with the binaries which are compiled from the test driver IL Code
- /// Currently the test .il code is built manually, but the plan is to have a ProjectReference and automatically build the .il files.
- /// See: https://github.com/dotnet/corert/pull/3725#discussion_r118820770
+ /// The folder with the test binaries
/// </summary>
- public static string TESTASSEMBLYPATH = @"..\..\..\ILTests\";
+ private const string TestAssemblyPath = @"Tests\";
- private const string SPECIALTEST_PREFIX = "special.";
+ private const string SpecialTestPrefix = "special.";
/// <summary>
/// Returns all methods that contain valid IL code based on the following naming convention:
@@ -129,11 +127,11 @@ namespace ILVerification.Tests
private static MethodDefinitionHandle HandleSpecialTests(string[] methodParams, EcmaMethod method)
{
- if (!methodParams[0].StartsWith(SPECIALTEST_PREFIX))
+ if (!methodParams[0].StartsWith(SpecialTestPrefix))
return method.Handle;
// Cut off special prefix
- var specialParams = methodParams[0].Substring(SPECIALTEST_PREFIX.Length);
+ var specialParams = methodParams[0].Substring(SpecialTestPrefix.Length);
// Get friendly name / special name
int delimiter = specialParams.IndexOf('.');
@@ -152,7 +150,7 @@ namespace ILVerification.Tests
private static IEnumerable<string> GetAllTestDlls()
{
- foreach (var item in Directory.GetFiles(TESTASSEMBLYPATH))
+ foreach (var item in Directory.GetFiles(TestAssemblyPath))
{
if (item.ToLower().EndsWith(".dll"))
{
@@ -167,7 +165,7 @@ namespace ILVerification.Tests
foreach (var fileName in GetAllTestDlls())
{
- simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TESTASSEMBLYPATH + fileName);
+ simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TestAssemblyPath + fileName);
}
Assembly coreAssembly = typeof(object).GetTypeInfo().Assembly;
diff --git a/src/ILVerify/README.md b/src/ILVerify/README.md
index 60aa79f48..286c70d50 100644
--- a/src/ILVerify/README.md
+++ b/src/ILVerify/README.md
@@ -27,18 +27,6 @@ The code is split into three projects:
To test the ILVerification library we have small methods checked in as .il files testing specific verification scenarios. These tests live under [src/ILVerification/tests/ILTests](../ILVerification/tests/ILTests). Tests are grouped into .il files based on functionalities they test. There is no strict policy here, the goal is to have a few dozen .il files instead of thousands containing each only a single method.
-Currently the IL files are NOT compiled automatically. You have to compile manually (We want to automate this step later):
-
-```
-ilasm [filename.il] /dll /ERROR
-```
-
-Note: if you run the tests and get an error similar to this then it means that the .il files were not compiled, or none of them contained methods that follow the naming convention described below:
-
-```
-Result Message: System.InvalidOperationException : No data found for ILVerify.Tests.ILMethodTester.TestMethodsWithInvalidIL
-```
-
The test project itself is under [src/ILVerification/tests](../ILVerification/tests)
Method names in the .il files must follow the following naming convention:
diff --git a/src/dirs.proj b/src/dirs.proj
index 2051b84e4..a0ab1b264 100644
--- a/src/dirs.proj
+++ b/src/dirs.proj
@@ -2,12 +2,10 @@
<Import Project="dir.props" />
<ItemGroup>
- <!-- This project requires ILASM and we have access to that only on Windows -->
+ <!-- These projects requires ILASM and we have access to that only on Windows -->
<ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\TypeSystem.Tests.csproj" />
<ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\ILCompiler.MetadataTransform.Tests.csproj" />
-
- <!-- This project required manual build step -->
- <ExcludeProjects Include="**\ILVerification.Tests.csproj" />
+ <ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\ILVerification.Tests.csproj" />
<Project Include="AotPackageReference\AotPackageReference.depproj" />