On Fri, Jun 13, 2014 at 3:04 PM, Dan Duvall <[email protected]> wrote:
> > > > 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? > > would probably work as well. When i wrote this script i already had the make() stuff in my .bashrc so i could also use make from the command line. The pre-commit script[1] was written based off that, just looks at the commit to figure out which make commands to run, then calls make. [1] https://github.com/wikimedia/mediawiki-extensions-Flow/blob/master/scripts/pre-review Also, instead of crawling parent directories for the Vagrantfile, you could > use `if (which vagrant && vagrant status) &> /dev/null; then ...`. > > would also work, but on my system just `vagrant status` takes >1s which is not horrible, but is noticeable when run so often. For that reason i went for a check that could operate without booting ruby and loading all the vagrant code. Cheers, > Dan > > On Fri, Jun 13, 2014 at 2:35 PM, Erik Bernhardson < > [email protected]> wrote: > > > On Fri, Jun 13, 2014 at 12:49 PM, Jon Robson <[email protected]> > 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 <[email protected]> > > > 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 > > > > [email protected] > > > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > > > > > > > > > > > > -- > > > Jon Robson > > > * http://jonrobson.me.uk > > > * https://www.facebook.com/jonrobson > > > * @rakugojon > > > > > > _______________________________________________ > > > Wikitech-l mailing list > > > [email protected] > > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > > > > > _______________________________________________ > > Wikitech-l mailing list > > [email protected] > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > > > > > > -- > Dan Duvall > Automation Engineer > Wikimedia Foundation <http://wikimediafoundation.org> > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
