Skip to content

Commit

Permalink
Ongoing work for CosmosOS#140.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Jun 21, 2015
1 parent 1828c66 commit dcd7785
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 32 deletions.
36 changes: 17 additions & 19 deletions Tests/Cosmos.TestRunner.Core/Engine.Bochs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ private void RunIsoInBochs(string iso)
xDebugConnector.Error = e =>
{
OutputHandler.LogMessage("DC Error: " + e.ToString());
OutputHandler.SetKernelTestResult(false, "DC Error");
mKernelResultSet = true;
mBochsRunning = false;
};
xDebugConnector.CmdText += s => OutputHandler.LogMessage("Text from kernel: " + s);
Expand Down Expand Up @@ -88,26 +90,22 @@ private void ChannelPacketReceived(byte arg1, byte arg2, byte[] arg3)
// for now, skip
return;
}
if (arg1 != TestController.TestChannel)
if (arg1 == TestController.TestChannel)
{
throw new Exception("Unhandled channel " + arg1);
}

switch (arg2)
{
case (byte)TestChannelCommandEnum.TestCompleted:
mBochsRunning = false;
break;
case (byte)TestChannelCommandEnum.TestFailed:
OutputHandler.SetKernelTestResult(false, "Test failed");
mKernelResultSet = true;
mBochsRunning = false;
break;
case (byte)TestChannelCommandEnum.AssertionSucceeded:
Interlocked.Increment(ref mSucceededAssertions);
break;
default:
throw new NotImplementedException("TestChannel command " + arg2 + " is not implemented!");
switch (arg2)
{
case (byte)TestChannelCommandEnum.TestCompleted:
mBochsRunning = false;
break;
case (byte)TestChannelCommandEnum.TestFailed:
OutputHandler.SetKernelTestResult(false, "Test failed");
mKernelResultSet = true;
mBochsRunning = false;
break;
case (byte)TestChannelCommandEnum.AssertionSucceeded:
Interlocked.Increment(ref mSucceededAssertions);
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Cosmos.TestRunner.Core/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void Execute()
private IEnumerable<RunConfiguration> GetRunConfigurations()
{
yield return new RunConfiguration {IsELF = true};
yield return new RunConfiguration {IsELF = false};
//yield return new RunConfiguration {IsELF = false};
}
}
}
2 changes: 1 addition & 1 deletion Tests/Cosmos.TestRunner.Core/OutputHandlerXml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public override void TaskEnd(string taskName)
{
mTaskStopwatch.Stop();
var xItem = mCurrentNode.Pop();
xItem.Attributes.Append(NewXmlAttribute("Duration", mKernelStopwatch.Elapsed.ToString("c")));
xItem.Attributes.Append(NewXmlAttribute("Duration", mTaskStopwatch.Elapsed.ToString("c")));
}

public override void SetKernelTestResult(bool succeeded, string message)
Expand Down
8 changes: 2 additions & 6 deletions Tests/Cosmos.TestRunner.TestController/TestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ internal static Debugger Debugger
{
get
{
if (mDebugger == null)
{
mDebugger = new Debugger("Tests", "TestController");
}
return mDebugger;
return new Debugger("Tests", "TestController");
}
}

Expand All @@ -36,7 +32,7 @@ public static void Failed()

internal static void AssertionSucceeded()
{
Debugger.SendChannelCommand(TestChannel, (byte)TestChannelCommandEnum.AssertionSucceeded, new byte[0]);
//Debugger.SendChannelCommand(TestChannel, (byte)TestChannelCommandEnum.AssertionSucceeded, new byte[0]);
}
}
}
6 changes: 3 additions & 3 deletions Tests/Cosmos.TestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ static void Main(string[] args)
var xEngine = new Engine();

xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);

xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);

// known bugs, therefor disabled for now:
//xEngine.AddKernel(typeof(Cosmos.Compiler.Tests.Interfaces.Kernel.Kernel).Assembly.Location);

//xEngine.OutputHandler = new OutputHandlerXml(@"c:\data\CosmosTests.xml");
xEngine.OutputHandler = new OutputHandlerConsole();
xEngine.OutputHandler = new OutputHandlerXml(@"c:\data\CosmosTests.xml");
//xEngine.OutputHandler = new OutputHandlerConsole();
xEngine.Execute();
}
}
Expand Down
7 changes: 5 additions & 2 deletions source/Cosmos.Debug.Common/DebugConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,12 @@ protected void PacketPong(byte[] aPacket)

protected void PacketChannel(byte channel, byte command, byte[] aPacket)
{
if (CmdChannel != null)
if (SigReceived)
{
CmdChannel(channel, command, aPacket);
if (CmdChannel != null)
{
CmdChannel(channel, command, aPacket);
}
}
WaitForMessage();
}
Expand Down

0 comments on commit dcd7785

Please sign in to comment.