You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Morten Grum, PH-Consult" <mg...@phc.dk> on 2004/01/12 09:01:48 UTC

user.dir problem with dll through junit

Hi All

When running junit via ant I set the user dir using
            <sysproperty key="user.dir" value="${testrun}"/>
in the junit task (see full task below).

My java code loads a *.dll library which also needs to know the same user
dir. However, running through ant's junit task it seems as if the *.dll is
running in a different user dir (not having the code for the *.dll I haven't
been able to detect which). When I run my java code directly from the promt
there's no problem at all (the *.dll library then also knows the correct
user directory).

How could I in my tests get the *.dll library to run in the same correct
"user.dir"?
Any hits?

Thanks in advance.

Morten

PS: my junit task looks like this:
    <target name="test" depends="testdirectories"
        description="Test the distribution with JUnit" >

        <!-- Run tests with JUnit -->
        <junit fork="on" dir="${build}" showoutput="true">
            <classpath refid="testlibs" />
            <classpath path="${build.testclasses}" />
            <classpath path="${project.jar}" />
            <formatter type="xml" />
            <jvmarg line="-Xmx256m -Xss8192k" />
            <test name="${testtorun}" />
            <sysproperty key="user.dir" value="${testrun}"/>
        </junit>
    </target>



========================================
Morten Grum
PH-Consult
OrdruphĂžjvej 4
2920 Charlottenlund
Denmark

Tel.: +45 39 96 22 03
Mob.: +45 40 93 43 84
Fax.: +45 39 63 02 72
Mail: mg@phc.dk
Web : www.phc.dk
========================================


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


Re: user.dir problem with dll through junit

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 12 Jan 2004, Morten Grum <mg...@phc.dk> wrote:

> How could I in my tests get the *.dll library to run in the same
> correct "user.dir"?  Any hits?

Use <junit>'s dir attribute to really change the current working
directory.

Stefan

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