[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/25] tests/pnv-xscom: Make test independent of glob
From: |
Thomas Huth |
Subject: |
[Qemu-devel] [PULL 09/25] tests/pnv-xscom: Make test independent of global_qtest |
Date: |
Mon, 14 Jan 2019 11:02:04 +0100 |
Pass around the QTestState, so that we can finally get rid of the
out-of-favor global_qtest variable in this file, too.
Signed-off-by: Thomas Huth <address@hidden>
---
tests/pnv-xscom-test.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/tests/pnv-xscom-test.c b/tests/pnv-xscom-test.c
index 70f4c84..974f8da 100644
--- a/tests/pnv-xscom-test.c
+++ b/tests/pnv-xscom-test.c
@@ -63,14 +63,15 @@ static uint64_t pnv_xscom_addr(const PnvChip *chip,
uint32_t pcba)
return addr;
}
-static uint64_t pnv_xscom_read(const PnvChip *chip, uint32_t pcba)
+static uint64_t pnv_xscom_read(QTestState *qts, const PnvChip *chip,
+ uint32_t pcba)
{
- return readq(pnv_xscom_addr(chip, pcba));
+ return qtest_readq(qts, pnv_xscom_addr(chip, pcba));
}
-static void test_xscom_cfam_id(const PnvChip *chip)
+static void test_xscom_cfam_id(QTestState *qts, const PnvChip *chip)
{
- uint64_t f000f = pnv_xscom_read(chip, 0xf000f);
+ uint64_t f000f = pnv_xscom_read(qts, chip, 0xf000f);
g_assert_cmphex(f000f, ==, chip->cfam_id);
}
@@ -78,11 +79,11 @@ static void test_xscom_cfam_id(const PnvChip *chip)
static void test_cfam_id(const void *data)
{
const PnvChip *chip = data;
+ QTestState *qts;
- global_qtest = qtest_initf("-M powernv,accel=tcg -cpu %s",
- chip->cpu_model);
- test_xscom_cfam_id(chip);
- qtest_quit(global_qtest);
+ qts = qtest_initf("-M powernv,accel=tcg -cpu %s", chip->cpu_model);
+ test_xscom_cfam_id(qts, chip);
+ qtest_quit(qts);
}
@@ -94,7 +95,7 @@ static void test_cfam_id(const void *data)
#define PNV_XSCOM_EX_DTS_RESULT0 0x50000
-static void test_xscom_core(const PnvChip *chip)
+static void test_xscom_core(QTestState *qts, const PnvChip *chip)
{
uint32_t first_core_dts0 = PNV_XSCOM_EX_DTS_RESULT0;
uint64_t dts0;
@@ -105,7 +106,7 @@ static void test_xscom_core(const PnvChip *chip)
first_core_dts0 |= PNV_XSCOM_P9_EC_BASE(chip->first_core);
}
- dts0 = pnv_xscom_read(chip, first_core_dts0);
+ dts0 = pnv_xscom_read(qts, chip, first_core_dts0);
g_assert_cmphex(dts0, ==, 0x26f024f023f0000ull);
}
@@ -113,11 +114,11 @@ static void test_xscom_core(const PnvChip *chip)
static void test_core(const void *data)
{
const PnvChip *chip = data;
+ QTestState *qts;
- global_qtest = qtest_initf("-M powernv,accel=tcg -cpu %s",
- chip->cpu_model);
- test_xscom_core(chip);
- qtest_quit(global_qtest);
+ qts = qtest_initf("-M powernv,accel=tcg -cpu %s", chip->cpu_model);
+ test_xscom_core(qts, chip);
+ qtest_quit(qts);
}
static void add_test(const char *name, void (*test)(const void *data))
--
1.8.3.1
- [Qemu-devel] [PULL 08/25] tests/boot-order: Make test independent of global_qtest, (continued)
- [Qemu-devel] [PULL 08/25] tests/boot-order: Make test independent of global_qtest, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 07/25] tests/endianesss: Make test independent of global_qtest, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 06/25] tests/Makefile: Use some more CONFIG switches for ppc tests, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 01/25] hw/misc/ivshmem: Remove deprecated "ivshmem" legacy device, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 13/25] hw/ide/ahci: Remove AllwinnerAHCIState from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 16/25] hw/char/serial: Remove SerialState from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 11/25] hw/pcmcia: Remove PCMCIACardState from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 19/25] ui/console: Remove QemuDmaBuf from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 24/25] configure: Force the C standard to gnu99, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 12/25] hw/ssi: Remove SSIBus from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 09/25] tests/pnv-xscom: Make test independent of global_qtest,
Thomas Huth <=
- [Qemu-devel] [PULL 18/25] audio: Remove AudioState from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 22/25] ppc: Move spapr-related prototypes from xics.h into a seperate header file, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 20/25] ui/console: Remove DisplayState/DisplaySurface from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 17/25] hw/i386: Remove PCMachineClass from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 21/25] linux-user: Fix compilation with clang 3.4, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 10/25] hw/input/ps2: Remove PS2State from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 25/25] tests/hexloader-test: Don't pass -nographic to the QEMU under test, Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 15/25] hw/bt: Remove HCIInfo from "qemu/typedefs.h", Thomas Huth, 2019/01/14
- [Qemu-devel] [PULL 23/25] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode, Thomas Huth, 2019/01/14
- Re: [Qemu-devel] [PULL 00/25] ivshmem deprecation, qtests, typedefs and gnu99, Peter Maydell, 2019/01/14