Source-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 m...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/491ae2b8292f
branches:  trunk
changeset: 435056:491ae2b8292f
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Jun 29 20:12:34 2020 +0000

description:
regress/infra-unittests: add more tests for haskell.mk

These tests demonstrate the current behavior, to document further changes
to haskell.mk.

diffstat:

 regress/infra-unittests/haskell.sh |  356 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 355 insertions(+), 1 deletions(-)

diffs (truncated from 382 to 300 lines):

diff -r ec2a52ce09d9 -r 491ae2b8292f regress/infra-unittests/haskell.sh
--- a/regress/infra-unittests/haskell.sh        Mon Jun 29 19:30:04 2020 +0000
+++ b/regress/infra-unittests/haskell.sh        Mon Jun 29 20:12:34 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: haskell.sh,v 1.1 2020/06/27 10:51:12 rillig Exp $
+# $NetBSD: haskell.sh,v 1.2 2020/06/29 20:12:34 rillig Exp $
 #
 # Tests for mk/haskell.mk.
 #
@@ -55,6 +55,9 @@
        create_file 'main.mk' <<EOF
 .include "mk/bsd.fast.prefs.mk"
 
+# override for platform-independent test results
+MACHINE_ARCH=          arch
+
 PKGDIR=                        \${.:L:tA}
 WRKDIR=                        $PWD/work
 PLIST=                 \${WRKDIR}/.PLIST
@@ -98,6 +101,26 @@
 fi
 
 
+if test_case_begin 'PLIST status: missing for empty file'; then
+
+       create_file 'Makefile' <<-EOF
+               DISTNAME=       package-1.0
+
+               .include "../../main.mk"
+       EOF
+       create_file 'PLIST' <<-EOF
+       EOF
+
+       "$make" 'show-plist-status' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-lines \
+               'PLIST status: missing'
+
+       test_case_end
+fi
+
+
 if test_case_begin 'PLIST status: plain'; then
 
        # See textproc/hs-cgrep/PLIST, r1.4.
@@ -175,3 +198,334 @@
 
        test_case_end
 fi
+
+
+if test_case_begin 'missing, update=yes'; then
+
+       # Based on devel/hs-asn1-parse from 2020-06-22.
+
+       create_file_lines 'Makefile' \
+               'DISTNAME=      asn1-parse-0.9.5' \
+               'PKGVERSION=    0.9.5' \
+               'PKGNAME_NOREV= ${DISTNAME}' \
+               '' \
+               'HS_UPDATE_PLIST=       yes' \
+               "PKGDIR=        $PWD" \
+               '' \
+               '.include "../../main.mk"' \
+               '.include "../../mk/haskell.mk"' \
+               '' \
+               'show-haskell-plist-status: .PHONY' \
+               '       @echo "PLIST status: "${_HS_PLIST_STATUS:Q}'
+       create_file "$destdir$prefix/lib/asn1-parse-0.9.5/ghc-8.8.1/package-id" <<-EOF
+               asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr
+       EOF
+       create_file "$destdir$prefix/lib/asn1-parse-0.9.5/ghc-8.8.1/package-description" <<-EOF
+               ...
+               import-dirs:
+                   $prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr
+
+               ...
+       EOF
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.dyn_hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.p_hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr.a" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr_p.a" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr-ghc8.8.1.so" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/asn1-parse.haddock" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/Data-ASN1-Parse.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/doc-index.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/haddock-bundle.min.js" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/index.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/linuwial.css" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/meta.json" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/quick-jump.css" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/synopsis.png" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/LICENSE" ''
+
+       "$make" 'plist' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-empty
+
+       assert_that "PLIST" --file-is-lines \
+               '@comment $''NetBSD$' \
+               '${HS_INTF}/package-description' \
+               '${HS_INTF}/package-id' \
+               '${HS_IMPL}/Data/ASN1/Parse.dyn_hi' \
+               '${HS_IMPL}/Data/ASN1/Parse.hi' \
+               '${HS_IMPL}/Data/ASN1/Parse.p_hi' \
+               '${HS_IMPL}/libHS${HS_PKGID}.a' \
+               '${HS_IMPL}/libHS${HS_PKGID}_p.a' \
+               'lib/${HS_PLATFORM}/libHS${HS_PKGID}-${HS_VER}.so' \
+               '${HS_DOCS}/LICENSE' \
+               '${HS_DOCS}/html/Data-ASN1-Parse.html' \
+               '${HS_DOCS}/html/asn1-parse.haddock' \
+               '${HS_DOCS}/html/doc-index.html' \
+               '${HS_DOCS}/html/haddock-bundle.min.js' \
+               '${HS_DOCS}/html/index.html' \
+               '${HS_DOCS}/html/linuwial.css' \
+               '${HS_DOCS}/html/meta.json' \
+               '${HS_DOCS}/html/quick-jump.css' \
+               '${HS_DOCS}/html/synopsis.png'
+
+       test_case_end
+fi
+
+
+if test_case_begin 'missing, update=no'; then
+
+       # Based on devel/hs-asn1-parse from 2020-06-22.
+
+       create_file_lines 'Makefile' \
+               'DISTNAME=      asn1-parse-0.9.5' \
+               'ECHO=          echo' \
+               'ALL_ENV=       ENVVAR=envvalue' \
+               'CAT=           cat' \
+               'SORT=          sort' \
+               'RUN=           @' \
+               'FIND=          find' \
+               'PKGVERSION=    0.9.5' \
+               'PKGNAME_NOREV= ${DISTNAME}' \
+               '' \
+               'HS_UPDATE_PLIST=       no' \
+               '' \
+               '.include "../../main.mk"' \
+               '.include "../../mk/haskell.mk"' \
+               '.include "../../mk/plist/print-plist.mk"' \
+               '' \
+               'show-all: .PHONY' \
+               '       @echo "PLIST status: "${_HS_PLIST_STATUS:Q}'
+       create_file "$destdir$prefix/lib/asn1-parse-0.9.5/ghc-8.8.1/package-description" <<-EOF
+               ...
+               import-dirs:
+                   $prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr
+
+               ...
+       EOF
+       create_file_lines "$destdir$prefix/lib/asn1-parse-0.9.5/ghc-8.8.1/package-id" \
+               'asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr'
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.dyn_hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/Data/ASN1/Parse.p_hi" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr.a" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr_p.a" ''
+       create_file_lines "$destdir$prefix/lib/x86_64-netbsd-ghc-8.8.1/libHSasn1-parse-0.9.5-2HryHNyN1grJJzKM4AV1Gr-ghc8.8.1.so" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/asn1-parse.haddock" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/Data-ASN1-Parse.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/doc-index.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/haddock-bundle.min.js" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/index.html" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/linuwial.css" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/meta.json" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/quick-jump.css" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/html/synopsis.png" ''
+       create_file_lines "$destdir$prefix/share/doc/x86_64-netbsd-ghc-8.8.1/asn1-parse-0.9.5/LICENSE" ''
+
+       "$make" 'plist' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-empty
+
+       "$make" 'print-PLIST' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-lines \
+               '@comment $''NetBSD$' \
+               '${HS_INTF}/package-description' \
+               '${HS_INTF}/package-id' \
+               '${HS_IMPL}/Data/ASN1/Parse.dyn_hi' \
+               '${HS_IMPL}/Data/ASN1/Parse.hi' \
+               '${HS_IMPL}/Data/ASN1/Parse.p_hi' \
+               '${HS_IMPL}/libHS${HS_PKGID}.a' \
+               '${HS_IMPL}/libHS${HS_PKGID}_p.a' \
+               'lib/${HS_PLATFORM}/libHS${HS_PKGID}-${HS_VER}.so' \
+               '${HS_DOCS}/LICENSE' \
+               '${HS_DOCS}/html/Data-ASN1-Parse.html' \
+               '${HS_DOCS}/html/asn1-parse.haddock' \
+               '${HS_DOCS}/html/doc-index.html' \
+               '${HS_DOCS}/html/haddock-bundle.min.js' \
+               '${HS_DOCS}/html/index.html' \
+               '${HS_DOCS}/html/linuwial.css' \
+               '${HS_DOCS}/html/meta.json' \
+               '${HS_DOCS}/html/quick-jump.css' \
+               '${HS_DOCS}/html/synopsis.png'
+
+       test_case_end
+fi
+
+
+if test_case_begin 'plain, update=yes'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'outdated, update=yes'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'lib-ok, update=yes'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'plain, update=no'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'outdated, update=no'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'lib-ok, update=no'; then
+
+       # TODO
+
+       test_case_end
+fi
+
+
+if test_case_begin 'neither package-id nor package-description'; then
+
+       # example: textproc/hs-cgrep
+
+       create_file_lines 'destdir/prefix/bin/cgrep' 'line'
+       create_file_lines 'destdir/prefix/share/doc/x86_64-netbsd-ghc-8.8.1/cgrep-6.6.30/LICENSE' 'line'
+
+       create_file_lines 'Makefile' \
+               'DISTNAME=      package-1.0' \
+               '' \
+               ".include \"../../main.mk\"" \
+               '.include "../../mk/haskell.mk"' \
+               '' \
+               'show-haskell-plist: .PHONY' \
+               '       @echo _HS_PLIST_STATUS=${_HS_PLIST_STATUS:Q}' \
+               '       @printf "PLIST_SUBST %s\n" ${PLIST_SUBST}' \
+               '       @printf "PRINT_PLIST_AWK %s\n" ${PRINT_PLIST_AWK:M*:@arg@${arg:Q}@}'
+
+       "$make" 'show-haskell-plist' 1> "$tmpdir/output" 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       assert_that "$tmpdir/output" --file-is-lines \
+               '_HS_PLIST_STATUS=missing' \
+               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
+               ' source line number 1' \
+               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
+               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
+               ' source line number 1' \
+               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
+               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
+               ' source line number 1' \
+               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
+               "cat: $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id: No such file or directory" \
+               "$make: \"cat $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id\" returned non-zero status" \
+               'PLIST_SUBST HS_INTF=lib/package-1.0/ghc-8.8.1' \
+               'PLIST_SUBST HS_IMPL=' \
+               'PLIST_SUBST HS_DOCS=' \
+               'PLIST_SUBST HS_PLATFORM=never_match_this' \
+               'PLIST_SUBST HS_PKGID=' \
+               'PLIST_SUBST HS_VER=ghc8.8.1' \
+               'PLIST_SUBST OPSYS=Opsys' \
+               'PLIST_SUBST OS_VERSION=' \
+               'PLIST_SUBST MACHINE_ARCH=arch' \



Home | Main Index | Thread Index | Old Index