I use a horrible hack, essentially we run the tests from a pre-commit hook with `make phpunit`, but we redefine make as:
This might be naive of me, given I don't know specifically how you maintain your hooks, but why not modify the pre-commit hook to conditionally execute over the vagrant ssh tunnel instead of hijacking make?
Also, instead of crawling parent directories for the Vagrantfile, you could use `if (which vagrant && vagrant status) &> /dev/null; then ...`.
Cheers, Dan
On Fri, Jun 13, 2014 at 2:35 PM, Erik Bernhardson < ebernhardson@wikimedia.org> wrote:
On Fri, Jun 13, 2014 at 12:49 PM, Jon Robson jdlrobson@gmail.com wrote:
I would like to run the phpunit tests from inside my host OS though... I have pre-commit hook I rely on to run phpunit tests before submitting... how can I do that now?
I use a horrible hack, essentially we run the tests from a pre-commit hook with `make phpunit`, but we redefine make as:
make() { if is_vagrant; then vagrant ssh -- cd /vagrant/mediawiki/extensions/Flow '&&' sudo su www-data -c "'make $*'" || exit 1 else /usr/bin/env make $* || exit 1 fi }
where the is_vagrant function duplicates the vagrant functionality of looking at all parent directories for a Vagrantfile
On Fri, Jun 13, 2014 at 11:45 AM, Dan Duvall dduvall@wikimedia.org wrote:
Jon,
From the looks of it, you may be invoking the tests from your host OS,
not
the Vagrant-managed VM. Trying logging in to the VM using `vagrant ssh`
and
executing the tests from there.
master x ~/git/vagrant $ vagrant ssh ... vagrant@mediawiki-vagrant:~$ cd /vagrant/mediawiki/tests/phpunit vagrant@mediawiki-vagrant:/vagrant/mediawiki/tests/phpunit$ php phpunit.php
If you still have problems with it, feel free to come grab me and we
can
troubleshoot it further.
On a related note, I'll be working on improving the mediawiki-vagrant browser tests setup for MobileFrontend in the coming weeks. It'd be
great
to have you, or someone else on the mobile team, vet the improvements.
Cheers, Dan
-- Dan Duvall Automation Engineer Wikimedia Foundation http://wikimediafoundation.org _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- Jon Robson
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l