static void test_a_boot_order(const char *machine, const char *test_args, uint64_t (*read_boot_order)(void), uint64_t expected_boot, uint64_t expected_reboot) { char *args; uint64_t actual; args = g_strdup_printf("-nodefaults -display none%s%s %s", machine ? " -M " : "", machine ?: "", test_args); qtest_start(args); actual = read_boot_order(); g_assert_cmphex(actual, ==, expected_boot); qmp_discard_response("{ 'execute': 'system_reset' }"); /* * system_reset only requests reset. We get a RESET event after * the actual reset completes. Need to wait for that. */ qmp_discard_response(""); /* HACK: wait for event */ actual = read_boot_order(); g_assert_cmphex(actual, ==, expected_reboot); qtest_quit(global_qtest); g_free(args); }
static void test_a_boot_order(const char *machine, const char *test_args, uint64_t (*read_boot_order)(void), uint64_t expected_boot, uint64_t expected_reboot) { uint64_t actual; global_qtest = qtest_startf("-nodefaults%s%s %s", machine ? " -M " : "", machine ?: "", test_args); actual = read_boot_order(); g_assert_cmphex(actual, ==, expected_boot); qmp_discard_response("{ 'execute': 'system_reset' }"); /* * system_reset only requests reset. We get a RESET event after * the actual reset completes. Need to wait for that. */ qmp_eventwait("RESET"); actual = read_boot_order(); g_assert_cmphex(actual, ==, expected_reboot); qtest_quit(global_qtest); }