Browse Source

Add unit test that checks that SharpDevelop.exe, BuildWorker.exe and booc.exe all use the same value for the 32-bit-flag.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3588 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
0a42c419c3
  1. 63
      src/Main/Base/Test/CheckAssemblyFlags.cs
  2. 1
      src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

63
src/Main/Base/Test/CheckAssemblyFlags.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Util;
using NUnit.Framework;
using System.Text.RegularExpressions;
namespace ICSharpCode.SharpDevelop.Tests
{
[TestFixture]
public class CheckAssemblyFlags
{
string binPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..");
bool Get32BitFlags(string assembly)
{
assembly = Path.Combine(binPath, assembly);
string corflags = FileUtility.GetSdkPath("corflags.exe");
Assert.IsNotNull(corflags, "corflags.exe not found, this test requires the .NET SDK!");
ProcessRunner pr = new ProcessRunner();
Console.WriteLine(corflags + " " + assembly);
pr.Start(corflags, assembly);
if (!pr.WaitForExit(5000)) {
pr.Kill();
throw new InvalidOperationException("Timeout running corflags");
} else {
Console.WriteLine(pr.StandardOutput);
Match m = Regex.Match(pr.StandardOutput, @"32BIT\s*:\s*([01])");
if (m.Success) {
return m.Groups[1].Value == "1";
} else {
throw new InvalidOperationException("Invalid corflags output");
}
}
}
// All these processes must use the same value for 32-bit-flag:
[Test]
public void CheckSharpDevelop32Bit()
{
Assert.IsTrue(Get32BitFlags("SharpDevelop.exe"));
}
[Test]
public void CheckBuildWorker32Bit()
{
Assert.IsTrue(Get32BitFlags("ICSharpCode.SharpDevelop.BuildWorker.exe"));
}
[Test]
public void CheckBooCompiler32Bit()
{
Assert.IsTrue(Get32BitFlags(@"..\src\AddIns\BackendBindings\Boo\RequiredLibraries\booc.exe"));
}
}
}

1
src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
<ItemGroup>
<Compile Include="AbstractEntityIsOverridableTestFixture.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="CheckAssemblyFlags.cs" />
<Compile Include="CodeConverterTests.cs" />
<Compile Include="CSharpExpressionFinderTests.cs" />
<Compile Include="ExceptionClassOverridesTestFixture.cs" />

Loading…
Cancel
Save