git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] Support Out-Of-Tree Valgrind Tests

From
DGDavid 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 18 in “Allow Overriding GIT_BUILD_DIR”
  1. 1/2 Allow Overriding GIT_BUILD_DIRgreened@obbligato.org, Mar 4, 2012
  2. 2/2 Support Out-Of-Tree Valgrind Testsgreened@obbligato.org, Mar 4, 2012
  3. Thomas RastMar 5, 2012
  4. David A. GreeneMar 5, 2012
  5. Thomas RastMar 6, 2012
  6. David A. GreeneMar 6, 2012
  7. Junio C HamanoMar 6, 2012
  8. David A. GreeneMar 6, 2012
  9. Junio C HamanoMar 6, 2012
  10. Junio C HamanoMar 6, 2012
  11. David A. GreeneMar 6, 2012
  12. Junio C HamanoMar 6, 2012
  13. David A. GreeneMar 6, 2012
  14. Junio C HamanoMar 6, 2012
  15. Junio C HamanoMar 5, 2012
  16. David A. GreeneMar 5, 2012
  17. Junio C HamanoMar 5, 2012
  18. David A. GreeneMar 6, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.