-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Platform: All, OS: All
AppTest fails under windows.
analysis:
changing the the offending test assert from
assertTrue(s.contains("+ echo hello"));
to
assertTrue(s,s.contains("+ echo hello"));
to show more information.
Rerun and the test log contains
----------
-------------------------------------------------------------------------------
Test set: org.jvnet.hudson.main.AppTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.781 sec <<<
FAILURE!
test1(org.jvnet.hudson.main.AppTest) Time elapsed: 0.281 sec <<< FAILURE!
junit.framework.AssertionFailedError: started
[workspace] $ sh -xe C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31019.sh
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory
"C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31014test\jobs\test\workspace"):
CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at hudson.Proc$LocalProc.<init>(Proc.java:104)
at hudson.Proc$LocalProc.<init>(Proc.java:82)
at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:311)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:302)
at hudson.Launcher.launch(Launcher.java:140)
at hudson.Launcher.launch(Launcher.java:92)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:34)
at hudson.model.Build$RunnerImpl.build(Build.java:138)
at hudson.model.Build$RunnerImpl.doRun(Build.java:113)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:241)
at hudson.model.Run.run(Run.java:817)
at hudson.model.Build.run(Build.java:88)
at hudson.model.ResourceController.execute(ResourceController.java:70)
at hudson.model.Executor.run(Executor.java:88)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find
the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 15 more
finished: FAILURE
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at org.jvnet.hudson.main.AppTest.meat(AppTest.java:38)
at org.jvnet.hudson.main.AppTest.test1(AppTest.java:19)
----------
therefore the problem is that the test adds a Shell action which doesn't work
under windows.
Fix:
If running under windows, use a BatchFile action instead of a shell action.
In this case the log contains "echo hello" but not "+ echo hello" so change the
assert subtly to match both cases.