[Qemu-devel] [PATCH] tests: check path to avoid a failing qga/get-vcpus test

Bruce Rogers posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170302194437.21823-1-brogers@suse.com
Test checkpatch passed
Test docker passed
Test s390x passed
tests/test-qga.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] tests: check path to avoid a failing qga/get-vcpus test
Posted by Bruce Rogers 7 years ago
The qga/get-vcpus test fails in a simple chroot environment, as
used in an openSUSE Build Service local build, so first check
that the sysfs based path exists in order to avoid calling this
test in an environment where it won't work right.

Signed-off-by: Bruce Rogers <brogers@suse.com>
---
 tests/test-qga.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/test-qga.c b/tests/test-qga.c
index 868b02a40f..9e6d19a6e1 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -924,7 +924,9 @@ int main(int argc, char **argv)
     g_test_add_data_func("/qga/info", &fix, test_qga_info);
     g_test_add_data_func("/qga/network-get-interfaces", &fix,
                          test_qga_network_get_interfaces);
-    g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
+    if (!access("/sys/devices/system/cpu/cpu0", F_OK)) {
+        g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
+    }
     g_test_add_data_func("/qga/get-fsinfo", &fix, test_qga_get_fsinfo);
     g_test_add_data_func("/qga/get-memory-block-info", &fix,
                          test_qga_get_memory_block_info);
-- 
2.11.1


Re: [Qemu-devel] [PATCH] tests: check path to avoid a failing qga/get-vcpus test
Posted by Marc-André Lureau 7 years ago
On Thu, Mar 2, 2017 at 11:46 PM Bruce Rogers <brogers@suse.com> wrote:

> The qga/get-vcpus test fails in a simple chroot environment, as
> used in an openSUSE Build Service local build, so first check
> that the sysfs based path exists in order to avoid calling this
> test in an environment where it won't work right.
>
> Signed-off-by: Bruce Rogers <brogers@suse.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  tests/test-qga.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/test-qga.c b/tests/test-qga.c
> index 868b02a40f..9e6d19a6e1 100644
> --- a/tests/test-qga.c
> +++ b/tests/test-qga.c
> @@ -924,7 +924,9 @@ int main(int argc, char **argv)
>      g_test_add_data_func("/qga/info", &fix, test_qga_info);
>      g_test_add_data_func("/qga/network-get-interfaces", &fix,
>                           test_qga_network_get_interfaces);
> -    g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
> +    if (!access("/sys/devices/system/cpu/cpu0", F_OK)) {
> +        g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
> +    }
>      g_test_add_data_func("/qga/get-fsinfo", &fix, test_qga_get_fsinfo);
>      g_test_add_data_func("/qga/get-memory-block-info", &fix,
>                           test_qga_get_memory_block_info);
> --
> 2.11.1
>
>
> --
Marc-André Lureau