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/10/30 15:38:38 UTC
[1/4] git commit: SLIDER-581 ensure that exit codes come back on
funtests on windows
Repository: incubator-slider
Updated Branches:
refs/heads/develop 05cf89828 -> a19c50525
SLIDER-581 ensure that exit codes come back on funtests on windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/2d953fff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/2d953fff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/2d953fff
Branch: refs/heads/develop
Commit: 2d953fff1f3d65dc19e4d0fb41ea9fd394de00d5
Parents: 05cf898
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 30 14:23:34 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 30 14:23:34 2014 +0000
----------------------------------------------------------------------
.../slider/funtest/framework/SliderShell.groovy | 15 +++++--
.../funtest/commands/CommandExitCodesIT.groovy | 43 ++++++++++++++++++++
.../funtest/commands/ListCommandIT.groovy | 2 +-
.../commands/UnknownClusterOperationsIT.groovy | 2 -
4 files changed, 55 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2d953fff/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
index 15bf339..c101cfa 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
@@ -240,18 +240,25 @@ class SliderShell extends Shell {
* @return Shell object for chaining
*/
Shell exec(Object... args) {
- def proc = "$shell".execute()
+ Process proc = "$shell".execute()
script = args.join("\n")
LOG.debug("${shell} << __EOT__\n${script}\n__EOT__");
+ ByteArrayOutputStream baosErr = new ByteArrayOutputStream(4096);
+ ByteArrayOutputStream baosOut = new ByteArrayOutputStream(4096);
+ proc.consumeProcessOutput(baosOut, baosErr)
Thread.start {
def writer = new PrintWriter(new BufferedOutputStream(proc.out))
writer.println(script)
+ writer.flush()
+ if (org.apache.hadoop.util.Shell.WINDOWS) {
+ // Ensure the errorlevel returned by last call is set for the invoking shell
+ writer.println("@echo ERRORLEVEL=%ERRORLEVEL%")
+ writer.println("@exit %ERRORLEVEL%")
+ writer.flush()
+ }
writer.close()
}
- ByteArrayOutputStream baosErr = new ByteArrayOutputStream(4096);
- ByteArrayOutputStream baosOut = new ByteArrayOutputStream(4096);
- proc.consumeProcessOutput(baosOut, baosErr)
proc.waitFor()
ret = proc.exitValue()
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2d953fff/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
new file mode 100644
index 0000000..c49c738
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.commands
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.slider.common.SliderExitCodes
+import org.apache.slider.core.main.LauncherExitCodes
+import org.apache.slider.funtest.framework.CommandTestBase
+import org.junit.Test
+
+@CompileStatic
+@Slf4j
+public class CommandExitCodesIT extends CommandTestBase {
+
+ @Test
+ public void testHelp() throws Throwable {
+ slider(0, ["help"])
+ }
+
+ @Test
+ public void testStopWithoutCluster() throws Throwable {
+ slider(LauncherExitCodes.EXIT_COMMAND_ARGUMENT_ERROR, ["stop"])
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2d953fff/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
index 7ba7fc0..c65280a 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
@@ -36,7 +36,7 @@ public class ListCommandIT extends CommandTestBase {
@Test
public void testListAllLive() throws Throwable {
def shell = list("--live")
- assert shell.ret == 0 || shell.ret ==1
+ assert shell.ret == 0 || shell.ret == 1
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2d953fff/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/UnknownClusterOperationsIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/UnknownClusterOperationsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/UnknownClusterOperationsIT.groovy
index 6eaf54a..5515894 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/UnknownClusterOperationsIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/UnknownClusterOperationsIT.groovy
@@ -21,7 +21,6 @@ package org.apache.slider.funtest.commands
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.funtest.categories.FunctionalTests
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
import org.apache.slider.funtest.framework.CommandTestBase
@@ -33,7 +32,6 @@ import org.junit.Test
*/
@CompileStatic
@Slf4j
-@org.junit.experimental.categories.Category(FunctionalTests)
public class UnknownClusterOperationsIT extends CommandTestBase {
public static final String UNKNOWN = "unknown_cluster"
[4/4] git commit: Merge branch
'feature/SLIDER-581_funtest_return_values_on_windows' into develop
Posted by st...@apache.org.
Merge branch 'feature/SLIDER-581_funtest_return_values_on_windows' into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/a19c5052
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/a19c5052
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/a19c5052
Branch: refs/heads/develop
Commit: a19c50525e922214d0a52b1d99e9e90be51f7645
Parents: 05cf898 ef516d9
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 30 14:38:29 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 30 14:38:29 2014 +0000
----------------------------------------------------------------------
.../slider/funtest/framework/SliderShell.groovy | 16 +++++---
.../funtest/commands/CommandExitCodesIT.groovy | 43 ++++++++++++++++++++
.../funtest/commands/ListCommandIT.groovy | 2 +-
.../commands/UnknownClusterOperationsIT.groovy | 2 -
4 files changed, 55 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
[2/4] git commit: SLIDER-581 moving where the exit codes are set
up/using non superclass exec
Posted by st...@apache.org.
SLIDER-581 moving where the exit codes are set up/using non superclass exec
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/518d7508
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/518d7508
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/518d7508
Branch: refs/heads/develop
Commit: 518d7508c239692db60722fb2cbe9805551b66f0
Parents: 2d953ff
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 30 14:34:33 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 30 14:34:33 2014 +0000
----------------------------------------------------------------------
.../apache/slider/funtest/framework/SliderShell.groovy | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/518d7508/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
index c101cfa..43ac477 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy
@@ -79,9 +79,14 @@ class SliderShell extends Shell {
List<String> commandLine = buildEnvCommands()
commandLine << command
+ if (org.apache.hadoop.util.Shell.WINDOWS) {
+ // Ensure the errorlevel returned by last call is set for the invoking shell
+ commandLine << "@echo ERRORLEVEL=%ERRORLEVEL%"
+ commandLine << "@exit %ERRORLEVEL%"
+ }
String script = commandLine.join("\n")
log.debug(script)
- super.exec(script);
+ exec(script);
signCorrectReturnCode()
return ret;
}
@@ -251,12 +256,6 @@ class SliderShell extends Shell {
def writer = new PrintWriter(new BufferedOutputStream(proc.out))
writer.println(script)
writer.flush()
- if (org.apache.hadoop.util.Shell.WINDOWS) {
- // Ensure the errorlevel returned by last call is set for the invoking shell
- writer.println("@echo ERRORLEVEL=%ERRORLEVEL%")
- writer.println("@exit %ERRORLEVEL%")
- writer.flush()
- }
writer.close()
}
[3/4] git commit: SLIDER-581 moving where the exit codes are set
up/using non superclass exec
Posted by st...@apache.org.
SLIDER-581 moving where the exit codes are set up/using non superclass exec
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ef516d9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ef516d9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ef516d9c
Branch: refs/heads/develop
Commit: ef516d9cd704beb84fda08df4b510ca58c906c40
Parents: 518d750
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 30 14:37:10 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 30 14:37:10 2014 +0000
----------------------------------------------------------------------
.../org/apache/slider/funtest/commands/CommandExitCodesIT.groovy | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ef516d9c/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
index c49c738..73912e6 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
@@ -36,7 +36,7 @@ public class CommandExitCodesIT extends CommandTestBase {
@Test
public void testStopWithoutCluster() throws Throwable {
- slider(LauncherExitCodes.EXIT_COMMAND_ARGUMENT_ERROR, ["stop"])
+ slider(LauncherExitCodes.EXIT_COMMAND_ARGUMENT_ERROR, ["stop"]).dumpOutput()
}