Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate GitHub Actions #107

Merged
merged 17 commits into from
Oct 17, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tests/IL2C.Core.Test.Fixture/CMakeDriver.cs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ namespace IL2C
{
internal static class CMakeDriver
{
#if false
public static async Task<string> BuildAsync(
string binPath, string configuration, string sourcePath, string il2cRuntimePath)
{
@@ -95,22 +96,28 @@ public static async Task<string> BuildAsync(

return testLog;
}

#else
// FASTER than cmake: It's direct gcc driver with self-parsing cmake configuration.
public static async Task<string> BuildDirectlyAsync(
public static async Task<string> BuildAsync(
string binPath, string configuration, string sourcePath, string il2cRuntimePath)
{
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;

var basePath = Path.GetDirectoryName(sourcePath);
var outPath = Path.Combine(basePath, "build");
var executablePath = Path.Combine(outPath, Path.GetFileNameWithoutExtension(sourcePath) + ".exe");
var executablePath = Path.Combine(
outPath,
Path.GetFileNameWithoutExtension(sourcePath) + (isWindows ? ".exe" : string.Empty));

var currentListDir = Path.GetFullPath(
Path.Combine(il2cRuntimePath, "cmake"));
var dict = await CMakeListsSimpleParser.ExtractDefinitionsAsync(
Path.Combine(currentListDir, "gcc4-win-mingw32.cmake"),
isWindows ? // DIRTY: ugly choice only win-mingw32 or linux...
Path.Combine(currentListDir, "gcc4-win-mingw32.cmake") :
Path.Combine(currentListDir, "gcc-linux.cmake"),
new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) {
{ "Configuration", configuration },
{ "Platform", "mingw32" },
{ "Platform", isWindows ? "mingw32" : "x86_64" }, // DIRTY: `uname -m` on Ubuntu 20.04
{ "CMAKE_CURRENT_LIST_DIR", currentListDir }
});

@@ -131,7 +138,7 @@ public static async Task<string> BuildDirectlyAsync(
// Step1: Execute gcc
var (gccExitCode, gccLog) = await TestUtilities.ExecuteAsync(
outPath, new[] { binPath },
Path.Combine(binPath, "gcc.exe"),
Path.Combine(binPath, isWindows ? "gcc.exe" : "gcc"),
$"-I{basePath}",
incDir,
libDir,
@@ -156,5 +163,6 @@ public static async Task<string> BuildDirectlyAsync(

return testLog;
}
#endif
}
}
2 changes: 1 addition & 1 deletion tests/IL2C.Core.Test.Fixture/TestFramework.cs
Original file line number Diff line number Diff line change
@@ -413,7 +413,7 @@ await TestUtilities.CopyResourceToStreamAsync(
string sanitized = null;
try
{
var executedResult = await CMakeDriver.BuildDirectlyAsync(
var executedResult = await CMakeDriver.BuildAsync(
binPath,
configuration,
sourcePath,