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:           Thu Jun 11 20:10:53 UTC 2020

Modified Files:
        pkgsrc/regress/infra-unittests: subst.sh

Log Message:
regress/infra-unittests: test SUBST_FILTER_CMD with empty SUBST_SED


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 pkgsrc/regress/infra-unittests/subst.sh:1.49
--- pkgsrc/regress/infra-unittests/subst.sh:1.48        Thu Jun 11 18:04:41 2020
+++ pkgsrc/regress/infra-unittests/subst.sh     Thu Jun 11 20:10:53 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: subst.sh,v 1.48 2020/06/11 18:04:41 rillig Exp $
+# $NetBSD: subst.sh,v 1.49 2020/06/11 20:10:53 rillig Exp $
 #
 # Tests for mk/subst.mk.
 #
@@ -38,6 +38,12 @@ test_case_set_up() {
                WRKDIR=         $PWD
                WRKSRC=         $PWD
        EOF
+
+       create_file_lines "$mocked_pkgsrcdir/show-pkg-fail-reason.mk" \
+               'show-pkg-fail-reasons: .PHONY' \
+               '.if ${PKG_FAIL_REASON:M*}' \
+               '       @printf "fail reason: %s\n" ${PKG_FAIL_REASON} 1>&2 && exit 1' \
+               '.endif'
 }
 
 
@@ -1527,6 +1533,42 @@ if test_case_begin 'SUBST_FILTER_CMD + S
 fi
 
 
+if test_case_begin 'SUBST_FILTER_CMD + empty SUBST_SED'; then
+
+       # If SUBST_FILTER_CMD is defined for a SUBST class,
+       # the corresponding SUBST_SED and SUBST_VARS are ignored.
+       # To avoid redundant variable definitions, this case fails fast.
+       #
+       # This happens even if SUBST_SED or SUBST_VARS are empty since
+       # there is no point in setting these to empty values.
+       # In most cases they are constant and non-empty anyway.
+
+       create_file_lines 'testcase.mk' \
+               'SUBST_CLASSES+=        id' \
+               'SUBST_FILES.id=        file' \
+               'SUBST_FILTER_CMD.id=   tr -d "0-9"' \
+               'SUBST_SED.id=          # empty' \
+               'SUBST_VARS.id=         # empty' \
+               'SUBST_NOOP_OK.id=      no' \
+               '' \
+               '.include "prepare-subst.mk"' \
+               '.include "mk/subst.mk"' \
+               '.include "show-pkg-fail-reason.mk"'
+
+       run_bmake 'testcase.mk' 'show-pkg-fail-reasons' 'subst-id' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-lines \
+               'fail reason: [subst.mk:id] SUBST_FILTER_CMD and SUBST_SED/SUBST_VARS cannot be combined.' \
+               '*** Error code 1' \
+               '' \
+               'Stop.' \
+               "$make: stopped in $PWD"
+
+       test_case_end
+fi
+
+
 if test_case_begin 'effective SUBST_FILTER_CMD in NOOP_OK=no mode'; then
 
        create_file_lines 'testcase.mk' \



Home | Main Index | Thread Index | Old Index