summaryrefslogtreecommitdiff
path: root/tests/run-qemu.sh.template
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-qemu.sh.template')
-rw-r--r--tests/run-qemu.sh.template38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/run-qemu.sh.template b/tests/run-qemu.sh.template
new file mode 100644
index 00000000..aba8d68a
--- /dev/null
+++ b/tests/run-qemu.sh.template
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright (C) 2024 Free Software Foundation
+#
+# This program is free software ; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation ; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY ; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with the program ; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+set -e
+
+cmd="QEMU_BIN QEMU_OPTS -cdrom tests/test-TESTNAME.iso"
+log="tests/test-TESTNAME.raw"
+
+echo "temp log $log"
+if which QEMU_BIN >/dev/null ; then
+ if ! timeout -v --foreground --kill-after=3 15s $cmd \
+ | tee $log | sed -n "/TEST_START_MARKER/"',$p' ; then
+ exit 10 # timeout
+ fi
+ if grep -qi 'TEST_FAILURE_MARKER' $log; then
+ exit 99 # error marker found, test explicitely failed
+ fi
+ if ! grep -q 'TEST_SUCCESS_MARKER' $log; then
+ exit 12 # missing reboot marker, maybe the kernel crashed
+ fi
+else
+ echo "skipping, QEMU_BIN not found"
+ exit 77
+fi