mirror of https://gitee.com/openkylin/libvirt.git
tests: reserve more fds for commandtest
Commit 39c77fe
triggered random failures, depending on the platform
and what other fds leak into the testsuite (for me, it passed on
RHEL 6 but failed on Fedora 18). The reason was that we were
expecting an fd that fell outside of our reserved range. By reserving
a larger range, the test once again passes on all platforms.
* tests/commandtest.c (mymain): Reserve enough fds.
This commit is contained in:
parent
753020dc2c
commit
3a9382ca2a
|
@ -9,6 +9,6 @@ FD:0
|
||||||
FD:1
|
FD:1
|
||||||
FD:2
|
FD:2
|
||||||
FD:5
|
FD:5
|
||||||
FD:8
|
FD:7
|
||||||
DAEMON:no
|
DAEMON:no
|
||||||
CWD:/tmp
|
CWD:/tmp
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* commandtest.c: Test the libCommand API
|
* commandtest.c: Test the libCommand API
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2012 Red Hat, Inc.
|
* Copyright (C) 2010-2013 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -960,7 +960,10 @@ mymain(void)
|
||||||
dup2(fd, 3) < 0 ||
|
dup2(fd, 3) < 0 ||
|
||||||
dup2(fd, 4) < 0 ||
|
dup2(fd, 4) < 0 ||
|
||||||
dup2(fd, 5) < 0 ||
|
dup2(fd, 5) < 0 ||
|
||||||
(fd > 5 && VIR_CLOSE(fd) < 0))
|
dup2(fd, 6) < 0 ||
|
||||||
|
dup2(fd, 7) < 0 ||
|
||||||
|
dup2(fd, 8) < 0 ||
|
||||||
|
(fd > 8 && VIR_CLOSE(fd) < 0))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
/* Prime the debug/verbose settings from the env vars,
|
/* Prime the debug/verbose settings from the env vars,
|
||||||
|
@ -978,6 +981,12 @@ mymain(void)
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
fd = 5;
|
fd = 5;
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
fd = 6;
|
||||||
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
fd = 7;
|
||||||
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
fd = 8;
|
||||||
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
|
||||||
virEventRegisterDefaultImpl();
|
virEventRegisterDefaultImpl();
|
||||||
if (VIR_ALLOC(test) < 0) {
|
if (VIR_ALLOC(test) < 0) {
|
||||||
|
|
Loading…
Reference in New Issue