qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, "Li Qiang" <liq3ea@163.com>
Subject: [Qemu-devel] [PULL 09/25] tests/pnv-xscom: Make test independent of global_qtest
Date: Mon, 14 Jan 2019 11:02:04 +0100	[thread overview]
Message-ID: <1547460140-1473-10-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1547460140-1473-1-git-send-email-thuth@redhat.com>

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 <thuth@redhat.com>
---
 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

  parent reply	other threads:[~2019-01-14 10:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 10:01 [Qemu-devel] [PULL 00/25] ivshmem deprecation, qtests, typedefs and gnu99 Thomas Huth
2019-01-14 10:01 ` [Qemu-devel] [PULL 01/25] hw/misc/ivshmem: Remove deprecated "ivshmem" legacy device Thomas Huth
2019-01-14 10:01 ` [Qemu-devel] [PULL 02/25] tests: vhost-user-test: initialize 'fd' in chr_read Thomas Huth
2019-01-14 10:01 ` [Qemu-devel] [PULL 03/25] vhost-user: fix ioeventfd_enabled Thomas Huth
2019-01-14 10:01 ` [Qemu-devel] [PULL 04/25] util: check the return value of fcntl in qemu_set_{block, nonblock} Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 05/25] tests/Makefile: Use some more CONFIG switches for x86 tests Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 06/25] tests/Makefile: Use some more CONFIG switches for ppc tests Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 07/25] tests/endianesss: Make test independent of global_qtest Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 08/25] tests/boot-order: " Thomas Huth
2019-01-14 10:02 ` Thomas Huth [this message]
2019-01-14 10:02 ` [Qemu-devel] [PULL 10/25] hw/input/ps2: Remove PS2State from "qemu/typedefs.h" Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 11/25] hw/pcmcia: Remove PCMCIACardState " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 12/25] hw/ssi: Remove SSIBus " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 13/25] hw/ide/ahci: Remove AllwinnerAHCIState " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 14/25] hw/i2c/smbus: Remove SMBusDevice " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 15/25] hw/bt: Remove HCIInfo " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 16/25] hw/char/serial: Remove SerialState " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 17/25] hw/i386: Remove PCMachineClass " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 18/25] audio: Remove AudioState " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 19/25] ui/console: Remove QemuDmaBuf " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 20/25] ui/console: Remove DisplayState/DisplaySurface " Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 21/25] linux-user: Fix compilation with clang 3.4 Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 22/25] ppc: Move spapr-related prototypes from xics.h into a seperate header file Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 23/25] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 24/25] configure: Force the C standard to gnu99 Thomas Huth
2019-01-14 10:02 ` [Qemu-devel] [PULL 25/25] tests/hexloader-test: Don't pass -nographic to the QEMU under test Thomas Huth
2019-01-14 12:52 ` [Qemu-devel] [PULL 00/25] ivshmem deprecation, qtests, typedefs and gnu99 Peter Maydell
2019-01-14 12:58   ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1547460140-1473-10-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=liq3ea@163.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).