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.

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
This commit is contained in:
Samuel Tardieu 2024-01-03 17:51:31 +01:00 committed by Konstantin Kostiuk
parent b68d8b677e
commit 8c72e19bfd

View File

@ -822,7 +822,7 @@ static void test_qga_guest_exec(gconstpointer fix)
/* exec 'echo foo bar' */ /* exec 'echo foo bar' */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" 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 } }"); " 'capture-output': true } }");
g_assert_nonnull(ret); g_assert_nonnull(ret);
qmp_assert_no_error(ret); qmp_assert_no_error(ret);
@ -883,7 +883,7 @@ static void test_qga_guest_exec_separated(gconstpointer fix)
/* exec 'echo foo bar' */ /* exec 'echo foo bar' */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" 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;' ]," " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ],"
" 'capture-output': 'separated' } }"); " 'capture-output': 'separated' } }");
g_assert_nonnull(ret); g_assert_nonnull(ret);
@ -924,7 +924,7 @@ static void test_qga_guest_exec_merged(gconstpointer fix)
/* exec 'echo foo bar' */ /* exec 'echo foo bar' */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" 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;' ]," " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ],"
" 'capture-output': 'merged' } }"); " 'capture-output': 'merged' } }");
g_assert_nonnull(ret); g_assert_nonnull(ret);