The tester now can run kernels in vmware (workstation for now) as well.

This commit is contained in:
Matthijs ter Woord 2015-07-18 01:29:20 +02:00
parent 3f86e0491a
commit 7207ae0bc5
10 changed files with 163 additions and 15 deletions

View file

@ -61,6 +61,7 @@
<Compile Include="Enums.cs" />
<Compile Include="MultiplexingOutputHandler.cs" />
<Compile Include="OutputHandlerBase.cs" />
<Compile Include="OutputHandlerFullConsole.cs" />
<Compile Include="OutputHandlerConsole.cs" />
<Compile Include="OutputHandlerText.cs" />
<Compile Include="OutputHandlerXml.cs" />

View file

@ -30,12 +30,10 @@ namespace Cosmos.TestRunner.Core
xBochs.LogError = s => OutputHandler.LogDebugMessage(s);
xBochs.LogOutput = s => OutputHandler.LogDebugMessage(s);
mBochsRunning = true;
HandleRunning(xDebugConnector, xBochs);
}
private volatile bool mBochsRunning = true;
private volatile bool mKernelRunning = true;
}
}

View file

@ -13,7 +13,7 @@ namespace Cosmos.TestRunner.Core
{
partial class Engine
{
private const int AllowedSecondsInKernel = 30;
private const int AllowedSecondsInKernel = 300;
private void ExecuteKernel(string assemblyFileName, RunConfiguration configuration)
{
@ -41,9 +41,9 @@ namespace Cosmos.TestRunner.Core
case RunTargetEnum.Bochs:
RunTask("RunISO", () => RunIsoInBochs(xIsoFile));
break;
//case RunTargetEnum.VMware:
// RunTask("RunISO", () => RunIsoInVMware(xIsoFile));
// break;
case RunTargetEnum.VMware:
RunTask("RunISO", () => RunIsoInVMware(xIsoFile));
break;
default:
throw new ArgumentOutOfRangeException("RunTarget " + configuration.RunTarget + " not implemented!");
}

View file

@ -28,7 +28,7 @@ namespace Cosmos.TestRunner.Core
OutputHandler.LogMessage("DC Error: " + e.ToString());
OutputHandler.SetKernelTestResult(false, "DC Error");
mKernelResultSet = true;
mBochsRunning = false;
mKernelRunning = false;
};
debugConnector.CmdText += s =>
{
@ -71,6 +71,8 @@ namespace Cosmos.TestRunner.Core
{
throw new ArgumentNullException("host");
}
mKernelRunning = true;
host.Start();
try
{
@ -78,7 +80,7 @@ namespace Cosmos.TestRunner.Core
mKernelResultSet = false;
Interlocked.Exchange(ref mSucceededAssertions, 0);
while (mBochsRunning)
while (mKernelRunning)
{
Thread.Sleep(50);
@ -97,6 +99,7 @@ namespace Cosmos.TestRunner.Core
}
finally
{
Console.WriteLine("Stopping now");
host.Stop();
debugConnector.Dispose();
Thread.Sleep(50);
@ -140,12 +143,13 @@ namespace Cosmos.TestRunner.Core
{
OutputHandler.SetKernelTestResult(false, "Test failed");
mKernelResultSet = true;
mBochsRunning = false;
mKernelRunning = false;
}
private void KernelTestCompleted()
{
mBochsRunning = false;
Console.WriteLine("Test completed");
mKernelRunning = false;
}
}
}

View file

@ -10,5 +10,23 @@ namespace Cosmos.TestRunner.Core
{
partial class Engine
{
private void RunIsoInVMware(string iso)
{
var xParams = new NameValueCollection();
xParams.Add("ISOFile", iso);
xParams.Add(BuildProperties.VisualStudioDebugPortString, "Pipe: Cosmos\\Serial");
xParams.Add(BuildProperties.VMwareEditionString, "Workstation");
var xDebugConnector = new DebugConnectorPipeServer(DebugConnectorPipeServer.DefaultCosmosPipeName);
InitializeDebugConnector(xDebugConnector);
var xVMware = new VMware(xParams, false);
xVMware.OnShutDown = (a, b) =>
{
};
HandleRunning(xDebugConnector, xVMware);
}
}
}

View file

@ -80,8 +80,13 @@ namespace Cosmos.TestRunner.Core
private IEnumerable<RunConfiguration> GetRunConfigurations()
{
yield return new RunConfiguration {IsELF = true};
//yield return new RunConfiguration {IsELF = false};
yield return new RunConfiguration { IsELF = true, RunTarget = RunTargetEnum.VMware };
//foreach (RunTargetEnum xTarget in Enum.GetValues(typeof(RunTargetEnum)))
//{
// yield return new RunConfiguration {IsELF = true, RunTarget = xTarget};
// //yield return new RunConfiguration { IsELF = false, RunTarget = xTarget };
//}
}
}
}

View file

@ -56,7 +56,7 @@ namespace Cosmos.TestRunner.Core
public override void RunConfigurationStart(RunConfiguration configuration)
{
Log(string.Format("Start configuration. IsELF = {0}", configuration.IsELF));
Log(string.Format("Start configuration. IsELF = {0}, Target = {1}", configuration.IsELF, configuration.RunTarget));
mLogLevel++;
}

View file

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Cosmos.TestRunner.Core
{
public class OutputHandlerFullConsole: OutputHandlerBase
{
private readonly Stopwatch mCurrentTaskStopwatch=new Stopwatch();
private readonly Stopwatch mCurrentKernelStopwatch = new Stopwatch();
private readonly Stopwatch mExecutionStopwatch = new Stopwatch();
public override void TaskStart(string taskName)
{
Log("Running task '" + taskName + "'");
mCurrentTaskStopwatch.Reset();
mCurrentTaskStopwatch.Start();
mLogLevel ++;
}
public override void TaskEnd(string taskName)
{
mCurrentTaskStopwatch.Stop();
mLogLevel --;
Log("Done running task '" + taskName + "'. Took " + mCurrentTaskStopwatch.Elapsed);
}
public override void UnhandledException(Exception exception)
{
Log("Unhandled exception: "+ exception.ToString());
}
public override void ExecutionEnd()
{
mLogLevel = 0;
Log("Done executing");
Log("Took " + mExecutionStopwatch.Elapsed);
Log(String.Format("{0} kernels succeeded their tests", mNumberOfSuccesses));
Log(String.Format("{0} kernels failed their tests", mNumberOfFailures));
}
public override void ExecutionStart()
{
mLogLevel = 0;
Log("Start executing");
mExecutionStopwatch.Reset();
mExecutionStopwatch.Start();
mLogLevel = 1;
}
public override void LogDebugMessage(string message)
{
}
public override void RunConfigurationStart(RunConfiguration configuration)
{
Log(string.Format("Start configuration. IsELF = {0}, Target = {1}", configuration.IsELF, configuration.RunTarget));
mLogLevel++;
}
public override void RunConfigurationEnd(RunConfiguration configuration)
{
mLogLevel --;
}
public override void LogError(string message)
{
Log("Error: " + message);
}
public override void LogMessage(string message)
{
Log("Msg: " + message);
}
public override void ExecuteKernelEnd(string assemblyName)
{
mCurrentKernelStopwatch.Stop();
Log("Done running kernel. Took " + mCurrentKernelStopwatch.Elapsed);
mLogLevel--;
}
public override void ExecuteKernelStart(string assemblyName)
{
Log("Starting kernel '" + assemblyName + "'");
mCurrentKernelStopwatch.Reset();
mCurrentKernelStopwatch.Start();
mLogLevel++;
}
private int mLogLevel;
private void Log(string message)
{
Console.Write(DateTime.Now.ToString("hh:mm:ss.ffffff "));
Console.Write(new String(' ', mLogLevel * 2));
Console.WriteLine(message);
}
public override void SetKernelTestResult(bool succeeded, string message)
{
Log(string.Format("Success = {0}, Message = '{1}'", succeeded, message));
if (succeeded)
{
mNumberOfSuccesses++;
}
else
{
mNumberOfFailures++;
}
}
private int mNumberOfSuccesses = 0;
private int mNumberOfFailures = 0;
public override void SetKernelSucceededAssertionsCount(int succeededAssertions)
{
}
}
}

View file

@ -1,6 +1,6 @@
namespace Cosmos.TestRunner
{
public enum TestChannelCommandEnum
public enum TestChannelCommandEnum: byte
{
TestCompleted = 0,
TestFailed = 1,

View file

@ -23,6 +23,7 @@ namespace Cosmos.TestRunner
public static unsafe void Completed()
{
Debugger.SendChannelCommand(TestChannel, (byte)TestChannelCommandEnum.TestCompleted);
Debugger.Send("Test completed");
while (true)
;
}