Skip to content

Commit

Permalink
Print out all the linked libs before failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-cpp committed Nov 7, 2023
1 parent 6534cdc commit 4bbe473
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
18 changes: 15 additions & 3 deletions Tasks/TestLinuxTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public override void Run(BuildContext context)
},
out IEnumerable<string> processOutput);

var passedTests = true;
foreach (var line in processOutput)
{
var libPath = line.Trim().Split(' ')[0];
context.Information($"DEP: {libPath}");

var isValidLib = false;
foreach (var validLib in ValidLibs)
Expand All @@ -46,8 +46,20 @@ public override void Run(BuildContext context)
}
}

if (!isValidLib)
throw new Exception($"Found a dynamic library ref: {libPath}");
if (isValidLib)
{
context.Information($"VALID: {libPath}");
}
else
{
context.Information($"INVALID: {libPath}");
passedTests = false;
}
}

if (!passedTests)
{
throw new Exception("Invalid library linkage detected!");
}

context.Information("");
Expand Down
16 changes: 13 additions & 3 deletions Tasks/TestMacOSTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public override void Run(BuildContext context)
out IEnumerable<string> processOutput);

var processOutputList = processOutput.ToList();
var passedTests = true;
for (int i = 3; i < processOutputList.Count; i++)
{
var libPath = processOutputList[i].Trim().Split(' ')[^1];
Expand All @@ -30,11 +31,20 @@ public override void Run(BuildContext context)
continue;
}

context.Information($"DEP: {libPath}");
if (libPath.StartsWith("/usr/lib/") || libPath.StartsWith("/System/Library/Frameworks/"))
continue;
{
context.Information($"VALID: {libPath}");
}
else
{
context.Information($"INVALID: {libPath}");
passedTests = false;
}
}

throw new Exception($"Found a dynamic library ref: {libPath}");
if (!passedTests)
{
throw new Exception("Invalid library linkage detected!");
}

context.Information("");
Expand Down
17 changes: 14 additions & 3 deletions Tasks/TestWindowsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@ public override void Run(BuildContext context)
out IEnumerable<string> processOutput
);

var passedTests = true;
foreach (string output in processOutput)
{
var libPath = output.Trim();
if (!libPath.EndsWith(".dll") || libPath.Contains(' '))
continue;
context.Information($"DEP: {libPath}");
if (ValidLibs.Contains(libPath))
continue;
{
context.Information($"VALID: {libPath}");
}
else
{
context.Information($"INVALID: {libPath}");
passedTests = false;
}
}

throw new Exception($"Found a dynamic library ref: {libPath}");
if (!passedTests)
{
throw new Exception("Invalid library linkage detected!");
}
}
}
Expand Down

0 comments on commit 4bbe473

Please sign in to comment.