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:           Wed Mar 25 07:47:10 UTC 2020

Added Files:
        pkgsrc/regress/infra-unittests: extract.sh

Log Message:
regress/infra-unittests: add test for not extracting certain files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/regress/infra-unittests/extract.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/regress/infra-unittests/extract.sh
diff -u /dev/null pkgsrc/regress/infra-unittests/extract.sh:1.1
--- /dev/null   Wed Mar 25 07:47:10 2020
+++ pkgsrc/regress/infra-unittests/extract.sh   Wed Mar 25 07:47:10 2020
@@ -0,0 +1,49 @@
+#! /bin/sh
+#
+# Tests for mk/subst.mk.
+#
+set -eu
+
+. "./test.subr"
+
+# XXX: The mocked pkgsrc directory should be somewhere else.
+rm -r "$tmpdir/pkgsrc"
+
+# XXX: This definition should be available everywhere.
+pkgsrcdir="`cd "$real_pkgsrcdir" && exec pwd`"
+
+if test_case_begin "exclude directory"; then
+
+       # Demonstrates that excluding a directory name also excludes that
+       # directory further down in the hierarchy.
+       #
+       # For example, with BSD tar and GNU tar it is not possible to exclude
+       # only the top-level "contrib" directory but still extract other
+       # contrib directories.
+       #
+       # Experienced in lang/gcc*, which has contrib/ and java-lib/contrib/.
+
+       cd "$tmpdir"
+       mkdir "contrib"
+       echo "file" > "contrib/file"
+       mkdir "other"
+       echo "file" > "other/file"
+       mkdir "other/contrib"
+       echo "file" > "other/contrib/file"
+
+       tar cf "archive.tar" "contrib" "other"
+       rm -r "contrib" "other"
+
+       sh "$pkgsrcdir/mk/extract/extract" -x "archive.tar" "contrib"
+
+       find . -print | LC_ALL=C sort > "extracted"
+
+       assert_that "extracted" --file-is-lines \
+               "." \
+               "./archive.tar" \
+               "./extracted" \
+               "./other" \
+               "./other/file"
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index