]> git.proxmox.com Git - mirror_qemu.git/blame - tests/qtest/rtas-test.c
meson: link emulators without Makefile.target
[mirror_qemu.git] / tests / qtest / rtas-test.c
CommitLineData
eeddd59f
LV
1#include "qemu/osdep.h"
2#include "qemu/cutils.h"
a2ce7dbd 3#include "libqos/libqtest.h"
eeddd59f
LV
4
5#include "libqos/libqos-spapr.h"
6#include "libqos/rtas.h"
7
8static void test_rtas_get_time_of_day(void)
9{
10 QOSState *qs;
11 struct tm tm;
12 uint32_t ns;
13 uint64_t ret;
14 time_t t1, t2;
15
16 qs = qtest_spapr_boot("-machine pseries");
eeddd59f
LV
17
18 t1 = time(NULL);
eb5937ba 19 ret = qrtas_get_time_of_day(qs->qts, &qs->alloc, &tm, &ns);
eeddd59f
LV
20 g_assert_cmpint(ret, ==, 0);
21 t2 = mktimegm(&tm);
22 g_assert(t2 - t1 < 5); /* 5 sec max to run the test */
23
61ae5cf3 24 qtest_shutdown(qs);
eeddd59f
LV
25}
26
27int main(int argc, char *argv[])
28{
29 const char *arch = qtest_get_arch();
30
31 g_test_init(&argc, &argv, NULL);
32
33 if (strcmp(arch, "ppc64")) {
64ed6f92 34 g_printerr("RTAS requires qemu-system-ppc64\n");
eeddd59f
LV
35 exit(EXIT_FAILURE);
36 }
37 qtest_add_func("rtas/get-time-of-day", test_rtas_get_time_of_day);
38
39 return g_test_run();
40}