commit:     38348c15ee54a9d5a6aefeaef9dd41e031271dc0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 23 22:01:04 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct 23 22:17:09 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=38348c15

tests: fix handling of srcdir vs abs_srcdir for dist creation

The paths listed in EXTRA_DIST must be the targets that we define
exactly, or running distcheck can fail with stale targets -- they
should have been generated before creating the dist, but they get
updated afterwards.  This is easy to repro with:
  touch tests/testsuite.at && make distcheck

Let's split the relative & absolute path logic a bit to help with
this.  We should only use relative paths in dependency related
settings, but use absolute paths when running tools after a cd to
a different location.

Also add testsuite.list.at to the dist explicitly.  We were getting
this implicitly via testsuite depending on it, but better to list
all the files exactly.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 tests/local.mk | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/tests/local.mk b/tests/local.mk
index 0aac4f1..aa2acac 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -1,12 +1,16 @@
 AT_FILES = $(wildcard $(top_srcdir)/%D%/*.at)
-TESTSUITE = $(abs_top_srcdir)/%D%/testsuite
 DISTCLEANFILES += %D%/atconfig
 
+# Use top_srcdir for dependencies, and abs_top_srcdir to execute it.
+TESTSUITE = $(top_srcdir)/%D%/testsuite
+ABS_TESTSUITE = $(abs_top_srcdir)/%D%/testsuite
+
 EXTRA_DIST += \
        $(AT_FILES) \
+       $(TESTSUITE) \
+       $(TESTSUITE_LIST) \
        %D%/atlocal.in \
        %D%/package.m4.in \
-       %D%/testsuite \
        %D%/test-skel-0.c \
        %D%/tests.h \
        %D%/xattr-0
@@ -118,23 +122,23 @@ TESTSUITEFLAGS = --jobs=`getconf _NPROCESSORS_ONLN || 
echo 1`
 tests: $(check_PROGRAMS) $(TESTSUITE)
 
 check-local: %D%/atconfig %D%/atlocal $(TESTSUITE)
-       cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests' 
$(TESTSUITEFLAGS)
+       cd %D% && $(SHELL) '$(ABS_TESTSUITE)' AUTOTEST_PATH='src:tests' 
$(TESTSUITEFLAGS)
 
 installcheck-local: %D%/atconfig %D%/atlocal $(TESTSUITE)
-       cd %D% && $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='src:tests:$(bindir)' 
$(TESTSUITEFLAGS)
+       cd %D% && $(SHELL) '$(ABS_TESTSUITE)' 
AUTOTEST_PATH='src:tests:$(bindir)' $(TESTSUITEFLAGS)
 
 clean-local:
-       test ! -f '$(TESTSUITE)' || { cd %D% && $(SHELL) '$(TESTSUITE)' 
--clean; }
+       test ! -f '$(TESTSUITE)' || { cd %D% && $(SHELL) '$(ABS_TESTSUITE)' 
--clean; }
 
 TESTSUITE_LIST = $(top_srcdir)/%D%/testsuite.list.at
 AUTOTEST = $(AUTOM4TE) --language=autotest
 $(TESTSUITE): $(AT_FILES) $(TESTSUITE_LIST)
-       @$(MKDIR_P) $(abs_top_srcdir)/%D%
-       $(AM_V_GEN)cd $(abs_top_srcdir)/%D% && $(AUTOTEST) -I. -o [email protected] [email protected]
+       @$(MKDIR_P) $(top_srcdir)/%D%
+       $(AM_V_GEN)cd $(top_srcdir)/%D% && $(AUTOTEST) -I. -o testsuite.tmp 
testsuite.at
        $(AM_V_at)mv [email protected] $@
 
 $(TESTSUITE_LIST): $(AT_FILES)
-       @$(MKDIR_P) $(abs_top_srcdir)/%D%
+       @$(MKDIR_P) $(top_srcdir)/%D%
        $(AM_V_GEN)( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \
        $(GREP) -l -e '^SB_CHECK' -e '^AT_CHECK' $(AT_FILES) | LC_ALL=C sort | \
                $(SED) -e 's:^[^/]*/%D%/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@

Reply via email to