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: add t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3f7a4d848d57
branches:  trunk
changeset: 428253:3f7a4d848d57
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Apr 26 12:21:39 2020 +0000

description:
regress/infra-unittests: add test for subst.mk with unreadable file

diffstat:

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

diffs (37 lines):

diff -r 7174cc3a2b86 -r 3f7a4d848d57 regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Sun Apr 26 12:21:11 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Sun Apr 26 12:21:39 2020 +0000
@@ -1099,3 +1099,33 @@
 
        test_case_end
 fi
+
+
+if test_case_begin "unreadable file"; then
+
+       create_file_lines "testcase.mk" \
+               'SUBST_CLASSES+=        id' \
+               'SUBST_STAGE.id=        pre-configure' \
+               'SUBST_FILES.id=        unreadable-file' \
+               'SUBST_SED.id=          -e s,before,after,' \
+               '' \
+               '.include "prepare-subst.mk"' \
+               '.include "mk/subst.mk"'
+       create_file_lines "unreadable-file" \
+               'before'
+       chmod 0000 "$tmpdir/unreadable-file"
+
+       run_bmake "testcase.mk" "pre-configure" 1> "$tmpdir/out" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "out" --file-is-lines \
+               '=> Substituting "id" in unreadable-file' \
+               'sh: cannot open unreadable-file: permission denied' \
+               'sh: cannot open unreadable-file: permission denied' \
+               '*** Error code 1' \
+               '' \
+               'Stop.' \
+               "$make: stopped in $PWD"
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index