[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 23/38] tests/boot-sector: Drop dependence on glob
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v7 23/38] tests/boot-sector: Drop dependence on global_qtest |
Date: |
Mon, 11 Sep 2017 12:20:07 -0500 |
As a general rule, we prefer avoiding implicit global state
because it makes code harder to safely copy and paste without
thinking about the global state. Adjust the helper code to
use explicit state instead, and update all callers.
Fix some trailing whitespace while touching the file.
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
---
tests/boot-sector.h | 6 ++++--
tests/bios-tables-test.c | 2 +-
tests/boot-sector.c | 8 ++++----
tests/pxe-test.c | 2 +-
tests/vmgenid-test.c | 2 +-
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/tests/boot-sector.h b/tests/boot-sector.h
index 35d61c7e2b..6ee6bb4d97 100644
--- a/tests/boot-sector.h
+++ b/tests/boot-sector.h
@@ -5,7 +5,7 @@
*
* Authors:
* Michael S. Tsirkin <address@hidden>
- * Victor Kaplansky <address@hidden>
+ * Victor Kaplansky <address@hidden>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
@@ -14,11 +14,13 @@
#ifndef TEST_BOOT_SECTOR_H
#define TEST_BOOT_SECTOR_H
+#include "libqtest.h"
+
/* Create boot disk file. fname must be a suitable string for mkstemp() */
int boot_sector_init(char *fname);
/* Loop until signature in memory is OK. */
-void boot_sector_test(void);
+void boot_sector_test(QTestState *qts);
/* unlink boot disk file. */
void boot_sector_cleanup(const char *fname);
diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 564da45f65..bde62bf1cf 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -632,7 +632,7 @@ static void test_acpi_one(const char *params, test_data
*data)
qtest_start(args);
- boot_sector_test();
+ boot_sector_test(global_qtest);
test_acpi_rsdp_address(data);
test_acpi_rsdp_table(data);
diff --git a/tests/boot-sector.c b/tests/boot-sector.c
index 9ee85370b0..8c8ac7f124 100644
--- a/tests/boot-sector.c
+++ b/tests/boot-sector.c
@@ -5,7 +5,7 @@
*
* Authors:
* Michael S. Tsirkin <address@hidden>
- * Victor Kaplansky <address@hidden>
+ * Victor Kaplansky <address@hidden>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
@@ -130,7 +130,7 @@ int boot_sector_init(char *fname)
}
/* Loop until signature in memory is OK. */
-void boot_sector_test(void)
+void boot_sector_test(QTestState *qts)
{
uint8_t signature_low;
uint8_t signature_high;
@@ -146,8 +146,8 @@ void boot_sector_test(void)
* instruction.
*/
for (i = 0; i < TEST_CYCLES; ++i) {
- signature_low = readb(SIGNATURE_ADDR);
- signature_high = readb(SIGNATURE_ADDR + 1);
+ signature_low = qtest_readb(qts, SIGNATURE_ADDR);
+ signature_high = qtest_readb(qts, SIGNATURE_ADDR + 1);
signature = (signature_high << 8) | signature_low;
if (signature == SIGNATURE) {
break;
diff --git a/tests/pxe-test.c b/tests/pxe-test.c
index 0d70afccd6..e2d3853534 100644
--- a/tests/pxe-test.c
+++ b/tests/pxe-test.c
@@ -31,7 +31,7 @@ static void test_pxe_one(const char *params, bool ipv6)
ipv6 ? "on" : "off", params);
qtest_start(args);
- boot_sector_test();
+ boot_sector_test(global_qtest);
qtest_quit(global_qtest);
g_free(args);
}
diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c
index 918c82c82a..0ea98b86d7 100644
--- a/tests/vmgenid-test.c
+++ b/tests/vmgenid-test.c
@@ -47,7 +47,7 @@ static uint32_t acpi_find_vgia(void)
int i;
/* Wait for guest firmware to finish and start the payload. */
- boot_sector_test();
+ boot_sector_test(global_qtest);
/* Tables should be initialized now. */
rsdp_offset = acpi_find_rsdp_address();
--
2.13.5
- [Qemu-devel] [PATCH v7 21/38] vhost-user-test: Drop dependence on global_qtest, (continued)
- [Qemu-devel] [PATCH v7 21/38] vhost-user-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 20/38] postcopy-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 22/38] qmp-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 19/38] ivshmem-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 18/38] ahci-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 17/38] libqos: Use explicit QTestState for remaining libqos operations, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 23/38] tests/boot-sector: Drop dependence on global_qtest,
Eric Blake <=
- [Qemu-devel] [PATCH v7 24/38] tests/acpi-utils: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 25/38] wdt_ib700-test: Drop dependence on global_qtest, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 27/38] libqtest: Swap order of qtest_init() and qtest_start(), Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 30/38] qtest: Avoid passing raw strings through hmp(), Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 26/38] libqtest: Merge qtest_end() into qtest_quit(), Eric Blake, 2017/09/11