HADOOP-15731. TestDistributedShell fails on Windows. Contributed by Botong Huang.

This commit is contained in:
Giovanni Matteo Fumarola 2018-09-07 14:19:10 -07:00
parent a400ed3aab
commit 7fed1a07ab
2 changed files with 12 additions and 4 deletions

View File

@ -854,7 +854,9 @@ public class Client {
// Set java executable command // Set java executable command
LOG.info("Setting up app master command"); LOG.info("Setting up app master command");
vargs.add(Environment.JAVA_HOME.$$() + "/bin/java"); // Need extra quote here because JAVA_HOME might contain space on Windows,
// e.g. C:/Program Files/Java...
vargs.add("\"" + Environment.JAVA_HOME.$$() + "/bin/java\"");
// Set Xmx based on am memory size // Set Xmx based on am memory size
vargs.add("-Xmx" + amMemory + "m"); vargs.add("-Xmx" + amMemory + "m");
// Set class name // Set class name

View File

@ -776,6 +776,12 @@ public class TestDistributedShell {
} }
private String getSleepCommand(int sec) {
// Windows doesn't have a sleep command, ping -n does the trick
return Shell.WINDOWS ? "ping -n " + (sec + 1) + " 127.0.0.1 >nul"
: "sleep " + sec;
}
@Test @Test
public void testDSRestartWithPreviousRunningContainers() throws Exception { public void testDSRestartWithPreviousRunningContainers() throws Exception {
String[] args = { String[] args = {
@ -784,7 +790,7 @@ public class TestDistributedShell {
"--num_containers", "--num_containers",
"1", "1",
"--shell_command", "--shell_command",
"sleep 8", getSleepCommand(8),
"--master_memory", "--master_memory",
"512", "512",
"--container_memory", "--container_memory",
@ -819,7 +825,7 @@ public class TestDistributedShell {
"--num_containers", "--num_containers",
"1", "1",
"--shell_command", "--shell_command",
"sleep 8", getSleepCommand(8),
"--master_memory", "--master_memory",
"512", "512",
"--container_memory", "--container_memory",
@ -857,7 +863,7 @@ public class TestDistributedShell {
"--num_containers", "--num_containers",
"1", "1",
"--shell_command", "--shell_command",
"sleep 8", getSleepCommand(8),
"--master_memory", "--master_memory",
"512", "512",
"--container_memory", "--container_memory",