[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/22] tests/libqtest: Print error instead of abortin
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 05/22] tests/libqtest: Print error instead of aborting when env variable is missing |
Date: |
Sun, 4 Jun 2017 18:45:09 +0300 |
From: Thomas Huth <address@hidden>
When you currently try to run a test directly from the command line
without setting the QTEST_QEMU_BINARY environment variable first,
you are presented with an unhelpful assertion message like this:
ERROR:tests/libqtest.c:163:qtest_init_without_qmp_handshake:
assertion failed: (qemu_binary != NULL)
Aborted (core dumped)
Let's replace the assert() with a more user friendly error message
instead.
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
tests/libqtest.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 84ecbd2bd8..4a5492a603 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -160,7 +160,10 @@ QTestState *qtest_init_without_qmp_handshake(const char
*extra_args)
const char *qemu_binary;
qemu_binary = getenv("QTEST_QEMU_BINARY");
- g_assert(qemu_binary != NULL);
+ if (!qemu_binary) {
+ fprintf(stderr, "Environment variable QTEST_QEMU_BINARY required\n");
+ exit(1);
+ }
s = g_malloc(sizeof(*s));
--
2.11.0
- [Qemu-devel] [PULL 00/22] Trivial patches for 2017-06-04, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 02/22] qemu-doc: Add hyperlinks to further license information, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 08/22] trivial: Remove unneeded ifndef in memory.h, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 10/22] target/arm: add data cache invalidation cp15 instruction to cortex-r5, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 07/22] altera_timer: fix incorrect memset, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 05/22] tests/libqtest: Print error instead of aborting when env variable is missing,
Michael Tokarev <=
- [Qemu-devel] [PULL 22/22] hw/core: nmi.c can be compiled as common-obj nowadays, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 11/22] hw/xtensa: sim: use g_string/g_new, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 14/22] hw/mips: add missing include, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 01/22] qemu-doc: Move the qemu-ga description into a separate chapter, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 17/22] qemu-ga: remove useless allocation, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 19/22] ide-test: check return of fwrite, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 15/22] qapi: Fix some QMP documentation regressions, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 18/22] help: Add newline to end of thread option help text, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 04/22] docs/qdev-device-use.txt: update section Default Devices, Michael Tokarev, 2017/06/04
- [Qemu-devel] [PULL 13/22] register: display register prefix (name) since it is available, Michael Tokarev, 2017/06/04