Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): run tests with absolute filenames as well



details:   https://anonhg.NetBSD.org/src/rev/888819ed7275
branches:  trunk
changeset: 1014393:888819ed7275
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 21 04:20:35 2020 +0000

description:
make(1): run tests with absolute filenames as well

The tests varname-dot-parsedir and varname-dot-parsefile had been broken
before if they were run with the "-f $PWD/$test.mk" option.  This way of
running the tests is used by FreeBSD.

diffstat:

 usr.bin/make/test-variants.sh    |   6 +++++-
 usr.bin/make/unit-tests/Makefile |  14 +++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (67 lines):

diff -r b2ba164320f3 -r 888819ed7275 usr.bin/make/test-variants.sh
--- a/usr.bin/make/test-variants.sh     Mon Sep 21 03:45:29 2020 +0000
+++ b/usr.bin/make/test-variants.sh     Mon Sep 21 04:20:35 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.3 2020/08/31 18:57:41 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.4 2020/09/21 04:20:35 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -157,6 +157,10 @@
 
 testcase USE_FORT="yes"
 
+# Ensure that the tests can be specified either as relative filenames or
+# as absolute filenames.
+testcase USE_ABSOLUTE_TESTNAMES="yes"
+
 # This test is the result of reading through the GCC "Warning Options"
 # documentation, noting down everything that sounded interesting.
 #
diff -r b2ba164320f3 -r 888819ed7275 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Mon Sep 21 03:45:29 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Mon Sep 21 04:20:35 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.144 2020/09/21 03:45:29 rillig Exp $
+# $NetBSD: Makefile,v 1.145 2020/09/21 04:20:35 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -418,7 +418,11 @@
 UNIT_TESTS:=   ${.PARSEDIR}
 .PATH: ${UNIT_TESTS}
 
+.if ${USE_ABSOLUTE_TESTNAMES:Uno} == yes
+OUTFILES=      ${TESTS:@test@${.CURDIR:tA}/${test}.out@}
+.else
 OUTFILES=      ${TESTS:=.out}
+.endif
 
 all: ${OUTFILES}
 
@@ -447,10 +451,10 @@
        @${_MKMSG_TEST:Uecho '#      test '} ${.PREFIX}
        @set -eu; \
        cd ${.OBJDIR}; \
-       env -i PATH="$$PATH" ${ENV.${.TARGET:R}} \
+       env -i PATH="$$PATH" ${ENV.${.PREFIX:T}} \
          ${TEST_MAKE} \
            -r -C ${.CURDIR} -f ${.IMPSRC} \
-           ${FLAGS.${.TARGET:R}:U-k} \
+           ${FLAGS.${.PREFIX:T}:U-k} \
            > ${.TARGET}.tmp 2>&1 \
        && status=$$? || status=$$?; \
        echo $$status > ${.TARGET:R}.status
@@ -468,9 +472,9 @@
 _SED_CMDS+=    -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
 
 .rawout.out:
-       @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
+       @${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.PREFIX:T}} \
          < ${.IMPSRC} > ${.TARGET}.tmp1
-       @${POSTPROC.${.TARGET:R}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
+       @${POSTPROC.${.PREFIX:T}:Ucat} < ${.TARGET}.tmp1 > ${.TARGET}.tmp2
        @rm ${.TARGET}.tmp1
        @echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp2
        @mv ${.TARGET}.tmp2 ${.TARGET}



Home | Main Index | Thread Index | Old Index