35 lines
967 B
Bash
Executable File
35 lines
967 B
Bash
Executable File
#!/bin/sh
|
|
|
|
export PATH=/bin TMPDIR=/tmp
|
|
trap 'sync ; echo 1 >/proc/sys/kernel/sysrq ; echo b >/proc/sysrq-trigger' EXIT
|
|
|
|
mount -t proc proc /proc
|
|
mount -t devtmpfs devtmpfs /dev
|
|
mount -t tmpfs tmp /tmp
|
|
mount -t ext4 -r /dev/vdb /root/student
|
|
mount -t ext4 -r /dev/vdc /root/project
|
|
mount -t ext4 /dev/vdd /root/results
|
|
|
|
cp -a /root/student/. /tmp/
|
|
cp -a --remove-destination /root/project/build/. /tmp/
|
|
chmod -R 777 /tmp
|
|
cd /tmp
|
|
|
|
(
|
|
ulimit -t 30 -u 256 -n 256 -f 2048
|
|
timeout -s 9 30 \
|
|
setpriv --reuid=1 --regid=1 --clear-groups --no-new-privs --inh-caps=-all \
|
|
make >/root/results/build.log 2>&1
|
|
echo $? >/root/results/build.status
|
|
)
|
|
[ "$(cat /root/results/build.status)" != 0 ] && exit 1
|
|
|
|
for TEST in /root/project/tests/*.sh ; do
|
|
(
|
|
ulimit -t 2 -u 256 -n 256 -f 2048
|
|
timeout -s 9 2 \
|
|
setpriv --reuid=1 --regid=1 --clear-groups --no-new-privs --inh-caps=-all \
|
|
"$TEST" >"/root/results/$(basename "$TEST" .sh)" 2>/dev/null
|
|
)
|
|
done
|