summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-04-02 17:32:09 -0400
committerPaul Smith <psmith@gnu.org>2023-04-02 17:32:09 -0400
commit971b02d58ee2d19d8ba0c7c9813f02fa86c8fd0c (patch)
treec253dde22ed2da31a64584249a179b3e4535170a /Makefile.am
parentfdd61fc06865d4393246da2ce05bad96c1aef5aa (diff)
downloadmake-git-971b02d58ee2d19d8ba0c7c9813f02fa86c8fd0c.tar.gz
tests: Run each file in a separate directory
Avoid cross-contamination between test files by creating a new working directory for each file, and setting it as the current directory before starting the tests in that file. Rename the test output as tNNN.{base,log,diff,mk} where NNN is a test number starting with 001 for the first test. It is slightly more annoying to find diff files since you can't use autocomplete directly but it is simpler to match things. Detect the source directory as the location of the test_driver.pl script, so remove the separate -srcdir option. * Makefile.am: Remove hacks to create symlinks when building out-of-tree, and remove -srcdir option from run_make_tests. * tests/test_driver.pl: Locate $srcpath based on __FILE__, then compute $toppath as its parent. Set $scriptpath under $srcpath and $workpath under the current directory. Toss $*_filename and modify get_logfile() etc. to use the suffix directly. Add a chdir() around the invocation of the test. * tests/run_make_tests.pl: Throw out the -srcdir option and use $srcpath set in test_driver.pl. The #WORK# helper is no longer useful so remove it. Set #PWD# to the current working dir. Always search the local directory and $srcpath for config-flags.pm. Use $srcpath for finding the thelp.pl script. * tests/scripts/features/vpath: Don't put things in work/ as it is no longer a subdirectory. * tests/scripts/features/vpathgpath: Ditto. * tests/scripts/features/vpathplus: Ditto. * tests/scripts/misc/general1: Ditto. * tests/scripts/misc/general2: Ditto. * tests/scripts/options/dash-k: Ditto. * tests/scripts/options/symlinks: Use $testpath as the working directory. * tests/scripts/variables/GNUMAKEFLAGS: Use the test helper to display env var values (grepping for GNUMAKEFLAGS finds extra things now that it is our current working directory).
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am18
1 files changed, 4 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 05be3453..23a48e47 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -152,8 +152,6 @@ check-local: check-regression
# > check-regression
#
# Look for the make test suite, and run it if found and we can find perl.
-# If we're building outside the tree, we use symlinks to make a local copy of
-# the test suite. Unfortunately the test suite itself isn't localizable yet.
#
MAKETESTFLAGS =
@@ -177,20 +175,12 @@ rand_char = substr(c,int(rand()*36),1)
rand_string = $(AWK) 'BEGIN{srand(); $(rand_value); print $(rand_char) "" $(rand_char) "" $(rand_char) "" $(rand_char);}'
check-regression: tests/config-flags.pm
- @rm -f $(testfiles)
- @if test -f '$(top_srcdir)/tests/run_make_tests'; then \
+ $(AM_V_at) rm -f $(testfiles)
+ $(AM_V_at) if test -f '$(top_srcdir)/tests/run_make_tests.pl'; then \
ulimit -n 128; \
if $(PERL) -v >/dev/null 2>&1; then \
- case `cd '$(top_srcdir)'; pwd` in `pwd`) : ;; \
- *) test -d tests || mkdir tests; \
- rm -f srctests; \
- if ln -s '$(top_srcdir)/tests' srctests; then \
- for f in run_make_tests run_make_tests.pl test_driver.pl scripts thelp.pl; do \
- rm -f tests/$$f; ln -s ../srctests/$$f tests; \
- done; fi ;; \
- esac; \
- echo "cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make $(GMK_OUTDIR)/make$(EXEEXT) $(MAKETESTFLAGS)"; \
- (cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '$(GMK_OUTDIR)/make$(EXEEXT)' $(MAKETESTFLAGS); echo $$? >.test-result) 2>&1 | tee $(testlog); \
+ echo "cd tests && $(PERL) $(PERLFLAGS) $(abs_top_srcdir)/tests/run_make_tests.pl -make $(GMK_OUTDIR)/make$(EXEEXT) $(MAKETESTFLAGS)"; \
+ (cd tests && $(PERL) $(PERLFLAGS) '$(abs_top_srcdir)/tests/run_make_tests.pl' -make '$(GMK_OUTDIR)/make$(EXEEXT)' $(MAKETESTFLAGS); echo $$? >.test-result) 2>&1 | tee $(testlog); \
export TAR_OPTIONS='$(filter-out --sort%,$(TAR_OPTIONS))'; \
er=$$(cat $(testresult)); if test "$$er" -ne 0; then \
dirnm="$(errorpre)-$$($(rand_string))"; fnm="$$dirnm.tar.gz"; \