From nobody Mon Feb 9 00:42:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1503091795016382.5648393618882; Fri, 18 Aug 2017 14:29:55 -0700 (PDT) Received: from localhost ([::1]:34885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dioq1-00011C-P5 for importer@patchew.org; Fri, 18 Aug 2017 17:29:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diocb-000739-UJ for qemu-devel@nongnu.org; Fri, 18 Aug 2017 17:16:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dioca-0000wq-5h for qemu-devel@nongnu.org; Fri, 18 Aug 2017 17:16:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59014) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1diocU-0000jz-Jl; Fri, 18 Aug 2017 17:15:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A60864E4C8; Fri, 18 Aug 2017 21:15:53 +0000 (UTC) Received: from red.redhat.com (ovpn-122-167.rdu2.redhat.com [10.10.122.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3075960468; Fri, 18 Aug 2017 21:15:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A60864E4C8 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 18 Aug 2017 16:15:37 -0500 Message-Id: <20170818211542.5380-9-eblake@redhat.com> In-Reply-To: <20170818211542.5380-1-eblake@redhat.com> References: <20170818211542.5380-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 18 Aug 2017 21:15:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 08/13] tests: Rely more on global_qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Snow , armbru@redhat.com, "open list:Floppy" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" libqtest provides two layers of functions: qtest_*() that operate on an explicit object, and a plain version that operates on the 'global_qtest' object. However, very few tests care about the distinction, and even the tests that manipulate multiple qtest connections at once are just fine reassigning global_qtest around the blocks of code that will then operate on the updated global, rather than calling the verbose form. Before the next few patches get rid of the qtest_* layer, we first need to update the remaining few spots that were using the long form where we can instead rely on the short form. Signed-off-by: Eric Blake Acked-by: John Snow --- tests/fdc-test.c | 2 +- tests/ide-test.c | 10 +++++----- tests/ipmi-bt-test.c | 2 +- tests/ipmi-kcs-test.c | 2 +- tests/libqos/libqos-pc.c | 2 +- tests/postcopy-test.c | 14 +++++++------- tests/rtc-test.c | 9 +++------ tests/tco-test.c | 5 ++--- tests/wdt_ib700-test.c | 30 +++++++++++++++++------------- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 325712e0f2..0b68d9aec4 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -565,7 +565,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); qtest_start("-device floppy,id=3Dfloppy0"); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); qtest_add_func("/fdc/cmos", test_cmos); qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start); qtest_add_func("/fdc/read_without_media", test_read_without_media); diff --git a/tests/ide-test.c b/tests/ide-test.c index aa9de065fc..505a800b44 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -462,7 +462,7 @@ static void test_bmdma_setup(void) "-drive file=3D%s,if=3Dide,serial=3D%s,cache=3Dwriteback,format=3D= raw " "-global ide-hd.ver=3D%s", tmp_path, "testdisk", "version"); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); } static void test_bmdma_teardown(void) @@ -584,7 +584,7 @@ static void test_flush(void) dev =3D get_pci_device(&bmdma_bar, &ide_bar); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); /* Dirty media so that CMD_FLUSH_CACHE will actually go to disk */ make_dirty(0); @@ -635,7 +635,7 @@ static void test_retry_flush(const char *machine) dev =3D get_pci_device(&bmdma_bar, &ide_bar); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); /* Dirty media so that CMD_FLUSH_CACHE will actually go to disk */ make_dirty(0); @@ -826,7 +826,7 @@ static void cdrom_pio_impl(int nblocks) ide_test_start("-drive if=3Dnone,file=3D%s,media=3Dcdrom,format=3Draw,= id=3Dsr0,index=3D0 " "-device ide-cd,drive=3Dsr0,bus=3Dide.0", tmp_path); dev =3D get_pci_device(&bmdma_bar, &ide_bar); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); /* PACKET command on device 0 */ qpci_io_writeb(dev, ide_bar, reg_device, 0); @@ -909,7 +909,7 @@ static void test_cdrom_dma(void) ide_test_start("-drive if=3Dnone,file=3D%s,media=3Dcdrom,format=3Draw,= id=3Dsr0,index=3D0 " "-device ide-cd,drive=3Dsr0,bus=3Dide.0", tmp_path); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); guest_buf =3D guest_alloc(guest_malloc, len); prdt[0].addr =3D cpu_to_le32(guest_buf); diff --git a/tests/ipmi-bt-test.c b/tests/ipmi-bt-test.c index 7e21a9bbcb..891f5bfb13 100644 --- a/tests/ipmi-bt-test.c +++ b/tests/ipmi-bt-test.c @@ -421,7 +421,7 @@ int main(int argc, char **argv) " -device isa-ipmi-bt,bmc=3Dbmc0", emu_port); qtest_start(cmdline); g_free(cmdline); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); qtest_add_func("/ipmi/extern/connect", test_connect); qtest_add_func("/ipmi/extern/bt_base", test_bt_base); qtest_add_func("/ipmi/extern/bt_enable_irq", test_enable_irq); diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c index 178ffc1797..53127d2884 100644 --- a/tests/ipmi-kcs-test.c +++ b/tests/ipmi-kcs-test.c @@ -280,7 +280,7 @@ int main(int argc, char **argv) " -device isa-ipmi-kcs,bmc=3Dbmc0"); qtest_start(cmdline); g_free(cmdline); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); qtest_add_func("/ipmi/local/kcs_base", test_kcs_base); qtest_add_func("/ipmi/local/kcs_abort", test_kcs_abort); qtest_add_func("/ipmi/local/kcs_enable_irq", test_enable_irq); diff --git a/tests/libqos/libqos-pc.c b/tests/libqos/libqos-pc.c index b554758802..6a2ff6608b 100644 --- a/tests/libqos/libqos-pc.c +++ b/tests/libqos/libqos-pc.c @@ -25,7 +25,7 @@ QOSState *qtest_pc_boot(const char *cmdline_fmt, ...) qs =3D qtest_vboot(&qos_ops, cmdline_fmt, ap); va_end(ap); - qtest_irq_intercept_in(global_qtest, "ioapic"); + irq_intercept_in("ioapic"); return qs; } diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index 8142f2ab90..9c4e37473d 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -236,7 +236,7 @@ static QDict *return_or_event(QDict *response) got_stop =3D true; } QDECREF(response); - return return_or_event(qtest_qmp_receive(global_qtest)); + return return_or_event(qmp_receive()); } @@ -318,13 +318,13 @@ static void check_guests_ram(void) bool hit_edge =3D false; bool bad =3D false; - qtest_memread(global_qtest, start_address, &first_byte, 1); + memread(start_address, &first_byte, 1); last_byte =3D first_byte; for (address =3D start_address + 4096; address < end_address; address = +=3D 4096) { uint8_t b; - qtest_memread(global_qtest, address, &b, 1); + memread(address, &b, 1); if (b !=3D last_byte) { if (((b + 1) % 256) =3D=3D last_byte && !hit_edge) { /* This is OK, the guest stopped at the point of @@ -474,19 +474,19 @@ static void test_migrate(void) global_qtest =3D to; - qtest_memread(to, start_address, &dest_byte_a, 1); + memread(start_address, &dest_byte_a, 1); /* Destination still running, wait for a byte to change */ do { - qtest_memread(to, start_address, &dest_byte_b, 1); + memread(start_address, &dest_byte_b, 1); usleep(10 * 1000); } while (dest_byte_a =3D=3D dest_byte_b); qmp_discard_response("{ 'execute' : 'stop'}"); /* With it stopped, check nothing changes */ - qtest_memread(to, start_address, &dest_byte_c, 1); + memread(start_address, &dest_byte_c, 1); sleep(1); - qtest_memread(to, start_address, &dest_byte_d, 1); + memread(start_address, &dest_byte_d, 1); g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); check_guests_ram(); diff --git a/tests/rtc-test.c b/tests/rtc-test.c index d7a96cbd79..bdd234d316 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -685,13 +685,12 @@ static void periodic_timer(void) int main(int argc, char **argv) { - QTestState *s =3D NULL; int ret; g_test_init(&argc, &argv, NULL); - s =3D qtest_start("-rtc clock=3Dvm"); - qtest_irq_intercept_in(s, "ioapic"); + qtest_start("-rtc clock=3Dvm"); + irq_intercept_in("ioapic"); qtest_add_func("/rtc/check-time/bcd", bcd_check_time); qtest_add_func("/rtc/check-time/dec", dec_check_time); @@ -711,9 +710,7 @@ int main(int argc, char **argv) ret =3D g_test_run(); - if (s) { - qtest_quit(s); - } + qtest_end(); return ret; } diff --git a/tests/tco-test.c b/tests/tco-test.c index c4c264eb3d..5b87bc16b9 100644 --- a/tests/tco-test.c +++ b/tests/tco-test.c @@ -54,14 +54,13 @@ static void test_end(TestData *d) static void test_init(TestData *d) { - QTestState *qs; char *s; s =3D g_strdup_printf("-machine q35 %s %s", d->noreboot ? "" : "-global ICH9-LPC.noreboot=3Dfa= lse", !d->args ? "" : d->args); - qs =3D qtest_start(s); - qtest_irq_intercept_in(qs, "ioapic"); + qtest_start(s); + irq_intercept_in("ioapic"); g_free(s); d->bus =3D qpci_init_pc(NULL); diff --git a/tests/wdt_ib700-test.c b/tests/wdt_ib700-test.c index 49f4f0c221..59ba184a82 100644 --- a/tests/wdt_ib700-test.c +++ b/tests/wdt_ib700-test.c @@ -36,7 +36,7 @@ static QDict *qmp_get_event(const char *name) return data; } -static QDict *ib700_program_and_wait(QTestState *s) +static QDict *ib700_program_and_wait(void) { clock_step(NANOSECONDS_PER_SECOND * 40); qmp_check_no_event(); @@ -68,9 +68,10 @@ static QDict *ib700_program_and_wait(QTestState *s) static void ib700_pause(void) { QDict *d; - QTestState *s =3D qtest_start("-watchdog-action pause -device ib700"); - qtest_irq_intercept_in(s, "ioapic"); - d =3D ib700_program_and_wait(s); + + qtest_start("-watchdog-action pause -device ib700"); + irq_intercept_in("ioapic"); + d =3D ib700_program_and_wait(); g_assert(!strcmp(qdict_get_str(d, "action"), "pause")); QDECREF(d); d =3D qmp_get_event("STOP"); @@ -81,9 +82,10 @@ static void ib700_pause(void) static void ib700_reset(void) { QDict *d; - QTestState *s =3D qtest_start("-watchdog-action reset -device ib700"); - qtest_irq_intercept_in(s, "ioapic"); - d =3D ib700_program_and_wait(s); + + qtest_start("-watchdog-action reset -device ib700"); + irq_intercept_in("ioapic"); + d =3D ib700_program_and_wait(); g_assert(!strcmp(qdict_get_str(d, "action"), "reset")); QDECREF(d); d =3D qmp_get_event("RESET"); @@ -94,9 +96,10 @@ static void ib700_reset(void) static void ib700_shutdown(void) { QDict *d; - QTestState *s =3D qtest_start("-watchdog-action reset -no-reboot -devi= ce ib700"); - qtest_irq_intercept_in(s, "ioapic"); - d =3D ib700_program_and_wait(s); + + qtest_start("-watchdog-action reset -no-reboot -device ib700"); + irq_intercept_in("ioapic"); + d =3D ib700_program_and_wait(); g_assert(!strcmp(qdict_get_str(d, "action"), "reset")); QDECREF(d); d =3D qmp_get_event("SHUTDOWN"); @@ -107,9 +110,10 @@ static void ib700_shutdown(void) static void ib700_none(void) { QDict *d; - QTestState *s =3D qtest_start("-watchdog-action none -device ib700"); - qtest_irq_intercept_in(s, "ioapic"); - d =3D ib700_program_and_wait(s); + + qtest_start("-watchdog-action none -device ib700"); + irq_intercept_in("ioapic"); + d =3D ib700_program_and_wait(); g_assert(!strcmp(qdict_get_str(d, "action"), "none")); QDECREF(d); qtest_end(); --=20 2.13.5