jaslkdfj
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
{
|
||||
writeShellApplication,
|
||||
pigeon-toolchain
|
||||
}:
|
||||
|
||||
writeShellApplication {
|
||||
name = "pigeon-init";
|
||||
runtimeInputs = [ pigeon-toolchain ];
|
||||
text = ''
|
||||
finish() {
|
||||
umount /root/results || true
|
||||
sync
|
||||
echo 1 >/proc/sys/kernel/sysrq
|
||||
echo b >/proc/sysrq-trigger
|
||||
}
|
||||
trap 'finish' EXIT
|
||||
|
||||
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
|
||||
) || true
|
||||
|
||||
[ "$(cat /root/results/build.status || true)" != 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" || true
|
||||
done
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user