Skip to content
Permalink
Browse files

Integrate Linux build in Pipeline. Integrate Tests in Pipeline. Added…

… missing ROMs for qemu 2.11
  • Loading branch information...
Arakis committed Feb 9, 2019
1 parent 4ddb3b9 commit 89450d390ade49b9b5cd8040f15fea573b281170
@@ -0,0 +1,19 @@
FROM debian:stretch

RUN apt-get update && apt-get upgrade -y

RUN apt-get install -y apt-transport-https dirmngr \
&& apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
&& apt-get update

RUN apt-get install -y mono-devel

RUN apt-get install -y qemu-system-x86

RUN apt-get install -y git wget

#RUN useradd -m mosa

#USER mosa
#WORKDIR /home/mosa
@@ -0,0 +1,13 @@
#!/bin/bash

NAME=mosa-debian-integration
IMAGE=seblon/mosa-debian-integration

#docker build . -t mosa/$NAME

docker rm -f $NAME

docker run -it --name $NAME -v ${PWD}/start:/home/mosa/start $IMAGE /bin/bash -c /home/mosa/start
#docker run -it --name $NAME -v ${PWD}/start:/home/mosa/start mosa/$NAME /bin/bash


@@ -0,0 +1,5 @@
#!/bin/bash

git clone https://github.com/mosa/MOSA-Project.git
cd MOSA-Project
./mosactl test
@@ -200,7 +200,7 @@ public static void Main()

IDT.SetInterruptHandler(manager.ProcessInterrupt);

Logger.Log("<TEST:PASSED:Boot.Main>");
Logger.Log("<SELFTEST:PASSED>");

manager.Start();
}
@@ -218,7 +218,7 @@ public static void Main()

Console.Goto(12, 0);

Logger.Log("<TEST:PASSED:Boot.Main>");
Logger.Log("<SELFTEST:PASSED>");

while (true)
{
@@ -12,6 +12,8 @@ public static class Kernel
{
public static void Setup()
{
Logger.Log("Initialize Kernel");

// Initialize GDT before IDT, because IDT Entries requies a valid Segment Selector
// This never happend before, because on fast computers GDT.Setup() was called
// before a Interrupt,for example clock, got triggered.
@@ -38,7 +40,7 @@ public static void Setup()
SmbiosManager.Setup();
ConsoleManager.Setup();

Logger.Log("Kernel Setup finished");
Logger.Log("Kernel initialized");
}
}
}
@@ -86,6 +86,7 @@ public void Run(List<string> args)
if (args.Count == 0)
{
PrintHelp("usage");
Environment.Exit(1);
return;
}

@@ -95,21 +96,26 @@ public void Run(List<string> args)
switch (args[0])
{
case "tools":
TaskTools(CheckType.force);
if (!TaskTools(CheckType.force))
Environment.Exit(1);
break;
case "runtime":
TaskRuntime(CheckType.force);
if (!TaskRuntime(CheckType.force))
Environment.Exit(1);
break;
case "net":
case "dotnet":
TaskCILBuild(CheckType.force, args);
if (!TaskCILBuild(CheckType.force, args))
Environment.Exit(1);
break;
case "bin":
case "binary":
TaskBinaryBuild(CheckType.force, args);
if (!TaskBinaryBuild(CheckType.force, args))
Environment.Exit(1);
break;
case "run":
TaskRun(args);
if (!TaskRun(args))
Environment.Exit(1);
break;
case "test":
if (!TaskTest(args))
@@ -118,10 +124,15 @@ public void Run(List<string> args)
case "debug":
TaskDebug(args);
break;
case "help":
PrintHelp("usage");
break;
}
}

private string OsName = "HelloWorld";
private string OsName = "all";

private string[] OsNames = new string[] { "helloworld", "coolworld" };

private void PrintHelp(string name)
{
@@ -131,14 +142,16 @@ private void PrintHelp(string name)
}
}

public void TaskCILBuild(CheckType ct, List<string> args)
public bool TaskCILBuild(CheckType ct, List<string> args)
{
TaskRuntime(CheckType.changed);

if (!File.Exists(GetEnv(ExpandKernelBinPath(OsName) + ".exe")) || ct == CheckType.force)
{
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), ExpandKernelCsProjPath(OsName));
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), ExpandKernelCsProjPath(OsName), "-verbosity:minimal"))
return false;
}
return true;
}

private bool CallMonoProcess(string workdir, string cmd, params string[] args)
@@ -160,37 +173,47 @@ private bool CallProcess(string workdir, string cmd, params string[] args)
var proc = Process.Start(start);
proc.WaitForExit();

if (proc.ExitCode > 0)
{
Console.WriteLine("Exit Code " + proc.ExitCode);
}

return proc.ExitCode == 0;
}

public void TaskBinaryBuild(CheckType ct, List<string> args)
public bool TaskBinaryBuild(CheckType ct, List<string> args)
{
TaskTools(CheckType.changed);
TaskCILBuild(CheckType.changed, args);
if (!TaskTools(CheckType.changed))
return false;
if (!TaskCILBuild(CheckType.changed, args))
return false;

if (!File.Exists(ExpandKernelBinPath(OsName) + ".bin") || ct == CheckType.force)
{
var compilerArgs = new List<string>() {
"-o",
ExpandKernelBinPath(OsName)+".bin",
"-a",
"x86",
"--mboot",
"v1",
"--map",
ExpandKernelBinPath(OsName)+".map",
"--debug-info",
ExpandKernelBinPath(OsName)+".debug",
"--base-address",
"0x00500000",
"mscorlib.dll",
"Mosa.Plug.Korlib.dll",
"Mosa.Plug.Korlib.x86.dll",
ExpandKernelBinPath(OsName)+".exe"
};
"-o",
ExpandKernelBinPath(OsName)+".bin",
"-a",
"x86",
"--mboot",
"v1",
"--map",
ExpandKernelBinPath(OsName)+".map",
"--debug-info",
ExpandKernelBinPath(OsName)+".debug",
"--base-address",
"0x00500000",
"mscorlib.dll",
"Mosa.Plug.Korlib.dll",
"Mosa.Plug.Korlib.x86.dll",
ExpandKernelBinPath(OsName)+".exe"
};

CallMonoProcess(BinDir, "Mosa.Tool.Compiler.exe", compilerArgs.ToArray());
if (!CallMonoProcess(BinDir, "Mosa.Tool.Compiler.exe", compilerArgs.ToArray()))
return false;
}

return true;
}

private class PlattformAppCall
@@ -231,29 +254,49 @@ public void TaskBuild(List<string> args)
TaskDiskBuild();
}

public void TaskRun(List<string> args)
public bool TaskRun(List<string> args)
{
var ct = args.Contains("--build") ? CheckType.force : CheckType.changed;
TaskCILBuild(ct, args);
TaskBinaryBuild(ct, args);
if (!TaskCILBuild(ct, args))
return false;
if (!TaskBinaryBuild(ct, args))
return false;

if (!CallQemu(false, null))
return false;

CallQemu(false, null);
return true;
}

public bool TaskTestAll(List<string> args)
{
foreach (var osName in OsNames)
if (!CallProcess(BinDir, GetEnv("${MOSA_BIN}/Mosa.Tool.Mosactl.exe"), "test", osName))
return false;

return true;
}

public bool TaskTest(List<string> args)
{
TaskCILBuild(CheckType.changed, args);
TaskBinaryBuild(CheckType.changed, args);
if (OsName == "all")
return TaskTestAll(args);

if (!TaskCILBuild(CheckType.changed, args))
return false;
if (!TaskBinaryBuild(CheckType.changed, args))
return false;

var testSuccess = false;
CallQemu(true, (line, proc) =>
{
if (line == "<TEST:PASSED:Boot.Main>")
{
testSuccess = true;
proc.Kill();
}
});
if (!CallQemu(true, (line, proc) =>
{
if (line == "<SELFTEST:PASSED>")
{
testSuccess = true;
proc.Kill();
}
}))
return false;

if (testSuccess)
{
@@ -319,7 +362,8 @@ private bool CallQemu(bool nographic, Action<string, Process> OnKernelLog)
}
else
{
sb.Append(buf[0]);
if (buf[0] != '\r')
sb.Append(buf[0]);
}

}
@@ -340,10 +384,11 @@ private bool CallQemu(bool nographic, Action<string, Process> OnKernelLog)
th2.Start();
}


p.WaitForExit();

return true;
Console.WriteLine("Qemu exit code " + p.ExitCode);

return p.ExitCode == 0 || p.ExitCode == 137 || p.ExitCode == -1;
}

public void TaskDebug(List<string> args)
@@ -393,29 +438,41 @@ private void GenerateGDBFile()
CallProcess(BinDir, "chmod", "+x", gdbqemu);
}

public void TaskTools(CheckType ct)
public bool TaskTools(CheckType ct)
{
var exists = File.Exists(GetEnv("${MOSA_BIN}/Mosa.Tool.Compiler.exe"));
if (!exists || ct == CheckType.force)
{
CallMonoProcess(SourceDir, GetEnv("MOSA_NUGET"), "restore", "Mosa.sln");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj");
if (!CallMonoProcess(SourceDir, GetEnv("MOSA_NUGET"), "restore", "Mosa.sln"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj"))
return false;
}

return true;
}

public void TaskRuntime(CheckType ct)
public bool TaskRuntime(CheckType ct)
{
var exists = File.Exists(GetEnv("${MOSA_BIN}/Mosa.Plug.Korlib.dll"));
if (!exists || ct == CheckType.force)
{
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Runtime.x86/Mosa.Runtime.x86.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Runtime.x64/Mosa.Runtime.x64.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Korlib/Mosa.Korlib.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib/Mosa.Plug.Korlib.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib.x86/Mosa.Plug.Korlib.x86.csproj");
CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib.x64/Mosa.Plug.Korlib.x64.csproj");
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Runtime.x86/Mosa.Runtime.x86.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Runtime.x64/Mosa.Runtime.x64.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Korlib/Mosa.Korlib.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib/Mosa.Plug.Korlib.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib.x86/Mosa.Plug.Korlib.x86.csproj"))
return false;
if (!CallProcess(SourceDir, GetEnv("MOSA_MSBUILD"), "Mosa.Plug.Korlib.x64/Mosa.Plug.Korlib.x64.csproj"))
return false;
}
return true;
}

public enum CheckType
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 89450d3

Please sign in to comment.
You can’t perform that action at this time.