2017-11-13 14:38:57 +01:00
|
|
|
#!/bin/sh
|
2017-10-27 11:19:56 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
arch=$1
|
|
|
|
prog=$2
|
|
|
|
|
|
|
|
cd /qemu/init
|
2019-02-01 06:34:17 +01:00
|
|
|
echo "#!/bin/sh\n/prog --color=never" > run_prog.sh
|
|
|
|
chmod +x run_prog.sh
|
2017-10-27 11:19:56 +02:00
|
|
|
cp -f $2 prog
|
|
|
|
find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
timeout 30s qemu-system-$arch \
|
|
|
|
-m 1024 \
|
|
|
|
-nographic \
|
|
|
|
-kernel kernel \
|
|
|
|
-initrd initrd.gz \
|
2019-02-01 06:34:17 +01:00
|
|
|
-append init=/run_prog.sh > output || true
|
2017-10-27 11:19:56 +02:00
|
|
|
|
|
|
|
# remove kernel messages
|
|
|
|
tr -d '\r' < output | egrep -v '^\['
|
|
|
|
|
2019-02-01 06:34:17 +01:00
|
|
|
egrep "(PASSED)|(test result: ok)" output > /dev/null
|