[Webtest] webtest.bat minor bug

Petter Måhlén webtest@lists.canoo.com
Thu, 6 Apr 2006 15:15:28 +0200


Hi,

I call webtest.bat like this from an ant build script:

   <target name="run-webtest" description="runs Canoo webtests">
        <exec executable="${webtest.runner}" dir="test/webtest/tests"
failonerror="true">
           <arg value="-buildfile" />
           <arg value="MainTestSuite.xml" />
        </exec>
   </target>

The explicit 'failonerror' is there in order to make sure that the build is
registered as a failure if things go wrong. This works fine on our Linux
build machine, but when I run it on my Windows work station, it doesn't. The
problem is that webtest.bat ends with these rows:

---
set EXEC=%JAVA_CMD% %JAVA_OPTS% -cp "%RT_LIB%\ant-launcher.jar"
-Dant.library.dir="%RT_LIB%" org.apache.tools.ant.launch.Launcher -nouserlib
-lib "%CLOVER_LIB%" %*
echo %EXEC%

%EXEC%
@endlocal
---

I guess that the exit code of "@endlocal" is always 0, meaning that even if
'java' returns a non-zero exit code, webtest.bat will always return 0,
telling Ant that everything is OK. I propose just removing the "@endlocal",
since, according to Microsoft "there is an implicit endlocal command at the
end of a batch file."
(http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs=
/en
-us/ntcmds_shelloverview.mspx?mfr=true)

That's what I've done locally, at least. And when my tests break, I get
BUILD FAILED message, just like I want. :)

/ Petter

Cell: +46 704 40 30 25
Direct: +46 8 442 75 95
Fax: +46 8 24 05 08
www.jadestone.se
Björns Trädgårdsgränd 1, 116 21 Stockholm, Sweden