You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/11/10 21:55:33 UTC
[1/2] incubator-slider git commit: SLIDER-622 scanning for the DLL on
the path
Repository: incubator-slider
Updated Branches:
refs/heads/feature/SLIDER-622-windows 9b3fd8c0f -> 1d8f3189d
SLIDER-622 scanning for the DLL on the path
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/81402edf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/81402edf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/81402edf
Branch: refs/heads/feature/SLIDER-622-windows
Commit: 81402edfeeb4ac88ffa0c7ac82b71fc3bf952cbc
Parents: 9b3fd8c
Author: Steve Loughran <st...@apache.org>
Authored: Mon Nov 10 20:38:30 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Nov 10 20:38:30 2014 +0000
----------------------------------------------------------------------
.../common/tools/TestWindowsSupport.groovy | 64 +++++++++++++++-----
1 file changed, 50 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/81402edf/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
index cbd79a4..769233e 100644
--- a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
@@ -28,7 +28,6 @@ import org.apache.hadoop.fs.FileSystem as HadoopFS
import org.apache.hadoop.service.ServiceStateException
import org.apache.hadoop.util.Shell
import org.apache.slider.providers.agent.AgentUtils
-import org.apache.slider.test.SliderTestBase
import org.apache.slider.test.YarnMiniClusterTestBase
import org.junit.Test
@@ -68,8 +67,8 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
@Test
public void testPathHandling() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
-
+ assumeWindows()
+
Path path = new Path(windowsFile);
def uri = path.toUri()
// assert "file" == uri.scheme
@@ -95,14 +94,13 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
@Test
public void testSliderFS() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
+ assumeWindows()
SliderFileSystem sfs = new SliderFileSystem(new Configuration())
try {
def metainfo = AgentUtils.getApplicationMetainfo(sfs, windowsFile)
} catch (FileNotFoundException fnfe) {
// expected
}
-
}
@@ -133,10 +131,14 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
}
@Test
public void testExecNonexistentBinary2() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
+ assumeWindows()
assert !doesWindowsAppExist(["undefined-application", "--version"])
}
+ public assumeWindows() {
+ assume(Shell.WINDOWS, "not windows")
+ }
+
@Test
public void testEmitKillCommand() throws Throwable {
@@ -147,20 +149,20 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
@Test
public void testHadoopHomeDefined() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
+ assumeWindows()
def hadoopHome = Shell.hadoopHome
log.info("HADOOP_HOME=$hadoopHome")
}
@Test
public void testHasWinutils() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
+ assumeWindows()
SliderUtils.maybeVerifyWinUtilsValid()
}
@Test
public void testExecWinutils() throws Throwable {
- assume(Shell.WINDOWS, "not windows")
+ assumeWindows()
def winUtilsPath = Shell.winUtilsPath
assert winUtilsPath
File winUtils = new File(winUtilsPath)
@@ -169,11 +171,45 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
exec(0, [winUtilsPath, "systeminfo"])
}
-
@Test
public void testPath() throws Throwable {
- String pathkey;
-
+ String path = extractPath()
+ log.info("Path value = $path")
+ }
+
+ @Test
+ public void testFindJavac() throws Throwable {
+ String name = Shell.WINDOWS ? "javac.exe" : "javac"
+ assert locateExecutable(name)
+ }
+
+ @Test
+ public void testHadoopDLL() throws Throwable {
+ assumeWindows()
+ // split the path
+ File exepath = locateExecutable("HADOOP.DLL")
+ assert exepath
+ log.info "Hadoop DLL at: $exepath"
+ }
+
+ public File locateExecutable(String exe) {
+ File exepath = null
+ String path = extractPath()
+ String[] dirs = path.split(System.getProperty("path.separator"));
+ dirs.each { String dirname ->
+ File dir = new File(dirname)
+
+ File possible = new File(dir, exe)
+ if (possible.exists()) {
+ exepath = possible
+ }
+ }
+ return exepath
+ }
+
+ public String extractPath() {
+ String pathkey = "";
+
System.getenv().keySet().each { String it ->
if (it.toLowerCase(Locale.ENGLISH).equals("path")) {
pathkey = it;
@@ -181,7 +217,7 @@ class TestWindowsSupport extends YarnMiniClusterTestBase {
}
assert pathkey
log.info("Path env variable is $pathkey")
- def pathval = System.getenv(pathkey)
- log.info("Path value = $pathval")
+ def path = System.getenv(pathkey)
+ return path
}
}
[2/2] incubator-slider git commit: SLIDER-622 process exit codes
Posted by st...@apache.org.
SLIDER-622 process exit codes
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1d8f3189
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1d8f3189
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1d8f3189
Branch: refs/heads/feature/SLIDER-622-windows
Commit: 1d8f3189d5edec52fffa858dad6b98ba4c89767c
Parents: 81402ed
Author: Steve Loughran <st...@apache.org>
Authored: Mon Nov 10 20:55:16 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Nov 10 20:55:16 2014 +0000
----------------------------------------------------------------------
.../services/workflow/ForkedProcessService.java | 2 +-
.../server/appmaster/actions/TestActions.groovy | 2 +-
.../apache/slider/test/SliderTestUtils.groovy | 13 +++++++++++--
.../TestWorkflowForkedProcessService.java | 19 ++++++++++++-------
4 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1d8f3189/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
index b801993..9f6b327 100644
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
@@ -264,7 +264,7 @@ public class ForkedProcessService
}
- public int getExitCode() {
+ public Integer getExitCode() {
return process.getExitCode();
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1d8f3189/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
index 7e03e7b..a3a0025 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
@@ -191,7 +191,7 @@ class TestActions {
queues.renewing("note", renewer)
assert queues.removeRenewingAction("note")
queues.stop()
- queues.waitForServiceToStop(10000)
+ assert queues.waitForServiceToStop(10000)
}
public class ActionNoteExecuted extends AsyncAction {
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1d8f3189/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index ad18c72..3688644 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -51,6 +51,8 @@ import org.apache.slider.server.services.workflow.ForkedProcessService
import org.junit.Assert
import org.junit.Assume
+import java.util.concurrent.TimeoutException
+
import static Arguments.ARG_OPTION
/**
@@ -530,7 +532,10 @@ class SliderTestUtils extends Assert {
*/
public static ForkedProcessService exec(int status, List<String> commands) {
ForkedProcessService process = exec(commands)
- assert status == process.exitCode
+
+ def exitCode = process.exitCode
+ assert exitCode != null
+ assert status == exitCode
return process
}
/**
@@ -546,7 +551,11 @@ class SliderTestUtils extends Assert {
commands);
process.init(new Configuration());
process.start();
- process.waitForServiceToStop(10000);
+ int timeoutMillis = 5000
+ if (!process.waitForServiceToStop(timeoutMillis)) {
+ throw new TimeoutException(
+ "Process did not stop in " + timeoutMillis + "mS");
+ }
process
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1d8f3189/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
index cf0afc1..01d5ec9 100644
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
+++ b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
@@ -69,7 +69,9 @@ public class TestWorkflowForkedProcessService extends WorkflowServiceTestBase {
initProcess(commandFactory.ls(testDir));
exec();
assertFalse(process.isProcessRunning());
- assertEquals(0, process.getExitCode());
+ Integer exitCode = process.getExitCode();
+ assertNotNull("null exit code", exitCode);
+ assertEquals(0, exitCode.intValue());
assertStringInOutput("test-classes", getFinalOutput());
// assert that the service did not fail
@@ -83,7 +85,8 @@ public class TestWorkflowForkedProcessService extends WorkflowServiceTestBase {
initProcess(commandFactory.exitFalse());
exec();
assertFalse(process.isProcessRunning());
- int exitCode = process.getExitCode();
+ Integer exitCode = process.getExitCode();
+ assertNotNull("null exit code", exitCode);
assertTrue(exitCode != 0);
int corrected = process.getExitCodeSignCorrected();
assertEquals(1, corrected);
@@ -98,8 +101,9 @@ public class TestWorkflowForkedProcessService extends WorkflowServiceTestBase {
String echoText = "hello, world";
initProcess(commandFactory.echo(echoText));
exec();
-
- assertEquals(0, process.getExitCode());
+ Integer exitCode = process.getExitCode();
+ assertNotNull("null exit code", exitCode);
+ assertEquals(0, exitCode.intValue());
assertStringInOutput(echoText, getFinalOutput());
}
@@ -112,8 +116,9 @@ public class TestWorkflowForkedProcessService extends WorkflowServiceTestBase {
env.put(var, val);
initProcess(commandFactory.env());
exec();
-
- assertEquals(0, process.getExitCode());
+ Integer exitCode = process.getExitCode();
+ assertNotNull("null exit code", exitCode);
+ assertEquals(0, exitCode.intValue());
assertStringInOutput(val, getFinalOutput());
}
@@ -137,7 +142,7 @@ public class TestWorkflowForkedProcessService extends WorkflowServiceTestBase {
public void exec() throws InterruptedException, TimeoutException {
assertNotNull(process);
process.start();
- process.waitForServiceToStop(5000);
+ assert process.waitForServiceToStop(5000);
}
}