Received: by mail.netbsd.org (Postfix, from userid 605) id 82F6984DB8; Tue, 19 May 2020 05:14:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 09D1784DB3 for ; Tue, 19 May 2020 05:14:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 49w46vlrBieo for ; Tue, 19 May 2020 05:14:18 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 7CC4A84D25 for ; Tue, 19 May 2020 05:14:18 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 74585FB27; Tue, 19 May 2020 05:14:18 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1589865258273800" MIME-Version: 1.0 Date: Tue, 19 May 2020 05:14:18 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/regress/infra-unittests To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20200519051418.74585FB27@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1589865258273800 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Tue May 19 05:14:18 UTC 2020 Modified Files: pkgsrc/regress/infra-unittests: subst.sh Log Message: regress/infra-unittests: remove unnecessary tmpdir handling The test infrastructure from test.subr already takes care of setting up a temporary directory. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 pkgsrc/regress/infra-unittests/subst.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1589865258273800 Content-Disposition: inline Content-Length: 2545 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/regress/infra-unittests/subst.sh diff -u pkgsrc/regress/infra-unittests/subst.sh:1.42 pkgsrc/regress/infra-unittests/subst.sh:1.43 --- pkgsrc/regress/infra-unittests/subst.sh:1.42 Sat May 16 19:02:32 2020 +++ pkgsrc/regress/infra-unittests/subst.sh Tue May 19 05:14:18 2020 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: subst.sh,v 1.42 2020/05/16 19:02:32 rillig Exp $ +# $NetBSD: subst.sh,v 1.43 2020/05/19 05:14:18 rillig Exp $ # # Tests for mk/subst.mk. # @@ -9,9 +9,6 @@ set -eu . './test.subr' test_case_set_up() { - wrkdir="$tmpdir/wrkdir" - mkdir "$wrkdir" - create_file 'prepare-subst.mk' <<-EOF # The tools that are used by subst.mk AWK= awk @@ -38,16 +35,11 @@ test_case_set_up() { WARNING_MSG= echo 'warning:' FAIL_MSG= sh $pkgsrcdir/mk/scripts/fail echo 'fail:' 1>&2 - WRKDIR= $tmpdir/wrkdir - WRKSRC= . + WRKDIR= $PWD + WRKSRC= $PWD EOF } -test_case_tear_down() { - # Clean up the .subst_*_done cookie files. - rm -r "$wrkdir" -} - if test_case_begin 'single file'; then @@ -528,6 +520,11 @@ if test_case_begin 'late evaluation of S # list of files is generated by a shell command. # See mk/configure/replace-localedir.mk. + # If SUBST_FILES were to be evaluated early, it would expand to + # "too-early", since that file exists when testcase.mk is parsed, + # as opposed to "first" "second" "third", which only exist when + # the subst-class target is run. + create_file 'testcase.mk' < '\${WRKSRC}/first' \${RUN} \${ECHO} 'from' > '\${WRKSRC}/second' \${RUN} \${ECHO} 'from' > '\${WRKSRC}/third' EOF + create_file_lines 'package-1.0/too-early' \ + 'from' run_bmake 'testcase.mk' 'subst-class' 1> "$tmpdir/output" 2>&1 \ && exitcode=0 || exitcode=$? assert_that "$tmpdir/output" --file-is-lines \ '=> Substituting "class" in first third' - assert_that "$wrkdir/package-1.0/first" --file-is-lines 'to' - assert_that "$wrkdir/package-1.0/second" --file-is-lines 'from' - assert_that "$wrkdir/package-1.0/third" --file-is-lines 'to' + assert_that "package-1.0/first" --file-is-lines 'to' + assert_that "package-1.0/second" --file-is-lines 'from' + assert_that "package-1.0/third" --file-is-lines 'to' assert_that "$exitcode" --equals '0' test_case_end --_----------=_1589865258273800--