Skip to content

Commit

Permalink
fixed linux testsetup
Browse files Browse the repository at this point in the history
  • Loading branch information
stesee committed Apr 11, 2020
1 parent 87b12e1 commit e610204
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
23 changes: 0 additions & 23 deletions PdfAValidatorTest/PdfAValidatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public static void ShouldFailGracefullWithUnrecognicedVeraPdfOutput()
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
somethingThatReturnsExitcode0 = "./TestExecuteables/exitcode0.sh";
SetLinuxFileExecuteable(somethingThatReturnsExitcode0);
}

var veraPdfException = Assert.Throws<VeraPdfException>(() =>
Expand Down Expand Up @@ -136,7 +135,6 @@ public static void ShouldFailGracefullWithExitcode1()
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
somethingThatReturnsExitcode1 = "./TestExecuteables/exitcode1.sh";
SetLinuxFileExecuteable(somethingThatReturnsExitcode1);
}

var veraPdfException = Assert.Throws<VeraPdfException>(() =>
Expand Down Expand Up @@ -188,26 +186,5 @@ public static void ShouldNotFailOnMultipleDisposeCallseWithoutInitialization()
postscriptValidator.Dispose();
postscriptValidator.Dispose();
}

private static void SetLinuxFileExecuteable(string filePath)
{
var chmodCmd = "chmod 700 " + filePath;
var escapedArgs = chmodCmd.Replace(maskedQuote, "\\\"");

using var process = new Process
{
StartInfo = new ProcessStartInfo
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "/bin/bash",
Arguments = $"-c \"{escapedArgs}\""
}
};
process.Start();
process.WaitForExit();
}
}
}
3 changes: 2 additions & 1 deletion PdfAValidatorTest/TestExecuteables/exitcode0.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
EXIT 0
#!/bin/sh
exit 0
3 changes: 2 additions & 1 deletion PdfAValidatorTest/TestExecuteables/exitcode1.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
EXIT 1
#!/bin/sh
exit 1

0 comments on commit e610204

Please sign in to comment.