Re: [PATCH] tests: avoid crash when run under gcov

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

 



On Wed, May 11, 2011 at 09:57:46AM -0600, Eric Blake wrote:
> Running ./autobuild.sh failed when gcov is installed, because
> commandtest ended up crashing during gcov's getenv() call after
> exit() had already started.  I traced this nasty bug back to
> a scoping issue present since the test introduction.
> 
> * tests/commandtest.c (mymain): Move newenv...
> (newenv): ...to a scope that is still useful during exit().
> ---
> 
> Pushing under the build-breaker rule.
> 
>  tests/commandtest.c |   25 ++++++++++++++-----------
>  1 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/commandtest.c b/tests/commandtest.c
> index caad698..429a026 100644
> --- a/tests/commandtest.c
> +++ b/tests/commandtest.c
> @@ -748,6 +748,18 @@ cleanup:
>      return ret;
>  }
> 
> +static const char *const newenv[] = {
> +    "PATH=/usr/bin:/bin",
> +    "HOSTNAME=test",
> +    "LANG=C",
> +    "HOME=/home/test",
> +    "USER=test",
> +    "LOGNAME=test"
> +    "TMPDIR=/tmp",
> +    "DISPLAY=:0.0",
> +    NULL
> +};
> +
>  static int
>  mymain(void)
>  {
> @@ -771,18 +783,9 @@ mymain(void)
> 
>      virInitialize();
> 
> -    const char *const newenv[] = {
> -        "PATH=/usr/bin:/bin",
> -        "HOSTNAME=test",
> -        "LANG=C",
> -        "HOME=/home/test",
> -        "USER=test",
> -        "LOGNAME=test"
> -        "TMPDIR=/tmp",
> -        "DISPLAY=:0.0",
> -        NULL
> -    };
>      environ = (char **)newenv;
> 
>  # define DO_TEST(NAME)                                                \
>      if (virtTestRun("Command Exec " #NAME " test",                    \
> -- 

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]