aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-04-10 19:10:59 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-04-13 11:47:37 +0000
commit31ccc99b41d402213765a8ba6c34ca04efc04d9f (patch)
tree00d0709c3c89d345c398c83eba3d415dc95904dc
parent5f3e30c046c6e5680d50cba4a71f45d2ab665444 (diff)
Explicitly use bash to test negative exit codes
sh doesn't actually support negative exit codes, so if someone (Travis) uses a different version than we're using, they'll get exit code 2 (misuse of shell builtin), not <exit code>%256. See https://lists.gnu.org/archive/html/bug-bash/2011-08/msg00027.html for some examples/discussion. -- MOS_MIGRATED_REVID=90828267
-rw-r--r--src/test/java/com/google/devtools/build/lib/shell/CommandTest.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/shell/CommandTest.java b/src/test/java/com/google/devtools/build/lib/shell/CommandTest.java
index ef45a6313d..136ffbb3b6 100644
--- a/src/test/java/com/google/devtools/build/lib/shell/CommandTest.java
+++ b/src/test/java/com/google/devtools/build/lib/shell/CommandTest.java
@@ -370,12 +370,12 @@ public class CommandTest {
for (int exit : new int[] { -1, -2, -3 }) {
int expected = 256 + exit;
try {
- String args[] = { "/bin/sh", "-c", "exit " + exit };
+ String args[] = { "/bin/bash", "-c", "exit " + exit };
new Command(args).execute();
fail("Should have exited with status " + expected);
} catch (BadExitStatusException e) {
assertThat(e).hasMessage("Process exited with status " + expected);
- checkCommandElements(e, "/bin/sh", "-c", "exit " + exit);
+ checkCommandElements(e, "/bin/bash", "-c", "exit " + exit);
TerminationStatus status = e.getResult().getTerminationStatus();
assertFalse(status.success());
assertTrue(status.exited());