diff mbox series

oeqa/selftest/oescripts: Fix qemu-helper selftest

Message ID 20230617103146.1938095-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 4a80e95d1f59e0ddcedde3f64d0a0d1dc48a6e4d
Headers show
Series oeqa/selftest/oescripts: Fix qemu-helper selftest | expand

Commit Message

Richard Purdie June 17, 2023, 10:31 a.m. UTC
The updated selftest was assuming qemu-bridge-helper was available on the host
system which isn't always the case. Tweak the test case to avoid this issue by
adding dedicated help output and checking for this specifically.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/oescripts.py                   | 4 ++--
 .../qemu/qemu-helper/qemu-oe-bridge-helper.c                | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py
index 36acc006cae..7d3a00e2ab9 100644
--- a/meta/lib/oeqa/selftest/cases/oescripts.py
+++ b/meta/lib/oeqa/selftest/cases/oescripts.py
@@ -123,8 +123,8 @@  class OEGitproxyTests(OEScriptTests):
 class OeRunNativeTest(OESelftestTestCase):
     def test_oe_run_native(self):
         bitbake("qemu-helper-native -c addto_recipe_sysroot")
-        result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper", ignore_status=True)
-        self.assertIn("No bridge helper found", result.output)
+        result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help")
+        self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output)
 
 class OEListPackageconfigTests(OEScriptTests):
     #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags
diff --git a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
index 9434e1d2699..c34aa00567e 100644
--- a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
+++ b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
@@ -7,6 +7,7 @@ 
  */
 
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
 
@@ -25,6 +26,11 @@  int main(int argc, char** argv) {
         return 1;
     }
 
+    if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+        fprintf(stderr, "Helper function to find and exec qemu-bridge-helper. Set QEMU_BRIDGE_HELPER to override default search path\n");
+        return 0;
+    }
+
     try_program("/usr/libexec/qemu-bridge-helper", argv);
     try_program("/usr/lib/qemu/qemu-bridge-helper", argv);