RE: [PATCH] t0000: fix test if run with TEST_OUTPUT_DIRECTORY
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jul 20, 2021, 07:24 UTC
- Message-ID
- <60f67a334777f_14a799208b9@natae.notmuch>
- In-Reply-To
- <44006e7b0bdda50dc51153cc2efb6ae954d4eecb.1626762728.git.ps@pks.im>
Patrick Steinhardt wrote:
Show 27 quoted lines
> Testcases in t0000 are quite special given that they many of them run > nested testcases to verify that testing functionality itself works as > expected. These nested testcases are realized by writing a new ad-hoc > test script which again sources test-lib.sh, where the new script is > created in a nested subdirectory located beneath the current trash > directory. We then execute the new test script with the nested > subdirectory as current working directory and explicitly re-export > TEST_OUTPUT_DIRECTORY to point to that directory. > > While this works as expected in the general case, it falls apart when > the developer has TEST_OUTPUT_DIRECTORY explicitly defined either via > the environment or via config.mak. In that case, test-lib.sh will > clobber the value that we've just carefully set up to instead contain > what the developer has defined. As a result, the TEST_OUTPUT_DIRECTORY > continues to point at the root output directory, not at the nested one. > > This issue causes breakage in the 'test_atexit is run' test case: the > nested test case writes files into "../../", which is assumed to be the > parent's trash directory. But because TEST_OUTPUT_DIRECTORY already > points to to the root output directory, we instead end up writing those > files outside of the output directory. The parent test case will then > try to check whether those files still exist in its own trash directory, > which thus must fail now. > > Fix the issue by adding a new TEST_OUTPUT_DIRECTORY_OVERRIDE variable. > If set, then we'll always override the TEST_OUTPUT_DIRECTORY with its > value after sourcing GIT-BUILD-OPTIONS.
This is a very *very* narrowly-specific hack, but I guess it's better than the test suite failing.
-- Felipe Contreras