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

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJb Evain <jb@evain.net>2019-01-28 04:04:32 +0300
committerJb Evain <jb@evain.net>2019-02-12 01:38:44 +0300
commit9dfb50a60d56ba2b6c980079b630ba3ca15b248b (patch)
tree83a9430d3c975d87a2a1edfb81bf2fa6aa91fbbf /Test/Mono.Cecil.Tests
parentbf0f60c270946f5a313271bbdd40126f82f4b927 (diff)
Fix tests on dotnet core / macos
Diffstat (limited to 'Test/Mono.Cecil.Tests')
-rw-r--r--Test/Mono.Cecil.Tests/BaseTestFixture.cs12
-rw-r--r--Test/Mono.Cecil.Tests/CompilationService.cs10
-rw-r--r--Test/Mono.Cecil.Tests/CustomAttributesTests.cs2
-rw-r--r--Test/Mono.Cecil.Tests/MethodBodyTests.cs2
-rw-r--r--Test/Mono.Cecil.Tests/ModuleTests.cs8
-rw-r--r--Test/Mono.Cecil.Tests/SymbolTests.cs4
6 files changed, 28 insertions, 10 deletions
diff --git a/Test/Mono.Cecil.Tests/BaseTestFixture.cs b/Test/Mono.Cecil.Tests/BaseTestFixture.cs
index f349866..cdaf463 100644
--- a/Test/Mono.Cecil.Tests/BaseTestFixture.cs
+++ b/Test/Mono.Cecil.Tests/BaseTestFixture.cs
@@ -29,6 +29,18 @@ namespace Mono.Cecil.Tests {
Assert.Ignore ();
}
+ protected static void IgnoreOnCoreClr ()
+ {
+ if (Platform.OnCoreClr)
+ Assert.Ignore ();
+ }
+
+ protected static void OnlyOnWindows ()
+ {
+ if (!Platform.OnWindows)
+ Assert.Ignore ();
+ }
+
public static string GetResourcePath (string name, string sourceFilePath)
{
return Path.Combine (FindResourcesDirectory (sourceFilePath), name);
diff --git a/Test/Mono.Cecil.Tests/CompilationService.cs b/Test/Mono.Cecil.Tests/CompilationService.cs
index 25e42ab..681db51 100644
--- a/Test/Mono.Cecil.Tests/CompilationService.cs
+++ b/Test/Mono.Cecil.Tests/CompilationService.cs
@@ -36,6 +36,14 @@ namespace Mono.Cecil.Tests {
get { return TryGetType ("System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") != null; }
}
+ public static bool OnWindows {
+ get { return Environment.OSVersion.Platform == PlatformID.Win32NT; }
+ }
+
+ public static bool HasNativePdbSupport {
+ get { return OnWindows && !OnMono; }
+ }
+
static Type TryGetType (string assemblyQualifiedName)
{
try {
@@ -311,7 +319,7 @@ namespace Mono.Cecil.Tests {
public static ProcessOutput ILAsm (string source, string output)
{
var ilasm = "ilasm";
- if (!Platform.OnMono)
+ if (Platform.OnWindows)
ilasm = NetFrameworkTool ("ilasm");
return RunProcess (ilasm, "/nologo", "/dll", "/out:" + Quote (output), Quote (source));
diff --git a/Test/Mono.Cecil.Tests/CustomAttributesTests.cs b/Test/Mono.Cecil.Tests/CustomAttributesTests.cs
index 970b3aa..cb8a0fb 100644
--- a/Test/Mono.Cecil.Tests/CustomAttributesTests.cs
+++ b/Test/Mono.Cecil.Tests/CustomAttributesTests.cs
@@ -437,7 +437,7 @@ namespace Mono.Cecil.Tests {
[Test]
public void InterfaceImplementation ()
{
- IgnoreOnMono();
+ OnlyOnWindows (); // Mono's ilasm doesn't support .interfaceimpl
TestIL ("ca-iface-impl.il", module => {
var type = module.GetType ("FooType");
diff --git a/Test/Mono.Cecil.Tests/MethodBodyTests.cs b/Test/Mono.Cecil.Tests/MethodBodyTests.cs
index 15fd5fb..5af097b 100644
--- a/Test/Mono.Cecil.Tests/MethodBodyTests.cs
+++ b/Test/Mono.Cecil.Tests/MethodBodyTests.cs
@@ -284,7 +284,7 @@ namespace Mono.Cecil.Tests {
[Test]
public void BranchOutsideMethod ()
{
- IgnoreOnMono ();
+ OnlyOnWindows (); // Mono's ilasm doesn't support branching outside of method
TestIL ("branch-out.il", module => {
var type = module.GetType ("Foo");
diff --git a/Test/Mono.Cecil.Tests/ModuleTests.cs b/Test/Mono.Cecil.Tests/ModuleTests.cs
index 218ccd7..4e10702 100644
--- a/Test/Mono.Cecil.Tests/ModuleTests.cs
+++ b/Test/Mono.Cecil.Tests/ModuleTests.cs
@@ -49,8 +49,7 @@ namespace Mono.Cecil.Tests {
[Test]
public void MultiModules ()
{
- if (Platform.OnCoreClr)
- return;
+ IgnoreOnCoreClr ();
TestModule("mma.exe", module => {
var assembly = module.Assembly;
@@ -160,8 +159,7 @@ namespace Mono.Cecil.Tests {
[Test]
public void ExportedTypeFromNetModule ()
{
- if (Platform.OnCoreClr)
- return;
+ IgnoreOnCoreClr ();
TestModule ("mma.exe", module => {
Assert.IsTrue (module.HasExportedTypes);
@@ -215,6 +213,8 @@ namespace Mono.Cecil.Tests {
[Test]
public void Win32FileVersion ()
{
+ IgnoreOnCoreClr ();
+
TestModule ("libhello.dll", module => {
var version = FileVersionInfo.GetVersionInfo (module.FileName);
diff --git a/Test/Mono.Cecil.Tests/SymbolTests.cs b/Test/Mono.Cecil.Tests/SymbolTests.cs
index b453bcc..c8889a1 100644
--- a/Test/Mono.Cecil.Tests/SymbolTests.cs
+++ b/Test/Mono.Cecil.Tests/SymbolTests.cs
@@ -16,12 +16,10 @@ namespace Mono.Cecil.Tests {
[Test]
public void DefaultPdb ()
{
- IgnoreOnMono ();
-
TestModule ("libpdb.dll", module => {
Assert.IsTrue (module.HasSymbols);
Assert.AreEqual (typeof (NativePdbReader), module.SymbolReader.GetType ());
- }, symbolReaderProvider: typeof (DefaultSymbolReaderProvider), symbolWriterProvider: typeof (DefaultSymbolWriterProvider));
+ }, readOnly: !Platform.HasNativePdbSupport, symbolReaderProvider: typeof (DefaultSymbolReaderProvider), symbolWriterProvider: typeof (DefaultSymbolWriterProvider));
}
[Test]