Skip to content

Commit 840a2cb

Browse files
committed
GlslReduceTest.checkCustomJudgeIsExecutable: skip on Windows (#371)
Fix #370
1 parent e6fde99 commit 840a2cb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

reducer/src/test/java/com/graphicsfuzz/reducer/tool/GlslReduceTest.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.graphicsfuzz.common.util.ParseHelper;
2222
import com.graphicsfuzz.common.util.ParseTimeoutException;
2323
import com.graphicsfuzz.common.util.ShaderJobFileOperations;
24+
import com.graphicsfuzz.util.ExecHelper;
2425
import java.io.File;
2526
import java.io.IOException;
2627
import org.junit.Rule;
@@ -29,6 +30,7 @@
2930

3031
import static org.junit.Assert.assertEquals;
3132
import static org.junit.Assert.assertTrue;
33+
import static org.junit.Assert.fail;
3234

3335
public class GlslReduceTest {
3436

@@ -120,6 +122,10 @@ public void customJudgeRequiredInCustomReduction() throws Exception {
120122

121123
@Test
122124
public void checkCustomJudgeIsExecutable() throws Exception {
125+
if (ExecHelper.IS_WINDOWS) {
126+
// All files are executable on Windows.
127+
return;
128+
}
123129
final File jsonFile = getShaderJobReady();
124130
final File emptyFile = temporaryFolder.newFile(); // Not executable
125131
try {
@@ -130,8 +136,7 @@ public void checkCustomJudgeIsExecutable() throws Exception {
130136
emptyFile.getAbsolutePath(),
131137
"--output",
132138
temporaryFolder.getRoot().getAbsolutePath()}, null);
133-
assertTrue("An exception should have been thrown as the " +
134-
"judge script is not executable.", false);
139+
fail("An exception should have been thrown as the judge script is not executable.");
135140
} catch (RuntimeException exception) {
136141
assertTrue(exception.getMessage().contains("judge script must be executable"));
137142
}

util/src/main/java/com/graphicsfuzz/util/ExecHelper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public enum RedirectType {
3939

4040
private static final Logger LOGGER = LoggerFactory.getLogger(ExecHelper.class);
4141

42-
private static final boolean isWindows =
42+
public static final boolean IS_WINDOWS =
4343
System.getProperty("os.name").toLowerCase().startsWith("windows");
4444

4545
private static final String pathVar;
@@ -78,7 +78,7 @@ public ExecResult exec(
7878
List<String> commandList = new ArrayList<>(Arrays.asList(command));
7979

8080
if (shell) {
81-
if (isWindows) {
81+
if (IS_WINDOWS) {
8282
commandList.addAll(0, Arrays.asList("cmd.exe", "/c"));
8383
} else {
8484
commandList.addAll(0, Arrays.asList("env", "--"));

0 commit comments

Comments
 (0)