Re: [PATCH 2/2] Support Out-Of-Tree Valgrind Tests
- From
- David A. Greene <dag@cray.com>
- Date
- Mar 6, 2012, 23:00 UTC
- Message-ID
- <87mx7te3ng.fsf@smith.obbligato.org>
- In-Reply-To
- <7v7gyxqrty.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> that says "As a side benefit this change also makes it easy for us > to move the t/*.sh tests into subdirectories if we ever want to do > that." > > This expects that an out-of-tree test script is expected to set > TEST_DIRECTORY before dot-sourcing test-lib.sh, e.g. > > #!/bin/sh > TEST_DIRECTORY=/srv/project/git/git.git/t > test_description='an out-of-tree test' > . "$TEST_DIRECTORY/test-lib.sh"
Hmm...I think I missed this part when I originally tried this. I originally tried to set TEST_DIRECTORY in the environment and I misunderstood its role.
> which in turn lets the test framework to learn GIT_BUILD_DIR. From > there, 'git' will be found in GIT_BUILD_DIR/bin-wrappers and the > valgrind variants are found in a similar way.
Ok, I see. So TEST_DIRECTORY is supposed to point to the "official" location of git's tests and testing support files. That wasn't clear to me.
Show 7 quoted lines
> One thing that is potentially missing is a way for such an out-of-tree > test scripts to ship with supporting material in a separate file, > relative to the test script. The in-tree t/t4013-diff-various.sh > has its test vectors kept in t/t4013/ directory and finds them by > doing > > expect="$TEST_DIRECTORY/t4013/diff.$test"
Right. I did not run into this issue but I can see how others might.
Show 12 quoted lines
> This is because the working directory after test-lib comes back to > us may not be "trash" directory under TEST_DIRECTORY, and ../t4013/ > is not the right way to find it. If an out-of-tree test t9999 wants > to do something similar, it needs to do something like: > > #!/bin/sh > HERE=$(PWD) > TEST_DIRECTORY=/srv/project/git/git.git/t > test_description='an out-of-tree test' > . "$TEST_DIRECTORY/test-lib.sh" > > and find it relative to $HERE, e.g. "$HERE/../t9999/diff.$test"
Ahh...
> Of course, it would be nice to use a name better than $HERE for such > a purpose ;-)
I think naming is a big issue here. Perhaps TEST_DIRECTORY needs a better name, something like GIT_TEST_SUPPORT or such?
So before you apply my patches let me try to restructure the git-subtree tests with this newly provided insight and see if I can get it to work.
Thanks, Junio!
-Dave