Skip to contentSkip to conversation

tests/unit/test-qga: do not qualify executable paths

PATCH In review Samuel Tardieu 4 participants 4 messages Jan 3, 2024 – Jan 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/unit/test-qga: do not qualify executable paths

guest-exec invocation does not need the full path of the executable to execute. Using only the command names ensures correct execution of the test on systems not adhering to the FHS.

---
 tests/unit/test-qga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/unit/test-qga.c +3 -3
index 671e83cb86..8cddf5dc37 100644
@@ -822,7 +822,7 @@ static void test_qga_guest_exec(gconstpointer fix)
 
     /* exec 'echo foo bar' */
     ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
-                 " 'path': '/bin/echo', 'arg': [ '-n', '\" test_str \"' ],"
+                 " 'path': 'echo', 'arg': [ '-n', '\" test_str \"' ],"
                  " 'capture-output': true } }");
     g_assert_nonnull(ret);
     qmp_assert_no_error(ret);
@@ -883,7 +883,7 @@ static void test_qga_guest_exec_separated(gconstpointer fix)
 
     /* exec 'echo foo bar' */
     ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
-                 " 'path': '/bin/bash',"
+                 " 'path': 'bash',"
                  " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ],"
                  " 'capture-output': 'separated' } }");
     g_assert_nonnull(ret);
@@ -924,7 +924,7 @@ static void test_qga_guest_exec_merged(gconstpointer fix)
 
     /* exec 'echo foo bar' */
     ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
-                 " 'path': '/bin/bash',"
+                 " 'path': 'bash',"
                  " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ],"
                  " 'capture-output': 'merged' } }");
     g_assert_nonnull(ret);
Signature · 1 line
2.42.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Samuel Tardieu

guest-exec invocation does not need the full path of the executable to execute. Using only the command names ensures correct execution of the test on systems not adhering to the FHS.

---
 tests/unit/test-qga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Samuel Tardieu
Quoted 8 lines · Samuel Tardieu

guest-exec invocation does not need the full path of the executable to execute. Using only the command names ensures correct execution of the test on systems not adhering to the FHS.

---
  tests/unit/test-qga.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by
#3 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Samuel Tardieu

guest-exec invocation does not need the full path of the executable to execute. Using only the command names ensures correct execution of the test on systems not adhering to the FHS.

---
  tests/unit/test-qga.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)