Skip to content

Commit

Permalink
Added universal binary test (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasFOG authored Jan 22, 2024
1 parent 158f1c1 commit 0ffd76a
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions Tasks/TestMacOSTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public override void Run(BuildContext context)

if (libPath.StartsWith("/usr/lib/") || libPath.StartsWith("/System/Library/Frameworks/"))
{
context.Information($"VALID: {libPath}");
context.Information($"VALID linkage: {libPath}");
}
else
{
context.Information($"INVALID: {libPath}");
context.Information($"INVALID linkage: {libPath}");
passedTests = false;
}
}
Expand All @@ -47,6 +47,45 @@ public override void Run(BuildContext context)
throw new Exception("Invalid library linkage detected!");
}

// check if correct architectures are supported
context.StartProcess(
"file",
new ProcessSettings
{
RedirectStandardOutput = true
},
out processOutput);

bool x86_64 = false;
bool arm64 = false;

processOutputList = processOutput.ToList();

for (int i = 0; i < processOutputList.Count; i++)
{
var architecture = processOutputList[i];
if (architecture.Contains("x86_64"))
x86_64 = true;
else if (architecture.Contains("arm64"))
arm64 = true;
}

if (x86_64)
{
context.Information($"ARCHITECTURE: x86_64");
}

if (arm64)
{
context.Information($"ARCHITECTURE: arm64");
}

if (context.IsUniversalBinary && !(arm64 && x86_64))
{
context.Information($"INVALID universal binary");
throw new Exception("An universal binary hasn't been generated!");
}

context.Information("");
}
}
Expand Down

0 comments on commit 0ffd76a

Please sign in to comment.