ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: path & fileset question
Date Mon, 27 Aug 2007 14:35:14 GMT

--- Krzysztof Kucybała <kkucybala@echo.fr> wrote:

> 
> 
> Matt Benson wrote:
> > --- Krzysztof Kucybała <kkucybala@echo.fr>
> wrote:
> > 
> >> Hi,
> >>
> >> I have a big problem. I'm trying to have ant run
> >> phpunit and phpunit2 
> >> tests. To achieve that I'm using an exec task. It
> >> was running smoothly 
> >> until I tried to execute multiple files which
> were
> >> not known at design 
> >> time - the contents of a directory for tests.
> When I
> >> used a fileset to 
> >> determine the necessary files to execute, I would
> >> get them with their 
> >> whole absolute paths. Maybe this would be ok in
> >> other circumstances, but 
> >> in my case that's not really so good.
> >>
> >> When I now execute my phpunit tests on that file,
> it
> >> says it can't find 
> >> the class by the name "<<and here comes the whole
> >> path instead of just 
> >> the file name>>". Does anyone know of any
> reasonable
> >> solution to this? I 
> >> don't want to list the files by hand, as I'd have
> to
> >> change the file 
> >> everytime someone adds a new test.
> >>
> > 
> > Are you using <apply> to do this, or what?  If so,
> > there is a 'relative' attribute that could help
> you. 
> > Beyond that you can look into solutions that use
> > filename mappers, or use a scripting language (or
> Java
> > for that matter) to work against Ant's API; a
> > DirectoryScanner, when used "legacy-style," will
> give
> > you matching files as paths relative to a
> fileset's
> > basedir.
> > 
> 
> Until I read Your email I was using exec. Then I
> tried the apply task, 
> but without significant results. I managed to get
> the test running once, 
> but then I couldn't get the xml log out of that run.
> For some strange 
> reason this:
> 
> <apply executable="phpunit2"
> 	dir="${deploy_path}/unit2"
> 	dest="${log_dir}"
> 	addsourcefile="false"
> 	relative="true"
> 	output="${log_dir}/test.dump"
> 	logError="true"
> 	append="true"
> 	verbose="true"
> 	failonerror="true">
> 
> <mapper type="glob" from="*.php"
> to="*.php.log.xml"/>
> <fileset dir="${deploy_path}/unit2">
> 	<include name="**/*test.php"/>
> 	<include name="**/*Test.php"/>
> </fileset>
> <arg value="--log-xml"/>
> <targetfile/>
> <srcfile/>			
> </apply>
> 
> wouldn't work. According to the docs, it should
> translate into this command:
> 
> phpunit2 --log-xml MyTest.php.log.xml MyTest.php

Looks right, except that your <srcfile> element
shouldn't be needed if you want the source file at the
end of the command.

> 
> (or am I not correct in this assumption?) but the
> result I see in the 
> ant log files is utterly different. It looks as if
> the phpunit2 exec was 
> invoked without this last parameter - MyTest.php. If
> I change 
> "addsourcefile" into true, the tests get run, but

"addsourcefile" defaults to true, so you shouldn't
have to specify this attribute unless you need to
suppress the source file.

> the logs don't get 
> written. My guess is that it's because arg
> value="--log-xml" is passed 
> as a single argument, and targetfile as another,
> whereas they should 
> actually be a single command line argument. Do You
> know how to achieve 
> that?
> 

That seems a little strange, but I'll take your word
for it as I know nothing about phpunit.  The obvious
(to me, anyway; sorry) way to get the target filename
and the --log whatever that was switch together is to
add the switch to your mapper.  But somehow I am
afraid this may not be the issue.  Just make sure your
<apply> command matches what you've posted here and
that the verbose log makes sense given what's in your
buildfile, and feel free to check back in here until
we narrow down what's happening.

-Matt

> Best regards,
> Krzysztof
> > HTH,
> > Matt
> > 
> >> Best regards,
> >> Krzysztof
> >>
> >>
> >
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> user-unsubscribe@ant.apache.org
> >> For additional commands, e-mail:
> >> user-help@ant.apache.org
> >>
> >>
> > 
> > 
> > 
> >        
> >
>
____________________________________________________________________________________
> > Building a website is a piece of cake. Yahoo!
> Small Business gives you all the tools to get
> online.
> > http://smallbusiness.yahoo.com/webhosting 
> > 
> >
>
---------------------------------------------------------------------
> > 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
> 
> 



       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

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


Mime
View raw message