Datasets:

Modalities:
Text
Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
Harbor
License:
lewtun HF Staff commited on
Commit
87713fc
·
verified ·
1 Parent(s): d5af38b

grader: isolated Python (-I -S), no PATH tools (#120 review #5); check.py: import and PATH cheats (part 3)

Browse files
Files changed (50) hide show
  1. tasks/agg-p11-n01/tests/test.sh +19 -9
  2. tasks/agg-p11-n02/tests/test.sh +19 -9
  3. tasks/agg-p11-n04/tests/test.sh +19 -9
  4. tasks/agg-p11-n08/tests/test.sh +19 -9
  5. tasks/agg-p11-n16/tests/test.sh +19 -9
  6. tasks/agg-p12-n01/tests/test.sh +19 -9
  7. tasks/agg-p12-n02/tests/test.sh +19 -9
  8. tasks/agg-p12-n04/tests/test.sh +19 -9
  9. tasks/agg-p12-n08/tests/test.sh +19 -9
  10. tasks/agg-p12-n16/tests/test.sh +19 -9
  11. tasks/agg-p13-n01/tests/test.sh +19 -9
  12. tasks/agg-p13-n02/tests/test.sh +19 -9
  13. tasks/agg-p13-n04/tests/test.sh +19 -9
  14. tasks/agg-p13-n08/tests/test.sh +19 -9
  15. tasks/agg-p13-n16/tests/test.sh +19 -9
  16. tasks/agg-p14-n01/tests/test.sh +19 -9
  17. tasks/agg-p14-n02/tests/test.sh +19 -9
  18. tasks/agg-p14-n04/tests/test.sh +19 -9
  19. tasks/agg-p14-n08/tests/test.sh +19 -9
  20. tasks/agg-p14-n16/tests/test.sh +19 -9
  21. tasks/agg-p15-n01/tests/test.sh +19 -9
  22. tasks/agg-p15-n02/tests/test.sh +19 -9
  23. tasks/agg-p15-n04/tests/test.sh +19 -9
  24. tasks/agg-p15-n08/tests/test.sh +19 -9
  25. tasks/agg-p15-n16/tests/test.sh +19 -9
  26. tasks/agg-p16-n01/tests/test.sh +19 -9
  27. tasks/agg-p16-n02/tests/test.sh +19 -9
  28. tasks/agg-p16-n04/tests/test.sh +19 -9
  29. tasks/agg-p16-n08/tests/test.sh +19 -9
  30. tasks/agg-p16-n16/tests/test.sh +19 -9
  31. tasks/agg-p17-n01/tests/test.sh +19 -9
  32. tasks/agg-p17-n02/tests/test.sh +19 -9
  33. tasks/agg-p17-n04/tests/test.sh +19 -9
  34. tasks/agg-p17-n08/tests/test.sh +19 -9
  35. tasks/agg-p17-n16/tests/test.sh +19 -9
  36. tasks/agg-p18-n01/tests/test.sh +19 -9
  37. tasks/agg-p18-n02/tests/test.sh +19 -9
  38. tasks/agg-p18-n04/tests/test.sh +19 -9
  39. tasks/agg-p18-n08/tests/test.sh +19 -9
  40. tasks/agg-p18-n16/tests/test.sh +19 -9
  41. tasks/agg-p19-n01/tests/test.sh +19 -9
  42. tasks/agg-p19-n02/tests/test.sh +19 -9
  43. tasks/agg-p19-n04/tests/test.sh +19 -9
  44. tasks/agg-p19-n08/tests/test.sh +19 -9
  45. tasks/agg-p19-n16/tests/test.sh +19 -9
  46. tasks/agg-p20-n01/tests/test.sh +19 -9
  47. tasks/agg-p20-n02/tests/test.sh +19 -9
  48. tasks/agg-p20-n04/tests/test.sh +19 -9
  49. tasks/agg-p20-n08/tests/test.sh +19 -9
  50. tasks/agg-p20-n16/tests/test.sh +19 -9
tasks/agg-p11-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p11-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p11-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p11-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p11-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p12-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p12-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p12-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p12-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p12-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p13-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p13-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p13-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p13-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p13-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p14-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p14-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p14-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p14-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p14-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p15-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p15-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p15-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p15-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p15-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p16-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p16-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p16-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p16-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p16-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p17-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p17-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p17-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p17-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p17-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p18-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p18-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p18-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p18-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p18-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p19-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p19-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p19-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p19-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p19-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p20-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p20-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p20-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p20-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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-p20-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. ANSWER,
11
- # EXPECTED and VERIFIER_DIR override the paths (no links in them), to test the grader locally.
12
- answer=${ANSWER:-/app/answer.json}
13
- expected=${EXPECTED:-$(dirname "$0")/expected.json}
14
- verifier=${VERIFIER_DIR:-/logs/verifier}
15
- mkdir -p "$verifier"
16
- rm -f "$verifier/reward.txt" "$verifier/reward.json" "$verifier/answer.json"
17
- echo 0 > "$verifier/reward.txt"
18
- ANSWER="$answer" EXPECTED="$expected" VERIFIER_DIR="$verifier" python3 - <<'PY' || true
 
 
 
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"])