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:           Sun Nov 24 08:22:47 UTC 2024

Modified Files:
        pkgsrc/regress/infra-unittests: extract.sh gnu-configure-strict.sh
            subst.sh test.subr

Log Message:
regress: sync infrastructure tests with reality

When extracting using tar on NetBSD-10.99-amd64, exclusion patterns may
now contain slashes.

When 'bmake' stops due to an error, the error message contains the
targets that were requested.

When 'bmake' runs a long command (more than 1000 bytes), it first writes
the command to a temporary file and then runs that file, to avoid hitting
command line argument limits. This temporary file is included in the
error message of the 'unreadable file' test.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 pkgsrc/regress/infra-unittests/extract.sh \
    pkgsrc/regress/infra-unittests/gnu-configure-strict.sh
cvs rdiff -u -r1.50 -r1.51 pkgsrc/regress/infra-unittests/subst.sh
cvs rdiff -u -r1.18 -r1.19 pkgsrc/regress/infra-unittests/test.subr

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/extract.sh
diff -u pkgsrc/regress/infra-unittests/extract.sh:1.5 pkgsrc/regress/infra-unittests/extract.sh:1.6
--- pkgsrc/regress/infra-unittests/extract.sh:1.5       Mon May 11 19:13:10 2020
+++ pkgsrc/regress/infra-unittests/extract.sh   Sun Nov 24 08:22:47 2024
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: extract.sh,v 1.5 2020/05/11 19:13:10 rillig Exp $
+# $NetBSD: extract.sh,v 1.6 2024/11/24 08:22:47 rillig Exp $
 #
 # Test cases for mk/extract/extract.
 #
@@ -43,12 +43,11 @@ if test_case_begin "exclude directory by
        test_case_end
 fi
 
-if test_case_begin "try to exclude directory by pattern with slash"; then
+if test_case_begin "exclude directory by pattern with slash"; then
 
-       # Having exclusion patterns with slash does not work at all for
-       # the default tar extractor. The patterns are matched against
-       # the basename of the file to be extracted, and that basename
-       # obviously cannot contain a slash.
+       # The exclusion patterns may contain slashes. These patterns are
+       # matched against the full pathname to be extracted, but they are
+       # not anchored at the beginning of the pathname.
 
        create_file_lines "contrib/file"        "content"
        create_file_lines "other/file"          "content"
@@ -63,9 +62,7 @@ if test_case_begin "try to exclude direc
 
        assert_that "$tmpdir/extracted" --file-is-lines \
                "." \
-               "./contrib" \
                "./other" \
-               "./other/contrib" \
                "./other/file"
 
        test_case_end
Index: pkgsrc/regress/infra-unittests/gnu-configure-strict.sh
diff -u pkgsrc/regress/infra-unittests/gnu-configure-strict.sh:1.5 pkgsrc/regress/infra-unittests/gnu-configure-strict.sh:1.6
--- pkgsrc/regress/infra-unittests/gnu-configure-strict.sh:1.5  Sat May 23 12:11:33 2020
+++ pkgsrc/regress/infra-unittests/gnu-configure-strict.sh      Sun Nov 24 08:22:47 2024
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: gnu-configure-strict.sh,v 1.5 2020/05/23 12:11:33 rillig Exp $
+# $NetBSD: gnu-configure-strict.sh,v 1.6 2024/11/24 08:22:47 rillig Exp $
 #
 # Tests for GNU_CONFIGURE_STRICT handling in mk/configure/gnu-configure.mk.
 #
@@ -23,6 +23,7 @@ test_case_set_up() {
                GNU_CONFIGURE_PREFIX= unused-GNU_CONFIGURE_PREFIX
                PREFIX=         unused-PREFIX
                OPSYS=          NetBSD
+               MACHINE_PLATFORM= NetBSD-10.0-amd64
                WRKDIR=         $PWD
                WRKSRC=         $PWD
 
@@ -120,7 +121,7 @@ if test_case_begin 'some unknown options
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"_check-unknown-configure-options\" in $PWD"
 
        test_case_end
 fi
@@ -164,7 +165,7 @@ if test_case_begin 'unknown options in m
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"_check-unknown-configure-options\" in $PWD"
 
        test_case_end
 fi
@@ -394,7 +395,7 @@ if test_case_begin 'realistic example fr
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"_check-unknown-configure-options\" in $PWD"
 
        test_case_end
 fi

Index: pkgsrc/regress/infra-unittests/subst.sh
diff -u pkgsrc/regress/infra-unittests/subst.sh:1.50 pkgsrc/regress/infra-unittests/subst.sh:1.51
--- pkgsrc/regress/infra-unittests/subst.sh:1.50        Sat Jun 20 16:26:11 2020
+++ pkgsrc/regress/infra-unittests/subst.sh     Sun Nov 24 08:22:47 2024
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: subst.sh,v 1.50 2020/06/20 16:26:11 rillig Exp $
+# $NetBSD: subst.sh,v 1.51 2024/11/24 08:22:47 rillig Exp $
 #
 # Tests for mk/subst.mk.
 #
@@ -271,7 +271,7 @@ if test_case_begin 'single file noop, no
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-class\" in $PWD"
        assert_that 'single' --file-is-lines 'already an example'
        assert_that "$exitcode" --equals '1'
 
@@ -302,7 +302,7 @@ if test_case_begin 'single file nonexist
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-class\" in $PWD"
        assert_that "$exitcode" --equals '1'
 
        test_case_end
@@ -387,7 +387,7 @@ if test_case_begin 'several filename pat
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-class\" in $PWD"
        assert_that 'exists' --file-is-lines 'this example exists'
        assert_that "$exitcode" --equals '1'
 
@@ -420,7 +420,7 @@ if test_case_begin 'multiple missing fil
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure\" in $PWD"
        assert_that "$exitcode" --equals '1'
 
        test_case_end
@@ -482,7 +482,7 @@ if test_case_begin 'multiple no-op files
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure\" in $PWD"
        assert_that "$exitcode" --equals '1'
 
        test_case_end
@@ -1035,7 +1035,7 @@ if test_case_begin 'pattern matches only
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure\" in $PWD"
        assert_that "$tmpdir/stderr" --file-is-lines \
                'fail: [subst.mk:dir] The filename pattern "sub*" has no effect.'
        assert_that "$exitcode" --equals 1
@@ -1073,7 +1073,7 @@ if test_case_begin 'two filename pattern
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure\" in $PWD"
 
        test_case_end
 fi
@@ -1133,7 +1133,7 @@ if test_case_begin 'empty SUBST_SED'; th
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-id all\" in $PWD"
 
        test_case_end
 fi
@@ -1167,7 +1167,7 @@ if test_case_begin 'typo in SUBST_CLASSE
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure all\" in $PWD"
 
        test_case_end
 fi
@@ -1223,14 +1223,16 @@ if test_case_begin 'unreadable file'; th
        run_bmake 'testcase.mk' 'pre-configure' 1> "$tmpdir/output" 2>&1 \
        && exitcode=0 || exitcode=$?
 
+       awk_cmd='/cannot open unreadable-file/ { sub(/:/, "", $1); print $1; exit }'
+       cmd_file=$(awk "$awk_cmd" "$tmpdir/output")
        assert_that "$tmpdir/output" --file-is-lines \
                '=> Substituting "id" in unreadable-file' \
-               'sh: cannot open unreadable-file: permission denied' \
-               'sh: cannot open unreadable-file: permission denied' \
+               "$cmd_file: cannot open unreadable-file: permission denied" \
+               "$cmd_file: cannot open unreadable-file: permission denied" \
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"pre-configure\" in $PWD"
 
        test_case_end
 fi
@@ -1425,7 +1427,7 @@ if test_case_begin 'identity substitutio
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-id\" in $PWD"
 
        test_case_end
 fi
@@ -1486,7 +1488,7 @@ if test_case_begin 'identity + no-op sub
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-id\" in $PWD"
        assert_that 'file' --file-is-lines \
                'other'
 
@@ -1563,7 +1565,7 @@ if test_case_begin 'SUBST_FILTER_CMD + e
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"show-pkg-fail-reasons subst-id\" in $PWD"
 
        test_case_end
 fi
@@ -1617,7 +1619,7 @@ if test_case_begin 'no-op SUBST_FILTER_C
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-id\" in $PWD"
 
        assert_that 'file' --file-is-lines \
                'only letters'
@@ -1677,7 +1679,7 @@ if test_case_begin 'multiple sed command
                '*** Error code 1' \
                '' \
                'Stop.' \
-               "$make: stopped in $PWD"
+               "$make: stopped making \"subst-id\" in $PWD"
 
        test_case_end
 fi

Index: pkgsrc/regress/infra-unittests/test.subr
diff -u pkgsrc/regress/infra-unittests/test.subr:1.18 pkgsrc/regress/infra-unittests/test.subr:1.19
--- pkgsrc/regress/infra-unittests/test.subr:1.18       Thu Sep  9 18:23:44 2021
+++ pkgsrc/regress/infra-unittests/test.subr    Sun Nov 24 08:22:47 2024
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test.subr,v 1.18 2021/09/09 18:23:44 rillig Exp $
+# $NetBSD: test.subr,v 1.19 2024/11/24 08:22:47 rillig Exp $
 #
 # This file defines utilities for testing Makefile fragments and shell
 # programs from the pkgsrc infrastructure. While testing one part of the
@@ -365,7 +365,9 @@ assert_that() {
                ;;
 
        (*)
-               printf 'usage: assert_that <expr> --equals <expr>\n' 1>&2
+               printf '%s\n' \
+                   'usage: assert_that <expr> <operator> <expr>\n' \
+                   '(see test.subr)' 1>&2
                exit 1
        esac
 }



Home | Main Index | Thread Index | Old Index