target/hppa: Define the rest of the PSW
[qemu/ar7.git] / tests / rtas-test.c
blob276c87ef84913347642b6c39591604cfb0b9d71e
1 #include "qemu/osdep.h"
2 #include "qemu/cutils.h"
3 #include "libqtest.h"
5 #include "libqos/libqos-spapr.h"
6 #include "libqos/rtas.h"
8 static void test_rtas_get_time_of_day(void)
10 QOSState *qs;
11 struct tm tm;
12 uint32_t ns;
13 uint64_t ret;
14 time_t t1, t2;
16 qs = qtest_spapr_boot("-machine pseries");
18 t1 = time(NULL);
19 ret = qrtas_get_time_of_day(qs->alloc, &tm, &ns);
20 g_assert_cmpint(ret, ==, 0);
21 t2 = mktimegm(&tm);
22 g_assert(t2 - t1 < 5); /* 5 sec max to run the test */
24 qtest_shutdown(qs);
27 int main(int argc, char *argv[])
29 const char *arch = qtest_get_arch();
31 g_test_init(&argc, &argv, NULL);
33 if (strcmp(arch, "ppc64")) {
34 g_printerr("RTAS requires ppc64-softmmu/qemu-system-ppc64\n");
35 exit(EXIT_FAILURE);
37 qtest_add_func("rtas/get-time-of-day", test_rtas_get_time_of_day);
39 return g_test_run();