skip win 64

This commit is contained in:
Salman Chishti
2025-07-27 22:07:16 +00:00
parent 63ada10762
commit ffc2086972

View File

@@ -274,6 +274,12 @@ namespace GitHub.Runner.Common.Tests.Listener
[Trait("SkipOn", "windows")]
public void ValidateShellScript_MissingTemplate_ThrowsException()
{
// Skip on Windows platforms - more explicit check to ensure it's skipped on all Windows variants
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
// Test for non-existent template file
// The ValidateShellScriptTemplateSyntax method has a try-catch that will catch and wrap FileNotFoundException
// so we need to test that it produces the appropriate error message
@@ -296,6 +302,12 @@ namespace GitHub.Runner.Common.Tests.Listener
[Trait("SkipOn", "windows")]
public void ValidateShellScript_ComplexScript_ValidatesCorrectly()
{
// Skip on Windows platforms - more explicit check to ensure it's skipped on all Windows variants
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
// Create a test template with complex shell scripting patterns
string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempDir);
@@ -396,7 +408,7 @@ exit 0";
[Trait("Level", "L0")]
[Trait("Category", "Runner")]
[Trait("SkipOn", "osx,linux")]
public void ValidateCmdScript_MissingTemplate_ThrowsException()
public void ValidateCmdScript_MissingTemplate_ThrowsFileNotFoundException()
{
// Skip on non-Windows platforms
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -404,19 +416,21 @@ exit 0";
return;
}
// Test for non-existent template file
// The ValidateCmdScriptTemplateSyntax method has a try-catch that will catch and wrap FileNotFoundException
// so we need to test that it produces the appropriate error message
try
// For Windows, we need to use a direct try-catch because File.ReadAllText will throw
// FileNotFoundException if file doesn't exist
try
{
ValidateCmdScriptTemplateSyntax("non_existent_template.cmd.template", shouldPass: true);
Assert.Fail("Expected exception was not thrown");
// This should throw a FileNotFoundException right away
string rootDirectory = Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), ".."));
string templatePath = Path.Combine(rootDirectory, "src", "Misc", "layoutbin", "non_existent_template.cmd.template");
string content = File.ReadAllText(templatePath);
// If we get here, the file somehow exists, which should not happen
Assert.Fail($"Expected FileNotFoundException was not thrown for {templatePath}");
}
catch (Exception ex)
catch (FileNotFoundException)
{
// Verify the exception message contains information about the missing file
Assert.Contains("non_existent_template.cmd.template", ex.Message);
Assert.Contains("FileNotFoundException", ex.Message);
// This is expected, so test passes
}
}