{"id":2229964,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229964/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429003130.15164-3-farosas@suse.de/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260429003130.15164-3-farosas@suse.de>","date":"2026-04-29T00:31:29","name":"[v1,2/3] tests/qtest: Individual verbose switches","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8eb7a3eaa50609f2881158f04d2762ab48e80d62","submitter":{"id":85343,"url":"http://patchwork.ozlabs.org/api/1.1/people/85343/?format=json","name":"Fabiano Rosas","email":"farosas@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429003130.15164-3-farosas@suse.de/mbox/","series":[{"id":501965,"url":"http://patchwork.ozlabs.org/api/1.1/series/501965/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501965","date":"2026-04-29T00:31:27","name":"tests/qtest: Tweak env variables","version":1,"mbox":"http://patchwork.ozlabs.org/series/501965/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229964/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229964/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=oRLrHcXM;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1kQUGTU6;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=oRLrHcXM;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1kQUGTU6;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)","smtp-out1.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=oRLrHcXM;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=1kQUGTU6"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4ytk6DYJz1yKJ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 10:32:29 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHsqb-0001it-SH; Tue, 28 Apr 2026 20:32:13 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1wHsqI-0001gZ-Cw\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 20:31:55 -0400","from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1wHsqG-0004Ta-6I\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 20:31:54 -0400","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id 1D6D06A81B;\n Wed, 29 Apr 2026 00:31:45 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EB225593B0;\n Wed, 29 Apr 2026 00:31:42 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id oAPoLW5R8WnseQAAD6G6ig\n (envelope-from <farosas@suse.de>); Wed, 29 Apr 2026 00:31:42 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777422705;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7HPi2mSTq12Wn/JdlqeCb9TzXAioVMP72okJrvtQNwk=;\n b=oRLrHcXMNVDsIwnCWS+AhkP/HDw+eThqTrlUnBxj/UouWMhklA2hlrCuUosmS4EO+ktA4C\n ynpqOByvwzjiD+nz/y0jcGJ5iDBI8LLL7JYKNd98oMojGQhagRRqVxDQuwfDZLq1BkwmAx\n pXIhTbGYWHzDbpW10xafVbR6wn1KkUk=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777422705;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7HPi2mSTq12Wn/JdlqeCb9TzXAioVMP72okJrvtQNwk=;\n b=1kQUGTU66ta7RWyH+n2c7608q31upFhsBDlEPPSg1BvZnZbon/dA/Vpro0ZPrhfq0XUL2Y\n C+NUqm1w9KjqyaDQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777422705;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7HPi2mSTq12Wn/JdlqeCb9TzXAioVMP72okJrvtQNwk=;\n b=oRLrHcXMNVDsIwnCWS+AhkP/HDw+eThqTrlUnBxj/UouWMhklA2hlrCuUosmS4EO+ktA4C\n ynpqOByvwzjiD+nz/y0jcGJ5iDBI8LLL7JYKNd98oMojGQhagRRqVxDQuwfDZLq1BkwmAx\n pXIhTbGYWHzDbpW10xafVbR6wn1KkUk=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777422705;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7HPi2mSTq12Wn/JdlqeCb9TzXAioVMP72okJrvtQNwk=;\n b=1kQUGTU66ta7RWyH+n2c7608q31upFhsBDlEPPSg1BvZnZbon/dA/Vpro0ZPrhfq0XUL2Y\n C+NUqm1w9KjqyaDQ=="],"From":"Fabiano Rosas <farosas@suse.de>","To":"qemu-devel@nongnu.org","Cc":"Alexander Bulekov <alxndr@bu.edu>, Paolo Bonzini <pbonzini@redhat.com>,\n Stefan Hajnoczi <stefanha@redhat.com>,\n Darren Kenny <darren.kenny@oracle.com>,\n Laurent Vivier <lvivier@redhat.com>, Peter Xu <peterx@redhat.com>,\n Michael Roth <michael.roth@amd.com>,\n Kostiantyn Kostiuk <kkostiuk@redhat.com>","Subject":"[PATCH v1 2/3] tests/qtest: Individual verbose switches","Date":"Tue, 28 Apr 2026 21:31:29 -0300","Message-ID":"<20260429003130.15164-3-farosas@suse.de>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260429003130.15164-1-farosas@suse.de>","References":"<20260429003130.15164-1-farosas@suse.de>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Rspamd-Action":"no action","X-Rspamd-Server":"rspamd2.dmz-prg2.suse.org","X-Spamd-Result":"default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000];\n R_MISSING_CHARSET(0.50)[];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; DKIM_TRACE(0.00)[suse.de:+];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[];\n FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:mid,suse.de:email];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n RCPT_COUNT_SEVEN(0.00)[9];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_TLS_ALL(0.00)[]","X-Rspamd-Queue-Id":"1D6D06A81B","X-Spam-Score":"-3.01","Received-SPF":"pass client-ip=2a07:de40:b251:101:10:150:64:1;\n envelope-from=farosas@suse.de; helo=smtp-out1.suse.de","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Allow logging to be set for specific parts of QTest. Having a single\nQTEST_LOG knob creates an output stream that is almost useless due to\nspamming from some operations.\n\nAdd a backward-compatible way of selecting which parts will be made\nverbose. Reuse the existing QTEST_LOG variable. The new options are:\n\nQTEST_LOG=\nfuzz - fuzz.c\nqga - unit/test-qga.c\nqmp - libqmp.c\nqtest - QTest device, i.e. -qtest-log option\ntest - generic term for usage of all tests\n\nE.g.:\n\nQTEST_LOG=fuzz,qga,qmp,qtest,test\n  equivalent to QTEST_LOG=1\n\nQTEST_LOG=qmp,qtest\n  enables logging of qmp operations from libqmp.c and logging of the\n  qtest device.\n\nQTEST_LOG=test,qmp\n  enable test output and libqmp.c output.\n\nQTEST_LOG=-qmp\n  enable all output, except for libqmp.c\n\nSigned-off-by: Fabiano Rosas <farosas@suse.de>\n---\n tests/qtest/fuzz/fuzz.c               |  7 ++--\n tests/qtest/fuzz/generic_fuzz.c       |  2 +-\n tests/qtest/libqmp.c                  |  7 ++--\n tests/qtest/libqtest.c                | 56 ++++++++++++++++++++++++++-\n tests/qtest/libqtest.h                | 11 ++++++\n tests/qtest/migration/framework.c     |  2 +-\n tests/qtest/migration/framework.h     |  5 ++-\n tests/qtest/migration/precopy-tests.c |  2 +-\n tests/unit/meson.build                |  2 +-\n tests/unit/test-qga.c                 |  2 +-\n 10 files changed, 82 insertions(+), 14 deletions(-)","diff":"diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c\nindex ca248a51a6..d235598961 100644\n--- a/tests/qtest/fuzz/fuzz.c\n+++ b/tests/qtest/fuzz/fuzz.c\n@@ -105,7 +105,7 @@ static void usage(char *path)\n            \"Set the environment variable FUZZ_SERIALIZE_QTEST=1 to serialize\\n\"\n            \"QTest commands into an ASCII protocol. Useful for building crash\\n\"\n            \"reproducers, but slows down execution.\\n\\n\"\n-           \"Set the environment variable QTEST_LOG=1 to log all qtest commands\"\n+           \"Set the environment variable QTEST_LOG=fuzz to log all qtest commands\"\n            \"\\n\");\n     exit(0);\n }\n@@ -168,6 +168,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)\n     GString *cmd_line;\n     gchar *pretty_cmd_line;\n     bool serialize = false;\n+    bool verbose = qtest_verbose(\"fuzz\");\n \n     /* Initialize qgraph and modules */\n     qos_graph_init();\n@@ -211,14 +212,14 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)\n     /* Run QEMU's system main with the fuzz-target dependent arguments */\n     cmd_line = fuzz_target->get_init_cmdline(fuzz_target);\n     g_string_append_printf(cmd_line, \" %s -qtest /dev/null \",\n-                           getenv(\"QTEST_LOG\") ? \"\" : \"-qtest-log none\");\n+                           verbose ? \"\" : \"-qtest-log none\");\n \n     /* Split the runcmd into an argv and argc */\n     wordexp_t result;\n     wordexp(cmd_line->str, &result, 0);\n     g_string_free(cmd_line, true);\n \n-    if (getenv(\"QTEST_LOG\")) {\n+    if (verbose) {\n         pretty_cmd_line  = g_strjoinv(\" \", result.we_wordv + 1);\n         printf(\"Starting %s with Arguments: %s\\n\",\n                 result.we_wordv[0], pretty_cmd_line);\ndiff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c\nindex 440de25034..e48f868775 100644\n--- a/tests/qtest/fuzz/generic_fuzz.c\n+++ b/tests/qtest/fuzz/generic_fuzz.c\n@@ -776,7 +776,7 @@ static void generic_pre_fuzz(QTestState *s)\n     if (!getenv(\"QEMU_FUZZ_OBJECTS\")) {\n         usage();\n     }\n-    if (getenv(\"QTEST_LOG\")) {\n+    if (qtest_verbose(\"fuzz\")) {\n         qtest_log_enabled = 1;\n     }\n     if (getenv(\"QEMU_AVOID_DOUBLE_FETCH\")) {\ndiff --git a/tests/qtest/libqmp.c b/tests/qtest/libqmp.c\nindex 16fe546885..cd12bd2678 100644\n--- a/tests/qtest/libqmp.c\n+++ b/tests/qtest/libqmp.c\n@@ -17,6 +17,7 @@\n #include \"qemu/osdep.h\"\n \n #include \"libqmp.h\"\n+#include \"libqtest.h\"\n \n #ifndef _WIN32\n #include <sys/socket.h>\n@@ -62,7 +63,7 @@ static void qmp_response(void *opaque, QObject *obj, Error *err)\n QDict *qmp_fd_receive(int fd)\n {\n     QMPResponseParser qmp;\n-    bool log = getenv(\"QTEST_LOG\") != NULL;\n+    bool log = qtest_verbose(\"qmp\");\n \n     qmp.response = NULL;\n     json_message_parser_init(&qmp.parser, qmp_response, &qmp, NULL);\n@@ -149,7 +150,7 @@ _qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num,\n \n     /* No need to send anything for an empty QObject.  */\n     if (qobj) {\n-        int log = getenv(\"QTEST_LOG\") != NULL;\n+        bool log = qtest_verbose(\"qmp\");\n         GString *str = qobject_to_json(qobj);\n \n         /*\n@@ -220,7 +221,7 @@ void qmp_fd_send(int fd, const char *fmt, ...)\n \n void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap)\n {\n-    bool log = getenv(\"QTEST_LOG\") != NULL;\n+    bool log = qtest_verbose(\"qmp\");\n     char *str = g_strdup_vprintf(fmt, ap);\n \n     if (log) {\ndiff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c\nindex a580d75179..b12b8d3dce 100644\n--- a/tests/qtest/libqtest.c\n+++ b/tests/qtest/libqtest.c\n@@ -469,7 +469,7 @@ gchar *qtest_qemu_args(const char *extra_args)\n                       \" -accel qtest\",\n \n                       socket_path,\n-                      getenv(\"QTEST_LOG\") ? DEV_STDERR : DEV_NULL,\n+                      qtest_verbose(\"qtest\") ? DEV_STDERR : DEV_NULL,\n                       qmp_socket_path,\n                       can_exit_with_parent() ?\n                       \"-run-with exit-with-parent=on \" : \"\",\n@@ -2125,3 +2125,57 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb)\n \n     return ret && !err;\n }\n+\n+bool qtest_verbose(const char *domain)\n+{\n+    const char *log = getenv(\"QTEST_LOG\");\n+    char *found;\n+\n+    assert(domain);\n+\n+    if (log) {\n+        /*\n+         * verbose=true for all domains if:\n+         *  QTEST_LOG=\n+         *  QTEST_LOG=1\n+         *  other one-character variations\n+         */\n+        if (log[0] == '\\0' || log[1] == '\\0') {\n+            return true;\n+        }\n+\n+        /*\n+         * verbose=true for specified domains if:\n+         *  QTEST_LOG=<domain>\n+         *  QTEST_LOG=<domain1>,<domain2>\n+         *  allows other separators, except - and +\n+         *\n+         * verbose=false for specified domains if:\n+         *  QTEST_LOG=-<domain>\n+         *  QTEST_LOG=<domain1>,-<domain2> (only false for domain2)\n+         *  allows other separators, except - and +\n+         */\n+        found = strstr(log, domain);\n+\n+        if (found) {\n+            /* reject options given twice */\n+            assert(!strstr(found + strlen(domain), domain));\n+\n+            if (found > log) {\n+                ptrdiff_t i = found - log - 1;\n+                if (log[i] == '-') {\n+                    return false;\n+                }\n+            }\n+            return true;\n+        } else {\n+            /*\n+             * If filtering out a specific domain, all others are\n+             * enabled.\n+             */\n+            return !!strstr(log, \"-\");\n+        }\n+    }\n+\n+    return false;\n+}\ndiff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h\nindex 9c118c89ca..950ea2baaf 100644\n--- a/tests/qtest/libqtest.h\n+++ b/tests/qtest/libqtest.h\n@@ -1178,4 +1178,15 @@ bool have_qemu_img(void);\n  */\n bool mkimg(const char *file, const char *fmt, unsigned size_mb);\n \n+/**\n+ * qtest_verbose:\n+ * @domain: The logging domain\n+ *\n+ * Read the QTEST_LOG environment variable and return whether the\n+ * specified domain is enabled for verbose logging. Enable specific\n+ * logging domains with QTEST_LOG=<domain> or use QTEST_LOG=-<domain> to\n+ * enable all domains except for the specific one.\n+ */\n+bool qtest_verbose(const char *domain);\n+\n #endif\ndiff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c\nindex 9f71d51f1e..49c7f37e60 100644\n--- a/tests/qtest/migration/framework.c\n+++ b/tests/qtest/migration/framework.c\n@@ -365,7 +365,7 @@ int migrate_args(char **from, char **to, const char *uri, MigrateStart *args)\n         g_assert_not_reached();\n     }\n \n-    if (!getenv(\"QTEST_LOG\") && args->hide_stderr) {\n+    if (!qtest_verbose(\"test\") && args->hide_stderr) {\n #ifndef _WIN32\n         ignore_stderr = \"2>/dev/null\";\n #else\ndiff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h\nindex 79604c60f5..bb534b8110 100644\n--- a/tests/qtest/migration/framework.h\n+++ b/tests/qtest/migration/framework.h\n@@ -118,8 +118,9 @@ typedef void (*TestMigrateEndHook)(QTestState *from,\n  */\n typedef struct {\n     /*\n-     * QTEST_LOG=1 may override this.  When QTEST_LOG=1, we always dump errors\n-     * unconditionally, because it means the user would like to be verbose.\n+     * QTEST_LOG=test may override this in which case we dump errors\n+     * unconditionally, because it means the user would like to be\n+     * verbose.\n      */\n     bool hide_stderr;\n     MemType mem_type;\ndiff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c\nindex a0e3ff0547..e65d9e04a5 100644\n--- a/tests/qtest/migration/precopy-tests.c\n+++ b/tests/qtest/migration/precopy-tests.c\n@@ -130,7 +130,7 @@ static bool mlock_check(void)\n static int new_rdma_link(char *buffer, bool ipv6)\n {\n     char cmd[256];\n-    bool verbose = g_getenv(\"QTEST_LOG\");\n+    bool verbose = qtest_verbose(\"test\");\n \n     snprintf(cmd, sizeof(cmd), \"IP_FAMILY=%s %s detect %s\",\n              ipv6 ? \"ipv6\" : \"ipv4\", RDMA_MIGRATION_HELPER,\ndiff --git a/tests/unit/meson.build b/tests/unit/meson.build\nindex 41e8b06c33..4b9d4d5934 100644\n--- a/tests/unit/meson.build\n+++ b/tests/unit/meson.build\n@@ -160,7 +160,7 @@ if have_system\n endif\n \n if have_ga and host_os == 'linux'\n-  tests += {'test-qga': ['../qtest/libqmp.c']}\n+  tests += {'test-qga': ['../qtest/libqmp.c', '../qtest/libqtest.c']}\n   test_deps += {'test-qga': qga}\n endif\n \ndiff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c\nindex 587e30c7e4..01ccf826e6 100644\n--- a/tests/unit/test-qga.c\n+++ b/tests/unit/test-qga.c\n@@ -68,7 +68,7 @@ fixture_setup(TestFixture *fixture, gconstpointer data, gchar **envp)\n     cmd = g_strdup_printf(\"%s%cqga%cqemu-ga -m unix-listen -t %s -p %s %s %s\",\n                           cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR,\n                           fixture->test_dir, path,\n-                          getenv(\"QTEST_LOG\") ? \"-v\" : \"\",\n+                          qtest_verbose(\"qga\") ? \"-v\" : \"\",\n                           extra_arg ?: \"\");\n     g_shell_parse_argv(cmd, NULL, &argv, &error);\n     g_assert_no_error(error);\n","prefixes":["v1","2/3"]}