{"thread":{"id":"37089","subject":"[PATCH] makefile: add ability to run specific test files","startedAt":"2014-07-09T22:36:52Z","lastAt":"2014-07-10T22:31:27Z","messageCount":7,"participants":["Jacob Keller","Junio C Hamano","Keller, Jacob E","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"245672","messageId":"1404945412-10197-2-git-send-email-jacob.e.keller@intel.com","threadId":"37089","inReplyTo":null,"subject":"[PATCH] makefile: add ability to run specific test files","fromName":"Jacob Keller","fromEmail":"jacob.e.keller@intel.com","sentAt":"2014-07-09T22:36:52Z","receivedAt":"2014-07-09T22:36:52Z","isPatch":true,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"Running a specific test file manually does not obtain the exact\nenvironment setup by the Makefile. Add ability to run any of the tests\nin the t/ directory so that a user can more quickly debug a failing\ntest. Otherwise, the entire test suite needs to be run, which can take a\nvary long time.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n Makefile | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 07ea1058379a..86bdc4ed1ee9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2262,13 +2262,18 @@ export TEST_NO_MALLOC_CHECK\n \n ### Testing rules\n \n+T = $(sort $(wildcard t/t[0-9][0-9][0-9][0-9]-*.sh))\n+\n+$(T):\n+\t$(MAKE) -C t $(notdir $@)\n+\n test: all\n \t$(MAKE) -C t/ all\n \n perf: all\n \t$(MAKE) -C t/perf/ all\n \n-.PHONY: test perf\n+.PHONY: test perf $(T)\n \n test-ctype$X: ctype.o\n \n-- \n2.0.1.475.g9b8d714\n"},{"id":"245673","messageId":"xmqq61j69m0m.fsf@gitster.dls.corp.google.com","threadId":"37089","inReplyTo":"1404945412-10197-2-git-send-email-jacob.e.keller@intel.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-07-09T22:59:21Z","receivedAt":"2014-07-09T22:59:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jacob Keller <jacob.e.keller@intel.com> writes:\n\n> Running a specific test file manually does not obtain the exact\n> environment setup by the Makefile.\n\nWhat kind of things are missing, exactly?  Perhaps that is something\nyou need to fix, instead of mucking with the top-level Makefile.\n\nI recall last time when I did a patch like this I was told to look\ninto \"make -C t\" ;-)  What is different this round?\n"},{"id":"245674","messageId":"1404949763.23510.42.camel@jekeller-desk1.amr.corp.intel.com","threadId":"37089","inReplyTo":"xmqq61j69m0m.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Keller, Jacob E","fromEmail":"jacob.e.keller@intel.com","sentAt":"2014-07-09T23:49:23Z","receivedAt":"2014-07-09T23:49:23Z","isPatch":true,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, 2014-07-09 at 15:59 -0700, Junio C Hamano wrote:\n> Jacob Keller <jacob.e.keller@intel.com> writes:\n> \n> > Running a specific test file manually does not obtain the exact\n> > environment setup by the Makefile.\n> \n> What kind of things are missing, exactly?  Perhaps that is something\n> you need to fix, instead of mucking with the top-level Makefile.\n> \n> I recall last time when I did a patch like this I was told to look\n> into \"make -C t\" ;-)  What is different this round?\n\nIt uses the git from my environment instead of the git I have built,\nwhich is bad since I don't really want to run make install.\n\nThanks,\nJake\n"},{"id":"245678","messageId":"CAPc5daWNB0m23tPdYxWmQEpu8PshFWwwZ3n_bSxF6evwM7-61g@mail.gmail.com","threadId":"37089","inReplyTo":"1404949763.23510.42.camel@jekeller-desk1.amr.corp.intel.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-07-10T04:14:32Z","receivedAt":"2014-07-10T04:14:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Wed, Jul 9, 2014 at 4:49 PM, Keller, Jacob E\n<jacob.e.keller@intel.com> wrote:\n> On Wed, 2014-07-09 at 15:59 -0700, Junio C Hamano wrote:\n>>\n>> What kind of things are missing, exactly?  Perhaps that is something\n>> you need to fix, instead of mucking with the top-level Makefile.\n>\n> It uses the git from my environment instead of the git I have built,\n> which is bad since I don't really want to run make install.\n\nAre you sure about that?  Try adding something like\n\n  die(\"I am broken\");\n\nat the very beginning of main() in git.c, rebuild your git (i.e.\n\"make\", not \"make install\")\nand then\n\n  $ cd t\n  $ sh ./t1234-test.sh -v\n\nfor any of the test scripts. You should see any test piece that runs \"git\" sees\n\"git\" dying with that message.\n\nOtherwise, there is something wrong with git you are building. Unless you have\na patch or two to t/test-lib.sh or something that breaks the test framework, you\nshould be able to test what you just have built without getting affected by what\nis installed in your $PATH. After all, that is how we bootstrap git\nfrom a tarball\nwithout any installed version, and friends do not force friends install without\ntesting first ;-)\n"},{"id":"245715","messageId":"1405024797.4925.1.camel@jekeller-desk1.amr.corp.intel.com","threadId":"37089","inReplyTo":"CAPc5daWNB0m23tPdYxWmQEpu8PshFWwwZ3n_bSxF6evwM7-61g@mail.gmail.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Keller, Jacob E","fromEmail":"jacob.e.keller@intel.com","sentAt":"2014-07-10T20:39:57Z","receivedAt":"2014-07-10T20:39:57Z","isPatch":true,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, 2014-07-09 at 21:14 -0700, Junio C Hamano wrote:\n> On Wed, Jul 9, 2014 at 4:49 PM, Keller, Jacob E\n> <jacob.e.keller@intel.com> wrote:\n> > On Wed, 2014-07-09 at 15:59 -0700, Junio C Hamano wrote:\n> >>\n> >> What kind of things are missing, exactly?  Perhaps that is something\n> >> you need to fix, instead of mucking with the top-level Makefile.\n> >\n> > It uses the git from my environment instead of the git I have built,\n> > which is bad since I don't really want to run make install.\n> \n> Are you sure about that?  Try adding something like\n> \n>   die(\"I am broken\");\n> \n> at the very beginning of main() in git.c, rebuild your git (i.e.\n> \"make\", not \"make install\")\n> and then\n> \n>   $ cd t\n>   $ sh ./t1234-test.sh -v\n> \n> for any of the test scripts. You should see any test piece that runs \"git\" sees\n> \"git\" dying with that message.\n> \n> Otherwise, there is something wrong with git you are building. Unless you have\n> a patch or two to t/test-lib.sh or something that breaks the test framework, you\n> should be able to test what you just have built without getting affected by what\n> is installed in your $PATH. After all, that is how we bootstrap git\n> from a tarball\n> without any installed version, and friends do not force friends install without\n> testing first ;-)\n\nOk, I'll give it a shot. All I know for sure right now is running the\ntest directly passed and running from \"make test\" it failed.\n\nI'll see if that makes any difference.\n\nThanks,\nJake\n"},{"id":"245717","messageId":"20140710204424.GB4459@sigill.intra.peff.net","threadId":"37089","inReplyTo":"1405024797.4925.1.camel@jekeller-desk1.amr.corp.intel.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-07-10T20:44:24Z","receivedAt":"2014-07-10T20:44:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 10, 2014 at 08:39:57PM +0000, Keller, Jacob E wrote:\n\n> Ok, I'll give it a shot. All I know for sure right now is running the\n> test directly passed and running from \"make test\" it failed.\n\nWhen you say directly, I assume you mean \"cd t && ./1234-xxx.sh\".\nYou can also run a single-shot test like:\n\n  cd t && make t1234-...\n\nwhich may make the environment more like \"make test\".\n\n-Peff\n"},{"id":"245729","messageId":"1405031487.4925.43.camel@jekeller-desk1.amr.corp.intel.com","threadId":"37089","inReplyTo":"CAPc5daWNB0m23tPdYxWmQEpu8PshFWwwZ3n_bSxF6evwM7-61g@mail.gmail.com","subject":"Re: [PATCH] makefile: add ability to run specific test files","fromName":"Keller, Jacob E","fromEmail":"jacob.e.keller@intel.com","sentAt":"2014-07-10T22:31:27Z","receivedAt":"2014-07-10T22:31:27Z","isPatch":true,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, 2014-07-10 at 04:14 +0000, Junio C Hamano wrote:\n> On Wed, Jul 9, 2014 at 4:49 PM, Keller, Jacob E\n> <jacob.e.keller@intel.com> wrote:\n> > On Wed, 2014-07-09 at 15:59 -0700, Junio C Hamano wrote:\n> >>\n> >> What kind of things are missing, exactly?  Perhaps that is something\n> >> you need to fix, instead of mucking with the top-level Makefile.\n> >\n> > It uses the git from my environment instead of the git I have built,\n> > which is bad since I don't really want to run make install.\n> \n> Are you sure about that?  Try adding something like\n> \n>   die(\"I am broken\");\n> \n> at the very beginning of main() in git.c, rebuild your git (i.e.\n> \"make\", not \"make install\")\n> and then\n> \n>   $ cd t\n>   $ sh ./t1234-test.sh -v\n> \n> for any of the test scripts. You should see any test piece that runs \"git\" sees\n> \"git\" dying with that message.\n> \n> Otherwise, there is something wrong with git you are building. Unless you have\n> a patch or two to t/test-lib.sh or something that breaks the test framework, you\n> should be able to test what you just have built without getting affected by what\n> is installed in your $PATH. After all, that is how we bootstrap git\n> from a tarball\n> without any installed version, and friends do not force friends install without\n> testing first ;-)\n\nThis is even more interesting. I tried your die check, and it definitely\nruns the correct version of git.\n\nHowever, if I run the test directly:\n\ncd t ; sh t3200-branch.sh -v\n\nit passes.\n\nif I run:\n\nmake test\n\nthat particular test fails. If I have this patch applied, and I run\n\nmake t/t3200-branch.sh\n\nit also fails.\n\nI have done this directly on current master branch. So something is\ndiffering between the two test runs.\n\nAlso, if I run:\n\nmake -C t t3200-branch.sh\n\nthat passes, so it really *is* something setup by the main makefile.\n\nAny more suggestions?\n\nThanks,\nJake\n"}]}