qemu-test: add support for named choices
[qemu-test.git] / scripts / init
1 #!/bin/sh
2
3 mkdir /proc
4 mount -t proc proc /proc
5
6 mkdir /sys
7 mount -t sysfs sysfs /sys
8
9 mkdir -p /dev/pts
10 mount -t devpts devpts /dev/pts
11
12 echo 0 > /proc/sys/kernel/printk
13
14 mknod /dev/null c 1 3
15 mknod /dev/tty c 5 0
16
17 echo /sbin/mdev > /proc/sys/kernel/hotplug
18 mdev -s
19
20 get_opt() {
21     echo "$@" | cut -f2- -d=
22 }
23
24 for i in `cat /proc/cmdline`; do
25     case $i in
26         seed\=*)
27             seed=`get_opt $i`
28             echo "Setting guest RANDOM seed to $seed"
29             RANDOM=$seed
30             ;;
31         *)
32             ;;
33     esac
34 done
35             
36
37 echo "*** Running tests ***"
38
39 ran="no"
40 if test -d /tests; then
41     for i in /tests/*.sh; do
42         ran="yes"
43         echo -n "Running test $i..."
44         $i
45         rc=$?
46         if test $rc != 0; then
47             echo -e "\t\tFAILED ($rc)"
48             qemu-exit $rc
49         else
50             echo -e "\t\tOK"
51         fi
52     done
53 fi
54
55 if test "$ran" = "no"; then
56     exec /bin/sh
57 fi
58
59 qemu-exit 0