Chris Melikian created EXEC-89:
----------------------------------
Summary: Unit tests failing in WIn7 Pro 64-bit with Java 6 and 7
Key: EXEC-89
URL: https://issues.apache.org/jira/browse/EXEC-89
Project: Commons Exec
Issue Type: Bug
Affects Versions: 1.2
Reporter: Chris Melikian
I'm getting errors when running the unit tests in Windows7 Pro 64-bit. I've
tried with both JDK 6 and 7.
Specifically the problem seems to be with getting return codes from running
batch files. Seems like it always returns a zero even when there is an 'exit 1'
or 'exec /b 1' in the batch file.
The main test I need resolving is the
DefaultExecutorTest.testExecuteWithCustomExitValue1 test.
Here's the maven output. Sorry there seems to be no attachment button in this
bug report screen.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Commons Exec 1.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ commons-exec ---
[INFO] Deleting C:\java\commons-exec-1.2-src\target
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (javadoc.resources) @ commons-exec ---
[INFO] Executing tasks
main:
[copy] Copying 2 files to
C:\java\commons-exec-1.2-src\target\apidocs\META-INF
[INFO] Executed tasks
[INFO]
[INFO] --- maven-remote-resources-plugin:1.4:process (default) @ commons-exec
---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.2:create (default) @ commons-exec ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: C:\java\commons-exec-1.2-src
[INFO] Storing buildNumber: ?????? at timestamp: 1413197018890
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: C:\java\commons-exec-1.2-src
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
commons-exec ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
C:\java\commons-exec-1.2-src\src\main\resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ commons-exec
---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 31 source files to C:\java\commons-exec-1.2-src\target\classes
[INFO]
[INFO] --- maven-bundle-plugin:2.4.0:manifest (bundle-manifest) @ commons-exec
---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @
commons-exec ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
C:\java\commons-exec-1.2-src\src\test\resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @
commons-exec ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to
C:\java\commons-exec-1.2-src\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.15:test (default-test) @ commons-exec ---
[INFO] Surefire report directory:
C:\java\commons-exec-1.2-src\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.commons.exec.CommandLineTest
testToStringTroubleshooting
cmd1: [sh, -c, echo 1]
cmd2: [sh, -c, echo, 1]
Tests run: 34, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec - in
org.apache.commons.exec.CommandLineTest
Running org.apache.commons.exec.DefaultExecutorTest
FOO..
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Process completed in 2015 millis; below is its output
Process timed out and was killed by watchdog.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit
value: 1)
Process completed in 2137 millis; below is its output
Process timed out and was killed.
FOO..
The test 'testExec36_1' does not support the following OS : Windows 7
The test 'testSyncInvocationOfBackgroundProcess' does not support the following
OS : Windows 7
Processes terminated: 0 killed: 181 Multiplier: 1 MaxRetries: 180 Elapsed (avg
ms): 1416
FOO..
{java.runtime.name=Java(TM) SE Runtime Environment,
sun.boot.library.path=C:\programs\jdk1.7.0_40\jre\bin,
java.vm.version=24.0-b56, java.vm.vendor=Oracle Corporation,
java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java
HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, user.country=GB,
user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack
1, java.vm.specification.name=Java Virtual Machine Specification,
user.dir=C:\java\commons-exec-1.2-src, java.runtime.version=1.7.0_40-b43,
basedir=C:\java\commons-exec-1.2-src,
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment,
java.endorsed.dirs=C:\programs\jdk1.7.0_40\jre\lib\endorsed, os.arch=amd64,
surefire.real.class.path=C:\java\commons-exec-1.2-src\target\surefire\surefirebooter5986968512479330555.jar,
java.io.tmpdir=C:\Users\CM99904\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=,
os.name=Windows 7, sun.jnu.encoding=Cp1252,
java.library.path=C:\programs\jdk1.7.0_40\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Citrix\ICAService\;C:\Program Files\Citrix\System32\;C:\Program
Files\Citrix\Virtual Desktop
Agent\;C:\Centura\Deploy;C:\Centura\Sybase\Dll;C:\Centura\Sybase\bin;C:\Program
Files (x86)\Enterprise Vault\EVClient\;C:\Program Files\TortoiseSVN\bin;.,
surefire.test.class.path=C:\java\commons-exec-1.2-src\target\test-classes;C:\java\commons-exec-1.2-src\target\classes;C:\apache\maven\repository\junit\junit\3.8.1\junit-3.8.1.jar;,
java.specification.name=Java Platform API Specification,
java.class.version=51.0, sun.management.compiler=HotSpot 64-Bit Tiered
Compilers, os.version=6.1, user.home=\\vwnhome01\CM99904$\Profile,
user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob,
file.encoding=Cp1252, java.specification.version=1.7,
java.class.path=C:\java\commons-exec-1.2-src\target\test-classes;C:\java\commons-exec-1.2-src\target\classes;C:\apache\maven\repository\junit\junit\3.8.1\junit-3.8.1.jar;,
user.name=CM99904, java.vm.specification.version=1.7,
sun.java.command=C:\java\commons-exec-1.2-src\target\surefire\surefirebooter5986968512479330555.jar
C:\java\commons-exec-1.2-src\target\surefire\surefire3153910831053150957tmp
C:\java\commons-exec-1.2-src\target\surefire\surefire_01646269631744395942tmp,
java.home=C:\programs\jdk1.7.0_40\jre, sun.arch.data.model=64,
org.apache.commons.exec.lenient=false, user.language=en,
java.specification.vendor=Oracle Corporation,
awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode,
java.version=1.7.0_40,
java.ext.dirs=C:\programs\jdk1.7.0_40\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext,
sun.boot.class.path=C:\programs\jdk1.7.0_40\jre\lib\resources.jar;C:\programs\jdk1.7.0_40\jre\lib\rt.jar;C:\programs\jdk1.7.0_40\jre\lib\sunrsasign.jar;C:\programs\jdk1.7.0_40\jre\lib\jsse.jar;C:\programs\jdk1.7.0_40\jre\lib\jce.jar;C:\programs\jdk1.7.0_40\jre\lib\charsets.jar;C:\programs\jdk1.7.0_40\jre\lib\jfr.jar;C:\programs\jdk1.7.0_40\jre\classes,
java.vendor=Oracle Corporation, localRepository=C:\apache\maven\repository,
file.separator=\, org.apache.commons.exec.debug=true,
java.vendor.url.bug=http://bugreport.sun.com/bugreport/,
sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little,
sun.desktop=windows, sun.cpu.isalist=amd64}
The code samples to do that in windows look like a joke ... :-( .., no way I'm
doing that
The test 'testExecuteWithRedirectedStreams' does not support the following OS :
Windows 7
"gdal_translate"
"HDF5:"/home/kk/grass/data/4404.he5"://HDFEOS/GRIDS/OMI_Column_Amount_O3/Data_Fields/ColumnAmountO3/home/kk/4.tif"
Tests run: 41, Failures: 4, Errors: 1, Skipped: 0, Time elapsed: 325.935 sec
<<< FAILURE! - in org.apache.commons.exec.DefaultExecutorTest
testExecuteWithError(org.apache.commons.exec.DefaultExecutorTest) Time
elapsed: 0.25 sec <<< FAILURE!
junit.framework.AssertionFailedError: Must throw ExecuteException
at junit.framework.Assert.fail(Assert.java:47)
at
org.apache.commons.exec.DefaultExecutorTest.testExecuteWithError(DefaultExecutorTest.java:141)
testExecuteAsyncWithError(org.apache.commons.exec.DefaultExecutorTest) Time
elapsed: 0.374 sec <<< FAILURE!
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertTrue(Assert.java:27)
at
org.apache.commons.exec.DefaultExecutorTest.testExecuteAsyncWithError(DefaultExecutorTest.java:201)
testExec_60(org.apache.commons.exec.DefaultExecutorTest) Time elapsed: 256.424
sec <<< FAILURE!
junit.framework.AssertionFailedError: Not a single process terminated on its own
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at
org.apache.commons.exec.DefaultExecutorTest.testExec_60(DefaultExecutorTest.java:1122)
testExecuteWithCustomExitValue1(org.apache.commons.exec.DefaultExecutorTest)
Time elapsed: 0.266 sec <<< ERROR!
org.apache.commons.exec.ExecuteException: Process exited with an error: 0 (Exit
value: 0)
at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:402)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:164)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:151)
at
org.apache.commons.exec.DefaultExecutorTest.testExecuteWithCustomExitValue1(DefaultExecutorTest.java:399)
testExecuteWithCustomExitValue2(org.apache.commons.exec.DefaultExecutorTest)
Time elapsed: 0.265 sec <<< FAILURE!
junit.framework.AssertionFailedError: Must throw ExecuteException
at junit.framework.Assert.fail(Assert.java:47)
at
org.apache.commons.exec.DefaultExecutorTest.testExecuteWithCustomExitValue2(DefaultExecutorTest.java:413)
Running org.apache.commons.exec.environment.EnvironmentUtilTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in
org.apache.commons.exec.environment.EnvironmentUtilTest
Running org.apache.commons.exec.LogOutputStreamTest
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\CM99904\AppData\Roaming
CENTURA_TEMP=C:\centura
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
COMMONPROGRAMW6432=C:\Program Files\Common Files
COMPUTERNAME=LG012699
COMSPEC=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=H:
HOMEPATH=\
HOMESHARE=\\vwnhome01\CM99904$
JAVA_HOME=C:\programs\jdk1.7.0_40
LOCALAPPDATA=C:\Users\CM99904\AppData\Local
LOGONSERVER=\\XWNDCCS03
M2_HOME=C:\programs\apache-maven-3.0.5
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Citrix\ICAService\;C:\Program Files\Citrix\System32\;C:\Program
Files\Citrix\Virtual Desktop
Agent\;C:\Centura\Deploy;C:\Centura\Sybase\Dll;C:\Centura\Sybase\bin;C:\Program
Files (x86)\Enterprise Vault\EVClient\;C:\Program Files\TortoiseSVN\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=2a07
PROGRAMDATA=C:\ProgramData
PROGRAMFILES=C:\Program Files
PROGRAMFILES(X86)=C:\Program Files (x86)
PROGRAMW6432=C:\Program Files
PROMPT=$P$G
PSMODULEPATH=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program
Files\Microsoft Application Virtualization\Client\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SYBASE=C:\Centura\Sybase
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=C:\Users\CM99904\AppData\Local\Temp
TMP=C:\Users\CM99904\AppData\Local\Temp
UATDATA=C:\WINDOWS\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77
USERDNSDOMAIN=INV.ADROOT.LGIM.COM
USERDOMAIN=INV
USERNAME=CM99904
USERPROFILE=C:\Users\CM99904
WALKAWAYPATH=C:\Program Files (x86)\Imprivata\OneSign Agent\
WINDIR=C:\WINDOWS
WINDOWS_TRACING_FLAGS=3
WINDOWS_TRACING_LOGFILE=C:\BVTBin\Tests\installpackage\csilogfile.log
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.265 sec - in
org.apache.commons.exec.LogOutputStreamTest
Running org.apache.commons.exec.StandAloneTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in
org.apache.commons.exec.StandAloneTest
Running org.apache.commons.exec.TestUtilTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in
org.apache.commons.exec.TestUtilTest
Running org.apache.commons.exec.TutorialTest
[main] Preparing print job ...
[print] Executing blocking print job ...
"[acrord32] Printing the following document : '"C:\Documents and
Settings\foo.pdf"'"
"[acrord32] Finished printing"
org.apache.commons.exec.ExecuteException: Process exited with an error: 0 (Exit
value: 0)
at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:402)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:164)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:151)
at org.apache.commons.exec.TutorialTest.print(TutorialTest.java:113)
at
org.apache.commons.exec.TutorialTest.testTutorialExample(TutorialTest.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at
org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:131)
at
org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:108)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 9.455 sec <<<
FAILURE! - in org.apache.commons.exec.TutorialTest
testTutorialExample(org.apache.commons.exec.TutorialTest) Time elapsed: 9.455
sec <<< FAILURE!
junit.framework.AssertionFailedError: [main] Printing of the following document
failed : C:\Documents and Settings\foo.pdf
at junit.framework.Assert.fail(Assert.java:47)
at
org.apache.commons.exec.TutorialTest.testTutorialExample(TutorialTest.java:60)
Running org.apache.commons.exec.util.MapUtilTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in
org.apache.commons.exec.util.MapUtilTest
Running org.apache.commons.exec.util.StringUtilTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in
org.apache.commons.exec.util.StringUtilTest
Results :
Failed tests:
org.apache.commons.exec.DefaultExecutorTest#testExecuteWithError
AssertionFailedError
org.apache.commons.exec.DefaultExecutorTest#testExecuteAsyncWithError
AssertionFailedError
org.apache.commons.exec.DefaultExecutorTest#testExec_60 AssertionFailedError
N...
org.apache.commons.exec.DefaultExecutorTest#testExecuteWithCustomExitValue2
AssertionFailedError
org.apache.commons.exec.TutorialTest#testTutorialExample AssertionFailedError
...
Tests in error:
org.apache.commons.exec.DefaultExecutorTest#testExecuteWithCustomExitValue1
ExecuteException
Tests run: 96, Failures: 5, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:41.153s
[INFO] Finished at: Mon Oct 13 11:49:18 BST 2014
[INFO] Final Memory: 18M/251M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on
project commons-exec: There are test failures.
[ERROR]
[ERROR] Please refer to C:\java\commons-exec-1.2-src\target\surefire-reports
for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)