tests/qtest: Use qtest_system_reset() instead of open-coded versions

Use the qtest_system_reset() function in various tests that were
previously open-coding the system-reset. Note that in several
cases this fixes a bug where the test did not wait for the RESET
QMP event before continuing.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Peter Maydell 2024-11-15 16:50:40 +00:00 committed by Fabiano Rosas
parent 6b76264ed0
commit 9881d3d168
7 changed files with 10 additions and 47 deletions

View file

@ -47,14 +47,6 @@ static void syscfg_set_irq(int num, int level)
qtest_set_irq_in(global_qtest, SOC, NULL, num, level);
}
static void system_reset(void)
{
QDict *response;
response = qtest_qmp(global_qtest, "{'execute': 'system_reset'}");
g_assert(qdict_haskey(response, "return"));
qobject_unref(response);
}
static void test_reset(void)
{
/*
@ -182,7 +174,7 @@ static void test_set_only_bits(void)
syscfg_writel(SYSCFG_SWPR2, 0x00000000);
g_assert_cmphex(syscfg_readl(SYSCFG_SWPR2), ==, 0xFFFFFFFF);
system_reset();
qtest_system_reset(global_qtest);
}
static void test_clear_only_bits(void)
@ -194,7 +186,7 @@ static void test_clear_only_bits(void)
syscfg_writel(SYSCFG_CFGR1, 0x00000001);
g_assert_cmphex(syscfg_readl(SYSCFG_CFGR1), ==, 0x00000000);
system_reset();
qtest_system_reset(global_qtest);
}
static void test_interrupt(void)