]> Git Repo - qemu.git/blobdiff - tests/m48t59-test.c
test-aio: test timers on Windows too
[qemu.git] / tests / m48t59-test.c
index 5179681ca5a842972fa3c67faea600f3f080c0aa..71b4f280528bbe9258e66bcd68edf71ec60ac5fd 100644 (file)
@@ -11,7 +11,6 @@
  * See the COPYING file in the top-level directory.
  *
  */
-#include "libqtest.h"
 
 #include <glib.h>
 #include <stdio.h>
@@ -19,6 +18,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "libqtest.h"
+
 #define RTC_SECONDS             0x9
 #define RTC_MINUTES             0xa
 #define RTC_HOURS               0xb
@@ -35,17 +36,14 @@ static bool use_mmio;
 
 static uint8_t cmos_read_mmio(uint8_t reg)
 {
-    uint8_t data;
-
-    memread(base + (uint32_t)reg_base + (uint32_t)reg, &data, 1);
-    return data;
+    return readb(base + (uint32_t)reg_base + (uint32_t)reg);
 }
 
 static void cmos_write_mmio(uint8_t reg, uint8_t val)
 {
     uint8_t data = val;
 
-    memwrite(base + (uint32_t)reg_base + (uint32_t)reg, &data, 1);
+    writeb(base + (uint32_t)reg_base + (uint32_t)reg, data);
 }
 
 static uint8_t cmos_read_ioio(uint8_t reg)
@@ -142,7 +140,9 @@ static void cmos_get_date_time(struct tm *date)
     date->tm_mday = mday;
     date->tm_mon = mon - 1;
     date->tm_year = base_year + year - 1900;
+#ifndef __sun__
     date->tm_gmtoff = 0;
+#endif
 
     ts = mktime(date);
 }
@@ -233,6 +233,11 @@ static void fuzz_registers(void)
         reg = (uint8_t)g_test_rand_int_range(0, 16);
         val = (uint8_t)g_test_rand_int_range(0, 256);
 
+        if (reg == 7) {
+            /* watchdog setup register, may trigger system reset, skip */
+            continue;
+        }
+
         cmos_write(reg, val);
         cmos_read(reg);
     }
@@ -245,7 +250,7 @@ int main(int argc, char **argv)
 
     g_test_init(&argc, &argv, NULL);
 
-    s = qtest_start("-display none -rtc clock=vm");
+    s = qtest_start("-rtc clock=vm");
 
     qtest_add_func("/rtc/bcd/check-time", bcd_check_time);
     qtest_add_func("/rtc/fuzz-registers", fuzz_registers);
This page took 0.02605 seconds and 4 git commands to generate.