[PATCH] tests: Don't return -1 as program return value

Peter Krempa posted 1 patch 3 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/8356bab419542ff500acbdbe1340b2e75ae6ca93.1614880785.git.pkrempa@redhat.com
tests/qemucommandutiltest.c    | 3 +--
tests/virnetdevbandwidthtest.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
[PATCH] tests: Don't return -1 as program return value
Posted by Peter Krempa 3 years, 1 month ago
In cases we use -1 for failure internally we still must return
EXIT_FAILURE.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemucommandutiltest.c    | 3 +--
 tests/virnetdevbandwidthtest.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c
index 6291c3b787..03947d87bc 100644
--- a/tests/qemucommandutiltest.c
+++ b/tests/qemucommandutiltest.c
@@ -146,8 +146,7 @@ mymain(void)
                                      "server.2.type=tcp,"
                                      "server.2.host=example.com");

-    return ret;
-
+    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }

 VIR_TEST_MAIN(mymain)
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 2e76af3d0c..6d0443876c 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -156,7 +156,7 @@ mymain(void)
                  TC " filter add dev eth0 parent ffff: protocol all u32 match u32 0 0 "
                  "police rate 5kbps burst 7kb mtu 64kb drop flowid :1\n"));

-    return ret;
+    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }

 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnetdevbandwidth"))
-- 
2.29.2