aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests/qemu
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-13 22:15:30 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 19:26:07 +0200
commit97a5ef664a9950acfe5ee83f562407f06300b705 (patch)
treea631c3942e6c44d15c1b72f1c85fb442aa0c51ae /src/tests/qemu
parentqemu: open /dev/console if we're started early (diff)
downloadwireguard-monolithic-historical-97a5ef664a9950acfe5ee83f562407f06300b705.tar.xz
wireguard-monolithic-historical-97a5ef664a9950acfe5ee83f562407f06300b705.zip
qemu: phase out bitbanging
Although I was secretly proud of having figured out these unholy hacks, it turns out -no-reboot lets us do things in a platform-independent way. Suggested-by: Jann Horn <jann@thejh.net>
Diffstat (limited to 'src/tests/qemu')
-rw-r--r--src/tests/qemu/Makefile2
-rw-r--r--src/tests/qemu/init.c30
-rw-r--r--src/tests/qemu/kernel.config1
3 files changed, 5 insertions, 28 deletions
diff --git a/src/tests/qemu/Makefile b/src/tests/qemu/Makefile
index 58c183a..fc1115f 100644
--- a/src/tests/qemu/Makefile
+++ b/src/tests/qemu/Makefile
@@ -82,7 +82,7 @@ qemu: $(KERNEL_BZIMAGE)
-device virtconsole,chardev=stdio \
-chardev file,id=status,path=$(BUILD_PATH)/result \
-device virtserialport,chardev=status \
- -watchdog ib700 -watchdog-action poweroff \
+ -no-reboot \
-monitor none \
-kernel $< \
-append "console=hvc0"
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c
index e8d3de7..626ce6a 100644
--- a/src/tests/qemu/init.c
+++ b/src/tests/qemu/init.c
@@ -24,12 +24,9 @@ __attribute__((noreturn)) static void poweroff(void)
{
fflush(stdout);
fflush(stderr);
-#if defined(__x86_64__) || defined(__i386__)
- ioperm(0x604, 2, 1);
- outw(1U << 13, 0x604);
-#endif
- kill(-1, SIGKILL);
- reboot(RB_POWER_OFF);
+ reboot(RB_AUTOBOOT);
+ sleep(30);
+ fprintf(stderr, "\x1b[37m\x1b[41m\x1b[1mFailed to power off!!!\x1b[0m\n");
exit(1);
}
@@ -110,26 +107,6 @@ static void enable_logging(void)
close(fd);
}
-static void watchdog(void)
-{
- pretty_message("[+] Enabling watchdog timer...");
-
- ioperm(0x443, 1, 1);
- outb(14, 0x443);
-
- if (fork())
- return;
-
- setpriority(PRIO_PROCESS, 0, -20);
-
- for (;;) {
- outb(14, 0x443);
- sleep(1);
- }
-
- _exit(0);
-}
-
static void kmod_selftests(void)
{
FILE *file;
@@ -225,7 +202,6 @@ int main(int argc, char *argv[])
if (uname(&utsname) < 0)
panic("uname");
print_banner(&utsname);
- watchdog();
mount_filesystems();
kmod_selftests();
if (!linux_4_8_or_higher(&utsname))
diff --git a/src/tests/qemu/kernel.config b/src/tests/qemu/kernel.config
index c29435d..6de2fbe 100644
--- a/src/tests/qemu/kernel.config
+++ b/src/tests/qemu/kernel.config
@@ -80,6 +80,7 @@ CONFIG_DETECT_HUNG_TASK=y
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
+CONFIG_PANIC_TIMEOUT=-1
CONFIG_STACKTRACE=y
CONFIG_EARLY_PRINTK=y
CONFIG_WIREGUARD=y