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.Linq;
namespace Cosmos.TestRunner.Core
{
@ -14,17 +15,28 @@ namespace Cosmos.TestRunner.Core
engine.AllowedSecondsInKernel = 120;
// 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
// 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(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
// 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)
{
var xArguments = new[]

View file

@ -35,6 +35,7 @@ namespace Cosmos.TestRunner.Core
File.Move(xObjectFile, xTempObjectFile);
RunTask("Ld", () => RunLd(xTempObjectFile, xObjectFile));
RunTask("ExtractMapFromElfFile", () => RunExtractMapFromElfFile(mBaseWorkingDirectory, xObjectFile));
}
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.
public bool RunIL2CPUInProcess = false;
public IEnumerable<string> KernelsToRun
{
get
{
return mKernelsToRun;
}
}
private List<string> mKernelsToRun = new List<string>();
public void AddKernel(string assemblyFile)
{

View file

@ -26,8 +26,8 @@ namespace Cosmos.Build.MSBuild {
{
// Important! A given address can have more than one label.
// 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);
return true;
@ -44,22 +44,23 @@ namespace Cosmos.Build.MSBuild {
}
}
private string RunObjDump() {
var xMapFile = Path.ChangeExtension(InputFile, "map");
public static string RunObjDump(string cosmosBuildDir, string workingDir, string inputFile, Action<string> errorReceived, Action<string> outputReceived) {
var xMapFile = Path.ChangeExtension(inputFile, "map");
File.Delete(xMapFile);
if (File.Exists(xMapFile)) {
throw new Exception("Could not delete " + xMapFile);
}
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) + "\"");
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) + "\"");
if (!ExecuteTool(WorkingDir, xTempBatFile, "", "objdump")) {
throw new Exception("Error extracting map from " + InputFile);
var xResult = ExecuteTool(workingDir, xTempBatFile, "", "objdump", errorReceived, outputReceived);
if (!xResult) {
throw new Exception("Error extracting map from " + inputFile);
}
File.Delete(xTempBatFile);
return xMapFile;
}
}
}
}

View file

@ -235,7 +235,11 @@ namespace Cosmos.IL2CPU.ILOpCodes {
{
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 + ")");
}
}
}