Merge pull request #13 from CosmosOS/master

Update
This commit is contained in:
MyvarHD 2015-07-23 17:43:49 +02:00
commit ec0fbc1bc0
6 changed files with 45 additions and 14 deletions

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
namespace Cosmos.TestRunner.Core namespace Cosmos.TestRunner.Core
{ {
@ -14,17 +15,28 @@ namespace Cosmos.TestRunner.Core
engine.AllowedSecondsInKernel = 120; engine.AllowedSecondsInKernel = 120;
// If you want to exclude a testing platform, modify uncomment and modify the following line // If you want to exclude a testing platform, modify uncomment and modify the following line
engine.RunTargets.Remove(RunTargetEnum.Bochs); engine.RunTargets.Remove(RunTargetEnum.VMware);
// if you're working on the compiler (or other lower parts), you can choose to run the compiler in process // if you're working on the compiler (or other lower parts), you can choose to run the compiler in process
// 1 thing to keep in mind though, is that this only works with 1 kernel at a time! // 1 thing to keep in mind though, is that this only works with 1 kernel at a time!
engine.RunIL2CPUInProcess = true; engine.RunIL2CPUInProcess = false;
engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location); engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
//engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location); engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location); engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
// known bugs, therefor disabled for now: // known bugs, therefor disabled for now:
// end of known bugs
// double check: this check is in the engine, but lets put it here as well
if (engine.RunIL2CPUInProcess)
{
if (engine.KernelsToRun.Count() > 1)
{
throw new InvalidOperationException("Can only run 1 kernel if IL2CPU is ran in-process!");
}
}
} }
} }
} }

View file

@ -31,6 +31,11 @@ namespace Cosmos.TestRunner.Core
} }
} }
private void RunExtractMapFromElfFile(string workingDir, string kernelFileName)
{
ExtractMapFromElfFile.RunObjDump(CosmosPaths.Build, workingDir, kernelFileName, OutputHandler.LogError, OutputHandler.LogMessage);
}
private void RunIL2CPU(string kernelFileName, string outputFile) private void RunIL2CPU(string kernelFileName, string outputFile)
{ {
var xArguments = new[] var xArguments = new[]

View file

@ -35,6 +35,7 @@ namespace Cosmos.TestRunner.Core
File.Move(xObjectFile, xTempObjectFile); File.Move(xObjectFile, xTempObjectFile);
RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile)); RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile));
RunTask("ExtractMapFromElfFile", () => RunExtractMapFromElfFile(mBaseWorkingDirectory, xObjectFile));
} }
RunTask("MakeISO", () => MakeIso(xObjectFile, xIsoFile)); RunTask("MakeISO", () => MakeIso(xObjectFile, xIsoFile));

View file

@ -14,6 +14,14 @@ namespace Cosmos.TestRunner.Core
// configuration: in process eases debugging, but means certain errors (like stack overflow) kill the test runner. // configuration: in process eases debugging, but means certain errors (like stack overflow) kill the test runner.
public bool RunIL2CPUInProcess = false; public bool RunIL2CPUInProcess = false;
public IEnumerable<string> KernelsToRun
{
get
{
return mKernelsToRun;
}
}
private List<string> mKernelsToRun = new List<string>(); private List<string> mKernelsToRun = new List<string>();
public void AddKernel(string assemblyFile) public void AddKernel(string assemblyFile)
{ {

View file

@ -26,7 +26,7 @@ namespace Cosmos.Build.MSBuild {
{ {
// Important! A given address can have more than one label. // Important! A given address can have more than one label.
// Do NOT filter by duplicate addresses as this causes serious lookup problems. // Do NOT filter by duplicate addresses as this causes serious lookup problems.
string xFile = RunObjDump(); string xFile = RunObjDump(CosmosBuildDir, WorkingDir, InputFile, s => LogError(s), s => Log.LogMessage(s));
ObjDump.ExtractMapSymbolsForElfFile(DebugInfoFile, xFile); ObjDump.ExtractMapSymbolsForElfFile(DebugInfoFile, xFile);
@ -44,18 +44,19 @@ namespace Cosmos.Build.MSBuild {
} }
} }
private string RunObjDump() { public static string RunObjDump(string cosmosBuildDir, string workingDir, string inputFile, Action<string> errorReceived, Action<string> outputReceived) {
var xMapFile = Path.ChangeExtension(InputFile, "map"); var xMapFile = Path.ChangeExtension(inputFile, "map");
File.Delete(xMapFile); File.Delete(xMapFile);
if (File.Exists(xMapFile)) { if (File.Exists(xMapFile)) {
throw new Exception("Could not delete " + xMapFile); throw new Exception("Could not delete " + xMapFile);
} }
var xTempBatFile = Path.Combine(WorkingDir, "ExtractElfMap.bat"); var xTempBatFile = Path.Combine(workingDir, "ExtractElfMap.bat");
File.WriteAllText(xTempBatFile, "@ECHO OFF\r\n\"" + Path.Combine(CosmosBuildDir, @"tools\cygwin\objdump.exe") + "\" --wide --syms \"" + InputFile + "\" > \"" + Path.GetFileName(xMapFile) + "\""); File.WriteAllText(xTempBatFile, "@ECHO OFF\r\n\"" + Path.Combine(cosmosBuildDir, @"tools\cygwin\objdump.exe") + "\" --wide --syms \"" + inputFile + "\" > \"" + Path.GetFileName(xMapFile) + "\"");
if (!ExecuteTool(WorkingDir, xTempBatFile, "", "objdump")) { var xResult = ExecuteTool(workingDir, xTempBatFile, "", "objdump", errorReceived, outputReceived);
throw new Exception("Error extracting map from " + InputFile); if (!xResult) {
throw new Exception("Error extracting map from " + inputFile);
} }
File.Delete(xTempBatFile); File.Delete(xTempBatFile);

View file

@ -235,7 +235,11 @@ namespace Cosmos.IL2CPU.ILOpCodes {
{ {
return; return;
} }
throw new Exception("Wrong Poptype encountered! (Type = " + StackPopTypes[0].FullName + ")"); if (StackPopTypes[0] == Value.DeclaringType)
{
return;
}
throw new Exception("Wrong Poptype encountered! (Type = " + StackPopTypes[0].FullName + ", expected = " + Value.DeclaringType.FullName + ")");
} }
} }
} }