This commit is contained in:
2026-10-23 18:16:37 -04:00
parent 9a72bb38cb
commit 3f2f448c03
3 changed files with 109 additions and 120 deletions
+19 -14
View File
@@ -13,22 +13,27 @@ 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
cd /tmp || exit 1
(
ulimit -t 30 -u 256 -n 256 -f 2048
timeout -s 9 30 \
sandbox() {
LIMIT="$1" ; shift
(
ulimit -t "$LIMIT" -u 256 -n 256 -f 2048
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
)
timeout -s 9 "$LIMIT" "$@"
)
}
sandbox 30 make >/root/results/build.log 2>&1
echo $? >/root/results/build.status
for TEST in /root/project/tests/* ; 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")" 2>/dev/null
echo $? >"/root/results/$(basename "$TEST").status"
)
[ -f "$TEST" ] || continue
NAME="$(basename "$TEST")"
ARGS="/root/project/args/$NAME"
[ -f "$ARGS" ] || ARGS=/dev/null
sandbox 2 "$TEST" <"$ARGS" >"/root/results/$NAME" 2>/dev/null
echo $? >"/root/results/$NAME.status"
done