grader: isolated Python (-I -S), no PATH tools (#120 review #5); check.py: import and PATH cheats (part 2)
Browse files- tasks/agg-p01-n01/tests/test.sh +19 -9
- tasks/agg-p01-n02/tests/test.sh +19 -9
- tasks/agg-p01-n04/tests/test.sh +19 -9
- tasks/agg-p01-n08/tests/test.sh +19 -9
- tasks/agg-p01-n16/tests/test.sh +19 -9
- tasks/agg-p02-n01/tests/test.sh +19 -9
- tasks/agg-p02-n02/tests/test.sh +19 -9
- tasks/agg-p02-n04/tests/test.sh +19 -9
- tasks/agg-p02-n08/tests/test.sh +19 -9
- tasks/agg-p02-n16/tests/test.sh +19 -9
- tasks/agg-p03-n01/tests/test.sh +19 -9
- tasks/agg-p03-n02/tests/test.sh +19 -9
- tasks/agg-p03-n04/tests/test.sh +19 -9
- tasks/agg-p03-n08/tests/test.sh +19 -9
- tasks/agg-p03-n16/tests/test.sh +19 -9
- tasks/agg-p04-n01/tests/test.sh +19 -9
- tasks/agg-p04-n02/tests/test.sh +19 -9
- tasks/agg-p04-n04/tests/test.sh +19 -9
- tasks/agg-p04-n08/tests/test.sh +19 -9
- tasks/agg-p04-n16/tests/test.sh +19 -9
- tasks/agg-p05-n01/tests/test.sh +19 -9
- tasks/agg-p05-n02/tests/test.sh +19 -9
- tasks/agg-p05-n04/tests/test.sh +19 -9
- tasks/agg-p05-n08/tests/test.sh +19 -9
- tasks/agg-p05-n16/tests/test.sh +19 -9
- tasks/agg-p06-n01/tests/test.sh +19 -9
- tasks/agg-p06-n02/tests/test.sh +19 -9
- tasks/agg-p06-n04/tests/test.sh +19 -9
- tasks/agg-p06-n08/tests/test.sh +19 -9
- tasks/agg-p06-n16/tests/test.sh +19 -9
- tasks/agg-p07-n01/tests/test.sh +19 -9
- tasks/agg-p07-n02/tests/test.sh +19 -9
- tasks/agg-p07-n04/tests/test.sh +19 -9
- tasks/agg-p07-n08/tests/test.sh +19 -9
- tasks/agg-p07-n16/tests/test.sh +19 -9
- tasks/agg-p08-n01/tests/test.sh +19 -9
- tasks/agg-p08-n02/tests/test.sh +19 -9
- tasks/agg-p08-n04/tests/test.sh +19 -9
- tasks/agg-p08-n08/tests/test.sh +19 -9
- tasks/agg-p08-n16/tests/test.sh +19 -9
- tasks/agg-p09-n01/tests/test.sh +19 -9
- tasks/agg-p09-n02/tests/test.sh +19 -9
- tasks/agg-p09-n04/tests/test.sh +19 -9
- tasks/agg-p09-n08/tests/test.sh +19 -9
- tasks/agg-p09-n16/tests/test.sh +19 -9
- tasks/agg-p10-n01/tests/test.sh +19 -9
- tasks/agg-p10-n02/tests/test.sh +19 -9
- tasks/agg-p10-n04/tests/test.sh +19 -9
- tasks/agg-p10-n08/tests/test.sh +19 -9
- tasks/agg-p10-n16/tests/test.sh +19 -9
tasks/agg-p01-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p01-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p01-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p01-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p01-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p02-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p02-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p02-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p02-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p02-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p03-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p03-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p03-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p03-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p03-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p04-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p04-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p04-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p04-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p04-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p05-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p05-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p05-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p05-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p05-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p06-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p06-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p06-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p06-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p06-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p07-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p07-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p07-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p07-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p07-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p08-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p08-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p08-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p08-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p08-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p09-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p09-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p09-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p09-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p09-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p10-n01/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p10-n02/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p10-n04/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p10-n08/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|
tasks/agg-p10-n16/tests/test.sh
CHANGED
|
@@ -7,15 +7,18 @@
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
-
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
import json
|
| 20 |
import os
|
| 21 |
import stat
|
|
@@ -61,6 +64,13 @@ def parse(data):
|
|
| 61 |
|
| 62 |
|
| 63 |
verifier = os.environ["VERIFIER_DIR"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
valid = False
|
| 65 |
try:
|
| 66 |
data = read_own(os.environ["ANSWER"])
|
|
|
|
| 7 |
# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
|
| 8 |
# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
|
| 9 |
# follows a link the agent may have left, and 0 is written before anything is checked, so a crash
|
| 10 |
+
# of the check also scores 0. A copy of the answer stays with the trial's results.
|
| 11 |
+
# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
|
| 12 |
+
# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
|
| 13 |
+
# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
|
| 14 |
+
# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
|
| 15 |
+
# (no links in them), to test the grader locally.
|
| 16 |
+
case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
|
| 17 |
+
export ANSWER=${ANSWER:-/app/answer.json}
|
| 18 |
+
export EXPECTED=${EXPECTED:-$here/expected.json}
|
| 19 |
+
export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
|
| 20 |
+
[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
|
| 21 |
+
python3 -I -S - <<'PY' || true
|
| 22 |
import json
|
| 23 |
import os
|
| 24 |
import stat
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
verifier = os.environ["VERIFIER_DIR"]
|
| 67 |
+
os.makedirs(verifier, exist_ok=True)
|
| 68 |
+
for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
|
| 69 |
+
try:
|
| 70 |
+
os.unlink(os.path.join(verifier, name))
|
| 71 |
+
except FileNotFoundError:
|
| 72 |
+
pass
|
| 73 |
+
write_new(os.path.join(verifier, "reward.txt"), "0")
|
| 74 |
valid = False
|
| 75 |
try:
|
| 76 |
data = read_own(os.environ["ANSWER"])
|