Debian Codegraph @

tests/run-qemu.sh.template

raw
1 #!/bin/sh
2 # Copyright (C) 2024 Free Software Foundation
3 #
4 # This program is free software ; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation ; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY ; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with the program ; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 set -e
19
20 cmd="QEMU_BIN QEMU_OPTS -cdrom tests/test-TESTNAME.iso"
21 log="tests/test-TESTNAME.raw"
22
23 echo "temp log $log"
24
25 if PLATFORM_XEN && [ ! -e 'XEN_BIN' ]; then
26 echo "skipping, XEN_BIN not found for xen tests"
27 exit 77
28 fi
29
30 if which QEMU_BIN >/dev/null ; then
31 if ! timeout -v --foreground --kill-after=3 120s $cmd \
32 | tee $log | sed -n "/TEST_START_MARKER/"',$p' ; then
33 exit 10 # timeout
34 fi
35 if grep -qi 'TEST_FAILURE_MARKER' $log; then
36 exit 99 # error marker found, test explicitely failed
37 fi
38 if ! grep -q 'TEST_SUCCESS_MARKER' $log; then
39 exit 12 # missing reboot marker, maybe the kernel crashed
40 fi
41 else
42 echo "skipping, QEMU_BIN not found"
43 exit 77
44 fi