coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: few test failures on various system from recent changes


From: Bernhard Voelker
Subject: Re: few test failures on various system from recent changes
Date: Tue, 22 Nov 2016 08:43:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/22/2016 03:00 AM, Pádraig Brady wrote:
> Subject: [PATCH 2/3] tests: fix false fails due to passing env vars to
>  returns_
> 
> On BSD /bin/sh it was seen that unexported env vars passed to
> returns_() would not be propagated to the wrapped command.

While the new syntax-check LGTM ...

> --- a/tests/misc/printenv.sh
> +++ b/tests/misc/printenv.sh
> @@ -59,8 +59,10 @@ EOF
>  compare exp out || fail=1
>  
>  # Exit status reflects missing variable, but remaining arguments processed.
> -ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST2 ENV_TEST1 > out || fail=1
> -ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST1 ENV_TEST2 >> out || fail=1
> +ENV_TEST1=a env -- printenv ENV_TEST2 ENV_TEST1 > out
> +test $? = 1 || fail=1
> +ENV_TEST1=a env -- printenv ENV_TEST1 ENV_TEST2 >> out
> +test $? = 1 || fail=1

...IMO going away from using returns_ is a step backward.

What about the following which I find nicer to read?
I'd also prefer to use export+unset to avoid a subshell.

-ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST2 ENV_TEST1 > out || fail=1
-ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST1 ENV_TEST2 >> out || fail=1
+export ENV_TEST1=a
+returns_ 1 env -- printenv ENV_TEST2 ENV_TEST1 > out || fail=1
+returns_ 1 env -- printenv ENV_TEST1 ENV_TEST2 >> out || fail=1
+unset ENV_TEST1

WDYT?

Thanks & have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]