[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/31] tests/qtest/libqtest: Fix detection of architecture for bin
From: |
Thomas Huth |
Subject: |
[PULL 02/31] tests/qtest/libqtest: Fix detection of architecture for binaries without path |
Date: |
Mon, 26 Oct 2020 11:06:03 +0100 |
The qtests can be run directly by specifying the QEMU binary with the
QTEST_QEMU_BINARY environment variable, for example:
$ QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 tests/qtest/test-hmp
However, if you specify a binary without a path, for example with
QTEST_QEMU_BINARY=qemu-system-x86_64 if the QEMU binary is in your
$PATH, then the test currently simply crashes.
Let's try a little bit smarter here by looking for the final '-'
instead of the slash.
Message-Id: <20201012114816.43546-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/libqtest.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 08929f5ff6..b9ff29055b 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -870,9 +870,14 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...)
const char *qtest_get_arch(void)
{
const char *qemu = qtest_qemu_binary();
- const char *end = strrchr(qemu, '/');
+ const char *end = strrchr(qemu, '-');
- return end + strlen("/qemu-system-");
+ if (!end) {
+ fprintf(stderr, "Can't determine architecture from binary name.\n");
+ abort();
+ }
+
+ return end + 1;
}
bool qtest_get_irq(QTestState *s, int num)
--
2.18.2
- [PULL 00/31] qtests and gitlab-CI/acceptance patches, Thomas Huth, 2020/10/26
- [PULL 01/31] tests/migration: fix memleak in wait_command/wait_command_fd, Thomas Huth, 2020/10/26
- [PULL 03/31] accel: Remove _WIN32 ifdef from qtest-cpus.c, Thomas Huth, 2020/10/26
- [PULL 02/31] tests/qtest/libqtest: Fix detection of architecture for binaries without path,
Thomas Huth <=
- [PULL 04/31] accel: move qtest CpusAccel functions to a common location, Thomas Huth, 2020/10/26
- [PULL 05/31] accel: Add xen CpusAccel using dummy-cpus, Thomas Huth, 2020/10/26
- [PULL 06/31] tests/qtest: Make npcm7xx_timer-test conditional on CONFIG_NPCM7XX, Thomas Huth, 2020/10/26
- [PULL 07/31] libqtest: fix the order of buffered events, Thomas Huth, 2020/10/26
- [PULL 08/31] libqtest: fix memory leak in the qtest_qmp_event_ref, Thomas Huth, 2020/10/26
- [PULL 09/31] memory: Add FlatView foreach function, Thomas Huth, 2020/10/26
- [PULL 10/31] fuzz: Add generic virtual-device fuzzer, Thomas Huth, 2020/10/26
- [PULL 11/31] fuzz: Add PCI features to the generic fuzzer, Thomas Huth, 2020/10/26
- [PULL 12/31] fuzz: Add DMA support to the generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 15/31] fuzz: Add support for custom crossover functions, Thomas Huth, 2020/10/26