mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 22:12:25 +00:00
Merge branch 'master' into feature/AnonymousTypeTests
This commit is contained in:
commit
dcff090d15
10 changed files with 90 additions and 75 deletions
|
|
@ -216,7 +216,7 @@ namespace Cosmos.TestRunner.Core
|
||||||
"EnableDebug:True",
|
"EnableDebug:True",
|
||||||
"EnableStackCorruptionDetection:" + EnableStackCorruptionChecks,
|
"EnableStackCorruptionDetection:" + EnableStackCorruptionChecks,
|
||||||
"StackCorruptionDetectionLevel:" + StackCorruptionDetectionLevel,
|
"StackCorruptionDetectionLevel:" + StackCorruptionDetectionLevel,
|
||||||
"DebugMode:Source",
|
"DebugMode:" + DebugMode,
|
||||||
"TraceAssemblies:" + TraceAssembliesLevel,
|
"TraceAssemblies:" + TraceAssembliesLevel,
|
||||||
"DebugCom:1",
|
"DebugCom:1",
|
||||||
"TargetAssembly:" + kernelFileName,
|
"TargetAssembly:" + kernelFileName,
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ namespace Cosmos.TestRunner.Core
|
||||||
protected TraceAssemblies TraceAssembliesLevel => mConfiguration.TraceAssembliesLevel;
|
protected TraceAssemblies TraceAssembliesLevel => mConfiguration.TraceAssembliesLevel;
|
||||||
protected bool EnableStackCorruptionChecks => mConfiguration.EnableStackCorruptionChecks;
|
protected bool EnableStackCorruptionChecks => mConfiguration.EnableStackCorruptionChecks;
|
||||||
protected StackCorruptionDetectionLevel StackCorruptionDetectionLevel => mConfiguration.StackCorruptionDetectionLevel;
|
protected StackCorruptionDetectionLevel StackCorruptionDetectionLevel => mConfiguration.StackCorruptionDetectionLevel;
|
||||||
|
protected DebugMode DebugMode => mConfiguration.DebugMode;
|
||||||
|
|
||||||
protected bool RunWithGDB => mConfiguration.RunWithGDB;
|
protected bool RunWithGDB => mConfiguration.RunWithGDB;
|
||||||
protected bool StartBochsDebugGui => mConfiguration.StartBochsDebugGUI;
|
protected bool StartBochsDebugGui => mConfiguration.StartBochsDebugGUI;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ namespace Cosmos.TestRunner.Core
|
||||||
TraceAssemblies TraceAssembliesLevel { get; }
|
TraceAssemblies TraceAssembliesLevel { get; }
|
||||||
bool EnableStackCorruptionChecks { get; }
|
bool EnableStackCorruptionChecks { get; }
|
||||||
StackCorruptionDetectionLevel StackCorruptionDetectionLevel { get; }
|
StackCorruptionDetectionLevel StackCorruptionDetectionLevel { get; }
|
||||||
|
DebugMode DebugMode { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An enumerable of kernel assemblies which will be run.
|
/// An enumerable of kernel assemblies which will be run.
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ namespace Cosmos.TestRunner.Full
|
||||||
public virtual TraceAssemblies TraceAssembliesLevel => TraceAssemblies.User;
|
public virtual TraceAssemblies TraceAssembliesLevel => TraceAssemblies.User;
|
||||||
public virtual bool EnableStackCorruptionChecks => true;
|
public virtual bool EnableStackCorruptionChecks => true;
|
||||||
public virtual StackCorruptionDetectionLevel StackCorruptionDetectionLevel => StackCorruptionDetectionLevel.AllInstructions;
|
public virtual StackCorruptionDetectionLevel StackCorruptionDetectionLevel => StackCorruptionDetectionLevel.AllInstructions;
|
||||||
|
public virtual DebugMode DebugMode => DebugMode.Source;
|
||||||
|
|
||||||
public virtual IEnumerable<string> KernelAssembliesToRun
|
public virtual IEnumerable<string> KernelAssembliesToRun
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace Cosmos.TestRunner.TestAdapter
|
||||||
public TraceAssemblies TraceAssembliesLevel { get; }
|
public TraceAssemblies TraceAssembliesLevel { get; }
|
||||||
public bool EnableStackCorruptionChecks { get; }
|
public bool EnableStackCorruptionChecks { get; }
|
||||||
public StackCorruptionDetectionLevel StackCorruptionDetectionLevel { get; }
|
public StackCorruptionDetectionLevel StackCorruptionDetectionLevel { get; }
|
||||||
|
public DebugMode DebugMode { get; }
|
||||||
|
|
||||||
public IEnumerable<string> KernelAssembliesToRun { get; }
|
public IEnumerable<string> KernelAssembliesToRun { get; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,13 @@ namespace Cosmos.TestRunner.UI.ViewModels
|
||||||
set => SetProperty(ref mStackCorruptionDetectionLevel, value);
|
set => SetProperty(ref mStackCorruptionDetectionLevel, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DebugMode mDebugMode = defaultEngineConfiguration.DebugMode;
|
||||||
|
public DebugMode DebugMode
|
||||||
|
{
|
||||||
|
get => mDebugMode;
|
||||||
|
set => SetProperty(ref mDebugMode, value);
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<string> KernelAssembliesToRun
|
public IEnumerable<string> KernelAssembliesToRun
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
25
Tests/Cosmos.TestRunner/.vscode/launch.json
vendored
25
Tests/Cosmos.TestRunner/.vscode/launch.json
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": ".NET Core Launch (console)",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build",
|
|
||||||
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/Cosmos.TestRunner.dll",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"console": "internalConsole",
|
|
||||||
"stopAtEntry": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": ".NET Core Attach",
|
|
||||||
"type": "coreclr",
|
|
||||||
"request": "attach",
|
|
||||||
"processId": "${command:pickProcess}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
42
Tests/Cosmos.TestRunner/.vscode/tasks.json
vendored
42
Tests/Cosmos.TestRunner/.vscode/tasks.json
vendored
|
|
@ -1,42 +0,0 @@
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "build",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"build",
|
|
||||||
"${workspaceFolder}/Cosmos.TestRunner.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "publish",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"publish",
|
|
||||||
"${workspaceFolder}/Cosmos.TestRunner.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "watch",
|
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"${workspaceFolder}/Cosmos.TestRunner.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -36,6 +36,14 @@ namespace ProcessorTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TestBrandStringBlank()
|
||||||
|
{
|
||||||
|
string brandString = CPU.GetCPUBrandString();
|
||||||
|
mDebugger.Send("Brand String: " + brandString);
|
||||||
|
bool isBrandStringBlank = string.IsNullOrWhiteSpace(brandString);
|
||||||
|
Assert.IsFalse(isBrandStringBlank, "Processor brand string is blank.");
|
||||||
|
}
|
||||||
|
|
||||||
public void TestVendorNameIsNotBlank()
|
public void TestVendorNameIsNotBlank()
|
||||||
{
|
{
|
||||||
string vendorName = CPU.GetCPUVendorName();
|
string vendorName = CPU.GetCPUVendorName();
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ namespace Cosmos.Core
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get CPU vendor name.
|
/// Get CPU vendor name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -247,6 +249,67 @@ namespace Cosmos.Core
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get CPU cycle speed.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>long value.</returns>
|
||||||
|
/// <exception cref="NotImplementedException">Thrown on fatal error, contact support.</exception>
|
||||||
|
/// <exception cref="NotSupportedException">Thrown if can not read CPU ID.</exception>
|
||||||
|
public static string GetCPUBrandString()
|
||||||
|
{
|
||||||
|
if (CanReadCPUID() != 0)
|
||||||
|
{
|
||||||
|
// See https://c9x.me/x86/html/file_module_x86_id_45.html
|
||||||
|
|
||||||
|
int eax = 0;
|
||||||
|
int ebx = 0;
|
||||||
|
int ecx = 0;
|
||||||
|
int edx = 0;
|
||||||
|
int[] s = new int[64];
|
||||||
|
string rs = "";
|
||||||
|
|
||||||
|
for (uint i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
ReadCPUID(0x80000002 + i, ref eax, ref ebx, ref ecx, ref edx);
|
||||||
|
s[(i * 16) + 0] = (eax % 256);
|
||||||
|
s[(i * 16) + 1] = ((eax >> 8) % 256);
|
||||||
|
s[(i * 16) + 2] = ((eax >> 16) % 256);
|
||||||
|
s[(i * 16) + 3] = ((eax >> 24) % 256);
|
||||||
|
s[(i * 16) + 4] = (ebx % 256);
|
||||||
|
s[(i * 16) + 5] = ((ebx >> 8) % 256);
|
||||||
|
s[(i * 16) + 6] = ((ebx >> 16) % 256);
|
||||||
|
s[(i * 16) + 7] = ((ebx >> 24) % 256);
|
||||||
|
s[(i * 16) + 8] = (ecx % 256);
|
||||||
|
s[(i * 16) + 9] = ((ecx >> 8) % 256);
|
||||||
|
s[(i * 16) + 10] = ((ecx >> 16) % 256);
|
||||||
|
s[(i * 16) + 11] = ((ecx >> 24) % 256);
|
||||||
|
s[(i * 16) + 12] = (edx % 256);
|
||||||
|
s[(i * 16) + 13] = ((edx >> 8) % 256);
|
||||||
|
s[(i * 16) + 14] = ((edx >> 16) % 256);
|
||||||
|
s[(i * 16) + 15] = ((edx >> 24) % 256);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < s.Length; i++)
|
||||||
|
{
|
||||||
|
if (s[i] == 0x00)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rs += (char)s[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(rs == ""))
|
||||||
|
{
|
||||||
|
return rs;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if can read CPU ID. Plugged.
|
/// Check if can read CPU ID. Plugged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue