Files
third_party_rust_libc/ci/test-runner-linux
2022-09-21 19:19:09 +08:00

26 lines
478 B
Bash
Executable File

#!/bin/sh
set -e
arch=$1
prog=$2
cd /qemu/init
echo "#!/bin/sh\n/prog --color=never" > run_prog.sh
chmod +x run_prog.sh
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 \
-append init=/run_prog.sh > output || true
# remove kernel messages
tr -d '\r' < output | grep -Ev '^\['
grep -E "(PASSED)|(test result: ok)" output > /dev/null