diff options
author | rillig <rillig@pkgsrc.org> | 2020-04-23 18:52:55 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-04-23 18:52:55 +0000 |
commit | 368f287ead68c25c1cb8d42ba756398b25e34d4d (patch) | |
tree | 5bcc2bd9df8db71fc93878ee898e1c4766e6f8b0 /regress | |
parent | bf636ffdd2ab9afae6a6fa71b14dc2f32c807864 (diff) | |
download | pkgsrc-368f287ead68c25c1cb8d42ba756398b25e34d4d.tar.gz |
regress/infra-unittests: ensure that subst.mk preserves the x bit
Diffstat (limited to 'regress')
-rw-r--r-- | regress/infra-unittests/subst.sh | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/regress/infra-unittests/subst.sh b/regress/infra-unittests/subst.sh index d6de38f94e8..f63168f1fe5 100644 --- a/regress/infra-unittests/subst.sh +++ b/regress/infra-unittests/subst.sh @@ -12,7 +12,7 @@ test_case_set_up() { 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 @@ if test_case_begin "typo in SUBST_CLASSES"; then 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 |