"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: storing regress test data outside of /tmp
To:
gameoftrees@openbsd.org
Date:
Thu, 1 Oct 2020 18:30:16 -0000

Download raw body.

Thread
On 2020-09-30, Stefan Sperling <stsp@stsp.name> wrote:

> This patch adds a flag which can be used to override the default path.

Comments below:

> --- regress/cmdline/Makefile
> +++ regress/cmdline/Makefile
> @@ -3,79 +3,81 @@ REGRESS_TARGETS=checkout update status log add rm diff
>  	integrate stage unstage cat clone fetch tree
>  NOOBJ=Yes
>  
> +GOT_TEST_ROOT=/tmp
> +
>  checkout:
> -	./checkout.sh -q
> +	./checkout.sh -q -r $(GOT_TEST_ROOT)

I'd prefer a quoted variable:
        ./checkout.sh -q -r "$(GOT_TEST_ROOT)"

> --- regress/cmdline/common.sh
> +++ regress/cmdline/common.sh
> @@ -21,6 +21,7 @@ export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
>  export GOT_AUTHOR="$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"
>  export GOT_AUTHOR_8="flan_hac"
>  export GOT_LOG_DEFAULT_LIMIT=0
> +export GOT_TEST_ROOT="/tmp"
>  
>  export MALLOC_OPTIONS=S
>  
> @@ -168,7 +169,7 @@ test_init()
>  		echo "No test name provided" >&2
>  		return 1
>  	fi
> -	local testroot=`mktemp -p /tmp -d got-test-$testname-XXXXXXXX`
> +	local testroot=`mktemp -p $GOT_TEST_ROOT -d got-test-$testname-XXXXXXXX`

Quotes here, too.

While you're here: There are at least three variants of mktemp(1)
around (OpenBSD, FreeBSD, GNU), which various differences and an
overly complicated temporary directory handling. E.g. -p path will
actually be overriden by TMPDIR.  How about using a simple, explicit
form:

    local testroot=$(mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX")

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de