On 04/01/2015 02:00 PM, Ed Maste wrote:
Signed-off-by: Ed Maste <ema...@freebsd.org>
---
tests/libqtest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 12d65bd..54550a8 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -453,6 +453,7 @@ void qtest_qmp_discard_response(QTestState *s, const char
*fmt, ...)
const char *qtest_get_arch(void)
{
const char *qemu = getenv("QTEST_QEMU_BINARY");
+ g_assert(qemu != NULL);
const char *end = strrchr(qemu, '/');
return end + strlen("/qemu-system-");
This one has annoyed me in the past, too.
I wonder if it would be even nicer to add an fprintf to give the user a
nice message explaining exactly what went wrong, though -- since this
particular error is only going to happen when a user is invoking the
test manually.
Maybe:
if (qemu == NULL) {
fprintf(stderr, "...");
g_assert_not_reached();
}
Though that does read a little strangely. ("Here's a nice error message
for something we are asserting will never happen.")
Well, either way, it's better than segfaulting, so:
Reviewed-by: John Snow <js...@redhat.com>