Browse Source

Fixed some tests under OS X by auto detecting the Mono bitness.

pull/547/head
João Matos 10 years ago
parent
commit
5ff8efa085
  1. 22
      src/Generator.Tests/GeneratorTest.cs

22
src/Generator.Tests/GeneratorTest.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
@ -42,6 +43,9 @@ namespace CppSharp.Utils @@ -42,6 +43,9 @@ namespace CppSharp.Utils
if (!Platform.IsMono)
options.SharedLibraryName += ".dll";
if (Platform.IsMacOS)
options.TargetTriple = Is32bitMono() ? "i686-apple-darwin" : "x86_64-apple-darwin";
var path = Path.GetFullPath(GetTestsDirectory(name));
options.addIncludeDirs(path);
@ -117,6 +121,24 @@ namespace CppSharp.Utils @@ -117,6 +121,24 @@ namespace CppSharp.Utils
throw new Exception("Could not find tests output directory");
}
static bool Is32bitMono()
{
var process = new Process();
process.StartInfo.FileName = "mono";
process.StartInfo.Arguments = "--version";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
var output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return output.Contains("x86");
}
#endregion
}

Loading…
Cancel
Save