initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
trap 'sync ; echo 1 >/proc/sys/kernel/sysrq ; echo b >/proc/sysrq-trigger' EXIT
|
||||
export PATH=/bin:/usr/bin HOME=/tmp/build TMPDIR=/tmp
|
||||
|
||||
mount -t proc proc /proc
|
||||
mount -t devtmpfs devtmpfs /dev
|
||||
mount -t tmpfs -o mode=1777,size=64m tmp /tmp
|
||||
mount -t ext4 -r /dev/vdb /root/student
|
||||
mount -t ext4 -r /dev/vdc /root/grader
|
||||
mount -t ext4 /dev/vdd /root/results
|
||||
|
||||
mkdir -p /tmp/build
|
||||
cp -a /root/student/. /tmp/build/
|
||||
cp -a --remove-destination /root/grader/build/. /tmp/build/
|
||||
chown -R 65534:65534 /tmp/build
|
||||
|
||||
(
|
||||
cd /tmp/build
|
||||
ulimit -t 30 -u 256 -n 256 -f 2048
|
||||
setpriv --reuid=65534 --regid=65534 --clear-groups \
|
||||
timeout -s 9 30 make >/root/results/build.log 2>&1
|
||||
echo $? >/root/results/build.status
|
||||
)
|
||||
|
||||
[ "$(cat /root/results/build.status)" != 0 ] && exit
|
||||
|
||||
for TEST in /root/grader/tests/*.sh ; do
|
||||
NAME="$(basename "$TEST" .sh)"
|
||||
timeout -s 9 10 "$TEST" 2>/dev/null >"/root/results/$NAME"
|
||||
done
|
||||
Reference in New Issue
Block a user