diff --git a/libvirt-tests-commandtest-skip-the-test4-if-the-testcase-is-.patch b/libvirt-tests-commandtest-skip-the-test4-if-the-testcase-is-.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e566391d39f29e9a5e1b628a899172063d98f3c --- /dev/null +++ b/libvirt-tests-commandtest-skip-the-test4-if-the-testcase-is-.patch @@ -0,0 +1,73 @@ +From df5d95b8db5ec8a79dee223338a72a9f8897a538 Mon Sep 17 00:00:00 2001 +From: AlexChen +Date: Wed, 16 Sep 2020 15:53:57 +0800 +Subject: [PATCH] tests/commandtest: skip the test4 if the testcase is run in + the container env + +In a container environment without an init thread, the daemoned +process is not reclaimed, and Test4 loops forever, causing +the compilation to hung. So, skip it. + +Signed-off-by: AlexChen +--- + tests/commandtest.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/tests/commandtest.c b/tests/commandtest.c +index d5092b7dd0..2cc27c64a1 100644 +--- a/tests/commandtest.c ++++ b/tests/commandtest.c +@@ -259,6 +259,7 @@ static int test4(const void *unused G_GNUC_UNUSED) + char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper"); + pid_t pid; + int ret = -1; ++ int count = 0; + + if (!pidfile) + goto cleanup; +@@ -275,9 +276,14 @@ static int test4(const void *unused G_GNUC_UNUSED) + printf("cannot read pidfile\n"); + goto cleanup; + } +- while (kill(pid, 0) != -1) +- g_usleep(100*1000); +- ++ while (kill(pid, 0) != -1) { ++ if (count++ >= 600) { ++ printf("check time exceeds 60s, it may be in container env, " ++ "skip this testcase!!!\n"); ++ break; ++ } ++ g_usleep(100*1000); /* 100ms */ ++ } + ret = checkoutput("test4", NULL); + + cleanup: +@@ -734,6 +740,7 @@ static int test18(const void *unused G_GNUC_UNUSED) + char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper"); + pid_t pid; + int ret = -1; ++ int count = 0; + + if (!pidfile) + goto cleanup; +@@ -760,8 +767,14 @@ static int test18(const void *unused G_GNUC_UNUSED) + goto cleanup; + } + +- while (kill(pid, SIGINT) != -1) +- g_usleep(100*1000); ++ while (kill(pid, SIGINT) != -1) { ++ if (count++ >= 600) { ++ printf("check time exceeds 60s, it may be in container env, " ++ "skip this testcase!!!\n"); ++ break; ++ } ++ g_usleep(100*1000); /* 100ms */ ++ } + + ret = 0; + +-- +2.23.0 + diff --git a/libvirt.spec b/libvirt.spec index 203361e42ac65b493b573d9de0788f22f214061c..c16d114f4d3bcc094a8c20772328394a9dfe52d1 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -99,7 +99,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 8 +Release: 9 License: LGPLv2+ URL: https://libvirt.org/ @@ -132,6 +132,7 @@ Patch0021: libvirt-Substitute-security_context_t-with-char.patch Patch0022: libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF.patch Patch0023: libvirt-virstoragetest-testBackingParse-Use-VIR_DOMAIN_DEF_F.patch Patch0024: libvirt-support-aarch64-vtpm-with-parameter-tpm-tis-.patch +Patch0025: libvirt-tests-commandtest-skip-the-test4-if-the-testcase-is-.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -1864,6 +1865,8 @@ exit 0 %changelog +* Wed Aug 5 2020 AlexChen - 6.2.0-9 +- tests: skip the test4 if the testcase is run in the container env * Wed Aug 5 2020 Jiang Fangjie - 6.2.0-8 - Libvirt supports aarch64 vtpm with parameter tpm-tis-device * Tue Aug 4 2020 Xu Yandong - 6.2.0-7