Re: "./t0001-init.sh --valgrind" is broken

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

 



+the-other-Johannes who added valgrind support.

On Thu, Mar 3, 2016 at 1:55 PM, Johannes Sixt <j6t@xxxxxxxx> wrote:
> ---- 8< ----
> Subject: [PATCH] t0001: fix GIT_* environment variable check under --valgrind
>
> When a test case is run without --valgrind, the wrap-for-bin.sh
> helper script inserts the environment variable GIT_TEXTDOMAINDIR, but
> when run with --valgrind, the variable is missing. A recently
> introduced test case expects the presence of the variable, though, and
> fails under --valgrind.

Yep.

It's interesting though that valgrind sets up some variables without
going through bin-wrappers. That's understandable because valgrind
support is added (in 4e1be63) 10 months before bin-wrappers (in
ea92519).  But it's probably better that we inject valgrind command
from inside bin-wrappers script, the same way we inject gdb, I think.

> Rewrite the test case to strip conditially defined environment variables
> from both expected and actual output.

Or we could set GIT_TEXTDOMAINDIR in the "if test -n $valgrind" code
in test-lib.sh, which makes the two more consistent. Also simpler
patch.

> Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
> ---
>  t/t0001-init.sh | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index 295aa59..a5b9e7a 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -88,19 +88,17 @@ test_expect_success 'plain nested in bare through aliased command' '
>  '
>
>  test_expect_success 'No extra GIT_* on alias scripts' '
> -       (
> -               env | sed -ne "/^GIT_/s/=.*//p" &&
> -               echo GIT_PREFIX &&        # setup.c
> -               echo GIT_TEXTDOMAINDIR    # wrapper-for-bin.sh
> -       ) | sort | uniq >expected &&
> -       cat <<-\EOF >script &&
> -       #!/bin/sh
> -       env | sed -ne "/^GIT_/s/=.*//p" | sort >actual
> -       exit 0
> +       write_script script <<-\EOF &&
> +       env |
> +               sed -n \
> +                       -e "/^GIT_PREFIX=/d" \
> +                       -e "/^GIT_TEXTDOMAINDIR=/d" \
> +                       -e "/^GIT_/s/=.*//p" |
> +               sort
>         EOF
> -       chmod 755 script &&
> +       ./script >expected &&
>         git config alias.script \!./script &&
> -       ( mkdir sub && cd sub && git script ) &&
> +       ( mkdir sub && cd sub && git script >../actual ) &&
>         test_cmp expected actual
>  '
>
> --
> 2.7.0.118.g90056ae
>



-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]