ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam R. B. Jack" <aj...@trysybase.com>
Subject Forking JUnit (was Re: Ant not passing System values to JUnit task)
Date Tue, 02 Dec 2003 18:19:25 GMT
Sorry, but this caught my eye & reminded me of this issue that exists on
Gump's that run (typically on Linux) without an X server available. I
believe it is a known JDK issue:

[junit] Testcase:
testBitmapJPEG(org.krysalis.barcode.cli.CommandLineTestCase):	Caused an
ERROR
    [junit] Can't connect to X11 window server using ':0.0' as the value of
the DISPLAY variable.
    [junit] java.lang.InternalError: Can't connect to X11 window server
using ':0.0' as the value of the DISPLAY variable.
    [junit] 	at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    [junit] 	at
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
    [junit] 	at java.lang.Class.forName0(Native Method)
    [junit] 	at java.lang.Class.forName(Class.java:141)
    [junit] 	at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment
.java:62)
    [junit]

So, I attempt to work around it by passing -Djava.awt.headless=true:
java -Djava.awt.headless=true
        -Xbootclasspath/p:/data/gump/xml-xerces2/java/build/xercesImpl.jar:/
data/gump/xml-xerces2/java/build/xmlParserAPIs.jar:/data/gump/xml-xalan/java
/build/xalan-unbundled.jar:/data/gump/xml-commons/java/external/build/xml-ap
is.jar








org.apache.tools.ant.Main -debug -Dbuild.sysclasspath=only -DDATE_STAMP=2003
1202
        gump However when the called ant script forks (I assume) a junit
run, the same error comes
back.http://lsd.student.utwente.nl/gump/krysalis-barcode/work/build_krysalis
-barcode_krysalis-barcode.html


Does Ant have any control over the way the forked JVM is created? Is there
any way to influence this without expecting the user to write script changes
& rely upon 'environment portal' scripts?

Thanks in advance.

regards,

Adam
----- Original Message ----- 
From: "Peter Reilly" <peter.reilly@corvil.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Tuesday, December 02, 2003 10:24 AM
Subject: Re: Ant not passing System values to JUnit task


> Your build script did not come thu.
>
> However
>   setting -Dx=y on the ant.bat or ant shell script does *not* set a
> system property.
>   It sets an ant property.
>
>   To set the system property in the for the <junit> task, you need to
>   use the nested element <sysproperty>.
>
> <junit>
>   <sysproperty key="active.level" value="${active.level}"/>
>   <test name="my.test.TestCase"/>
> </junit>
>
> Peter
>
> Dubois, Jeff wrote:
>
> >When doing an Ant build of my project (see attached myBuild.xml script)
It
> >appears that ant is not passing System variables/values when executing
the
> >JUnit task.  I am on Windows using Ant 1.5.3.
> >
> >For my JUnit test cases to succeed I need a VM/System variable called
> >"active.level" set to "dev"..  When executing Ant (via a batch file) I
pass
> >in the value of "active.level" via a "-Dactive.level=dev" argument on the
> >command line.
> >In my ant script I echo out the value of "active.level" and indeed it is
set
> >to "dev" (see runUnitTest target in attached script).
> >
> >However, when I run the Unit test, this "active.level" variable is no
longer
> >set.  I verified this by printing out the value of "active.level" in one
of
> >the Java test cases that get run.
> >    The code I use is:
> >           System.out.println( "active.level is: " +
> >System.getProperty("active.level"));
> >The corresponding output when run through ant is:
> >          [junit] active.level is: null
> >By default are not all System variables supposed to be passed to the
JUnit
> >task?
> >
> >Thanks!
> >    Jeff
> >
> >
> > <<myBuild.xml>>
> >
> >
> >
> >------------------------------------------------------------------------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >For additional commands, e-mail: user-help@ant.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message