pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/regress/infra-unittests
Module Name: pkgsrc
Committed By: rillig
Date: Sat Jun 6 13:00:52 UTC 2020
Modified Files:
pkgsrc/regress/infra-unittests: subst.sh
Log Message:
regress/infra-unittests: demonstrate wrong SUBST no-op failure
Discovered by Juraj in mail/policyd-weight.
https://mail-index.netbsd.org/pkgsrc-changes/2020/06/06/msg215480.html
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 pkgsrc/regress/infra-unittests/subst.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/regress/infra-unittests/subst.sh
diff -u pkgsrc/regress/infra-unittests/subst.sh:1.43 pkgsrc/regress/infra-unittests/subst.sh:1.44
--- pkgsrc/regress/infra-unittests/subst.sh:1.43 Tue May 19 05:14:18 2020
+++ pkgsrc/regress/infra-unittests/subst.sh Sat Jun 6 13:00:52 2020
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: subst.sh,v 1.43 2020/05/19 05:14:18 rillig Exp $
+# $NetBSD: subst.sh,v 1.44 2020/06/06 13:00:52 rillig Exp $
#
# Tests for mk/subst.mk.
#
@@ -1634,3 +1634,48 @@ if test_case_begin 'multiple sed command
test_case_end
fi
+
+
+if test_case_begin 'several substitution, only one applies to file'; then
+
+ # https://mail-index.netbsd.org/pkgsrc-changes/2020/06/06/msg215480.html
+
+ create_file 'testcase.mk' <<-EOF
+ SUBST_CLASSES+= id
+ SUBST_FILES.id= first second
+ SUBST_SED.id= -e 's,first,first-modified,'
+ SUBST_SED.id+= -e 's,second,second,'
+ SUBST_NOOP_OK.id= no
+
+ .include "prepare-subst.mk"
+ .include "mk/subst.mk"
+ EOF
+ create_file_lines 'first' 'first'
+ create_file_lines 'second' 'second'
+
+ run_bmake 'testcase.mk' 'subst-id' 1> "$tmpdir/output" 2>&1 \
+ && exitcode=0 || exitcode=$?
+
+ # FIXME: This is not the intended behavior.
+ # Each of the files contains at least one of the sed patterns,
+ # therefore the substitutions _could_ have an effect, depending
+ # on the pkgsrc configuration.
+ #
+ # Instead of testing whether the sed command is an identity
+ # substitution, the original idea was to find files that contain
+ # _none_ of the patterns.
+ #
+ # The proper fix might be as simple as replacing the "all" with an
+ # "any" in mk/scripts/subst-identity.awk. This would also nicely
+ # remove the special handling of an empty command line.
+ assert_that "$tmpdir/output" --file-is-lines \
+ '=> Substituting "id" in first second' \
+ 'warning: [subst.mk:id] Nothing changed in "second".' \
+ 'fail: [subst.mk:id] The filename pattern "second" has no effect.' \
+ '*** Error code 1' \
+ '' \
+ 'Stop.' \
+ "$make: stopped in $PWD"
+
+ test_case_end
+fi
Home |
Main Index |
Thread Index |
Old Index