How to run tests while building a port?

Ryan Schmidt ryandesign at macports.org
Fri Aug 15 09:02:00 PDT 2014


On Aug 15, 2014, at 5:50 AM, Mojca Miklavec wrote:

> On Fri, Aug 15, 2014 at 9:44 AM, Rainer Müller wrote:
>> On 2014-08-15 08:37, Mojca Miklavec wrote:
>>> I know that I can run "[sudo] port test p5.20-foo" to run the tests,
>>> but that usually requires rebuilding the whole port.
>>> 
>>> I also know that one could add "test.run yes" to the port, but that
>>> requires modifications to the port.
>> 
>> This option is a pre-requisite for 'port test' to work. If a port can be
>> tested automatically, the Portfile should indicate that.
> 
> Oh. I thought that "test.run yes" meant "always run the tests".

"test.run yes" means "you can run 'sudo port test' to run the tests". Trying to run "sudo port test" without "test.run yes" in the portfile will generate an error that running tests is not supported by this port.


> But it seems that the option is automagically added to the Perl modules already.

Yes, the perl5 portgroup sets "test.run yes". I guess perl modules are required to have tests.


>>> Is there any shortcut to build + test + install at the same time
>>> without modifying the port?
>> 
>> You can also override many of the Portfile options on the command line,
>> for example like this:
>> 
>>  sudo port test p5.20-foo test.run=yes
>> 
>> There is no way to do an install with the tests other than running
>> separate commands for 'port test' and then 'port install'.
> 
> It would be nice if there was a way to run tests with a single command.
> 
> Also, it might be handy to have "depends_test" available.

Agreed. It's been filed but no evidence anybody's worked on it yet.

https://trac.macports.org/ticket/38208



More information about the macports-dev mailing list