mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: avoid crash when run under gcov
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().
This commit is contained in:
parent
ba13a37cff
commit
70ea7decbe
@ -748,6 +748,18 @@ cleanup:
|
|||||||
return ret;
|
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
|
static int
|
||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
@ -771,17 +783,6 @@ mymain(void)
|
|||||||
|
|
||||||
virInitialize();
|
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;
|
environ = (char **)newenv;
|
||||||
|
|
||||||
# define DO_TEST(NAME) \
|
# define DO_TEST(NAME) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user