pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/regress/infra-unittests regress/infra-unittests: ensur...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3cfae7b34dba
branches:  trunk
changeset: 428034:3cfae7b34dba
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Apr 23 18:52:55 2020 +0000

description:
regress/infra-unittests: ensure that subst.mk preserves the x bit

diffstat:

 regress/infra-unittests/subst.sh |  35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r 1e7b73caf9c3 -r 3cfae7b34dba regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Thu Apr 23 18:50:17 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Thu Apr 23 18:52:55 2020 +0000
@@ -12,7 +12,7 @@
        create_file "prepare-subst.mk" <<EOF
 
 # The tools that are used by subst.mk
-CHMOD=         chmod-is-not-used
+CHMOD=         chmod
 CMP=           cmp
 DIFF=          diff
 ECHO=          echo
@@ -1065,3 +1065,36 @@
 
        test_case_end
 fi
+
+
+if test_case_begin "executable bit is preserved"; then
+
+       create_file_lines "testcase.mk" \
+               'SUBST_CLASSES+=        id' \
+               'SUBST_STAGE.id=        pre-configure' \
+               'SUBST_FILES.id=        cmd data' \
+               'SUBST_VARS.id=         VAR' \
+               'VAR=                   replaced' \
+               '' \
+               '.include "prepare-subst.mk"' \
+               '.include "mk/subst.mk"'
+       create_file_lines "cmd" \
+               '@VAR@'
+       create_file_lines "data" \
+               '@VAR@'
+       chmod +x "$tmpdir/cmd"
+
+       run_bmake "testcase.mk" "pre-configure" 1> "$tmpdir/out" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "out" --file-is-lines \
+               '=> Substituting "id" in cmd data'
+       assert_that "cmd" --file-is-lines "replaced"
+       assert_that "data" --file-is-lines "replaced"
+       [ -x "$tmpdir/cmd" ] \
+       || assert_fail "cmd must still be executable"
+       [ -x "$tmpdir/data" ] \
+       && assert_fail "data must not be executable"
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index