Discover private tests by directory
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- docs/run-batch.md +7 -0
- tasks/task_001/tests/Dockerfile +3 -0
- tasks/task_001/tests/docker-compose.yaml +7 -0
- tasks/task_001/tests/grader.py +110 -0
- tasks/task_002/tests/Dockerfile +3 -0
- tasks/task_002/tests/docker-compose.yaml +7 -0
- tasks/task_002/tests/grader.py +110 -0
- tasks/task_003/tests/Dockerfile +3 -0
- tasks/task_003/tests/docker-compose.yaml +7 -0
- tasks/task_003/tests/grader.py +110 -0
- tasks/task_004/tests/Dockerfile +3 -0
- tasks/task_004/tests/docker-compose.yaml +7 -0
- tasks/task_004/tests/grader.py +110 -0
- tasks/task_005/tests/Dockerfile +3 -0
- tasks/task_005/tests/docker-compose.yaml +7 -0
- tasks/task_005/tests/grader.py +110 -0
- tasks/task_006/tests/Dockerfile +3 -0
- tasks/task_006/tests/docker-compose.yaml +7 -0
- tasks/task_006/tests/grader.py +110 -0
- tasks/task_007/tests/Dockerfile +3 -0
- tasks/task_007/tests/docker-compose.yaml +7 -0
- tasks/task_007/tests/grader.py +110 -0
- tasks/task_008/tests/Dockerfile +3 -0
- tasks/task_008/tests/docker-compose.yaml +7 -0
- tasks/task_008/tests/grader.py +110 -0
- tasks/task_009/tests/Dockerfile +3 -0
- tasks/task_009/tests/docker-compose.yaml +7 -0
- tasks/task_009/tests/grader.py +110 -0
- tasks/task_010/tests/Dockerfile +3 -0
- tasks/task_010/tests/docker-compose.yaml +7 -0
- tasks/task_010/tests/grader.py +110 -0
- tasks/task_011/tests/Dockerfile +3 -0
- tasks/task_011/tests/docker-compose.yaml +7 -0
- tasks/task_011/tests/grader.py +110 -0
- tasks/task_012/tests/Dockerfile +3 -0
- tasks/task_012/tests/docker-compose.yaml +7 -0
- tasks/task_012/tests/grader.py +110 -0
- tasks/task_013/tests/Dockerfile +3 -0
- tasks/task_013/tests/docker-compose.yaml +7 -0
- tasks/task_013/tests/grader.py +110 -0
- tasks/task_014/tests/Dockerfile +3 -0
- tasks/task_014/tests/docker-compose.yaml +7 -0
- tasks/task_014/tests/grader.py +110 -0
- tasks/task_015/tests/Dockerfile +3 -0
- tasks/task_015/tests/docker-compose.yaml +7 -0
- tasks/task_015/tests/grader.py +110 -0
- tasks/task_016/tests/Dockerfile +3 -0
- tasks/task_016/tests/docker-compose.yaml +7 -0
- tasks/task_016/tests/grader.py +110 -0
- tasks/task_017/tests/Dockerfile +3 -0
docs/run-batch.md
CHANGED
|
@@ -138,6 +138,13 @@ verifier result therefore evaluates the agent workspace, not the untouched
|
|
| 138 |
baseline. A missing `pre_artifacts.sh` is rejected by `run_batch.py`; rerun
|
| 139 |
`materialize.py` with the current tools to regenerate the task selection.
|
| 140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
## Option Reference
|
| 142 |
|
| 143 |
| Option | Default | Description |
|
|
|
|
| 138 |
baseline. A missing `pre_artifacts.sh` is rejected by `run_batch.py`; rerun
|
| 139 |
`materialize.py` with the current tools to regenerate the task selection.
|
| 140 |
|
| 141 |
+
Private-test collection is directory-based. The verifier runs pytest on
|
| 142 |
+
`/tests/private_tests`, so task authors may use names such as
|
| 143 |
+
`test_res_export.py` or `test_scientific_invariants.py`; no
|
| 144 |
+
`test_task_NNN.py` filename is required. The task's Compose override mounts the
|
| 145 |
+
bundle's dynamic grader into an existing prebuilt verifier image, so correcting
|
| 146 |
+
test discovery does not require rebuilding the image.
|
| 147 |
+
|
| 148 |
## Option Reference
|
| 149 |
|
| 150 |
| Option | Default | Description |
|
tasks/task_001/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-001:v0.1.0@sha256:0d884c02831bea451e74ece1d7bce1eab7c799f34a50f4a434d23861dee53b43
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-001:v0.1.0@sha256:0d884c02831bea451e74ece1d7bce1eab7c799f34a50f4a434d23861dee53b43
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_001/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_001/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_001"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_002/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-002:v0.1.0@sha256:8cbc3c732b8b98f2715f99738209013c0caca2fb1ff9c0b7f5e211036b1e80eb
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-002:v0.1.0@sha256:8cbc3c732b8b98f2715f99738209013c0caca2fb1ff9c0b7f5e211036b1e80eb
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_002/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_002/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_002"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_003/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-003:v0.1.0@sha256:a90cf7d8c7c309353c70c6868c6998871b950116d18cdcdb6430fb43eda4e08c
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-003:v0.1.0@sha256:a90cf7d8c7c309353c70c6868c6998871b950116d18cdcdb6430fb43eda4e08c
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_003/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_003/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_003"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_004/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-c-task-004:v0.1.0@sha256:2553def59dc88f1886ad281da1d561600560a6f8391f177d33bb9f4975e7cc4f
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-c-task-004:v0.1.0@sha256:2553def59dc88f1886ad281da1d561600560a6f8391f177d33bb9f4975e7cc4f
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_004/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_004/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_004"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_005/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-matlab-octave-task-005:v0.1.0@sha256:db56020a2e81fc2c4e260b63c282330da844c2d7c5ef9af7f8abad13e53e3c42
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-matlab-octave-task-005:v0.1.0@sha256:db56020a2e81fc2c4e260b63c282330da844c2d7c5ef9af7f8abad13e53e3c42
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_005/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_005/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_005"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_006/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-c-task-006:v0.1.0@sha256:0be098de5952eeccd310f68602f806dbe7c39b8dedd1c8965d2f98b299e243c0
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-c-task-006:v0.1.0@sha256:0be098de5952eeccd310f68602f806dbe7c39b8dedd1c8965d2f98b299e243c0
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_006/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_006/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_006"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_007/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-007:v0.1.0@sha256:ba9b6eeba1b6ac397d7878bff2d920b1137caf4fda6909422fa9001aab26b24b
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-007:v0.1.0@sha256:ba9b6eeba1b6ac397d7878bff2d920b1137caf4fda6909422fa9001aab26b24b
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_007/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_007/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_007"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_008/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-008:v0.1.0@sha256:5b1e0ed6c18402f96002a1f81b227490f66760d62e6aa2c1cbc06e298b01f0d1
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-008:v0.1.0@sha256:5b1e0ed6c18402f96002a1f81b227490f66760d62e6aa2c1cbc06e298b01f0d1
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_008/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_008/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_008"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_009/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-009:v0.1.0@sha256:0c86818587e5f1c98083bfaac17dcadd18a387ea5a00652b56abd7643a4300b5
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-009:v0.1.0@sha256:0c86818587e5f1c98083bfaac17dcadd18a387ea5a00652b56abd7643a4300b5
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_009/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_009/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_009"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_010/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-010:v0.1.0@sha256:03c655a61e9cedc38110b358a8513f1f988bac8f00a63af794806a53332cd2ec
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-010:v0.1.0@sha256:03c655a61e9cedc38110b358a8513f1f988bac8f00a63af794806a53332cd2ec
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_010/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_010/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_010"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_011/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-011:v0.1.0@sha256:f368455b68e9aa7a13bb1961d2f9a93325626bce0e3ea1f7218b82401dff5568
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-011:v0.1.0@sha256:f368455b68e9aa7a13bb1961d2f9a93325626bce0e3ea1f7218b82401dff5568
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_011/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_011/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_011"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_012/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-012:v0.1.0@sha256:30a474abef9e920af0ebeb84d352a977571536f7f46ed36dd1c2e3d69904f367
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-012:v0.1.0@sha256:30a474abef9e920af0ebeb84d352a977571536f7f46ed36dd1c2e3d69904f367
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_012/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_012/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_012"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_013/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-013:v0.1.0@sha256:0313891e0ae671a89ca41299c724c36c0331f4b6ebec83979b2e0840a8564717
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-013:v0.1.0@sha256:0313891e0ae671a89ca41299c724c36c0331f4b6ebec83979b2e0840a8564717
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_013/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_013/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_013"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_014/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-014:v0.1.0@sha256:5febf367b244f786ee2b6fcb2c9b56b7fe7271df98798daa3660a8fc7daf3324
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-014:v0.1.0@sha256:5febf367b244f786ee2b6fcb2c9b56b7fe7271df98798daa3660a8fc7daf3324
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_014/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_014/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_014"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_015/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-matlab-octave-task-015:v0.1.1@sha256:1715bcb15924adee88f48c6c62ef62753f5a033f55f198dbbb9fcf83018661e8
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-matlab-octave-task-015:v0.1.1@sha256:1715bcb15924adee88f48c6c62ef62753f5a033f55f198dbbb9fcf83018661e8
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_015/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_015/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_015"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_016/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-cython-task-016:v0.1.1@sha256:0f5faca298805d01f881ef0b1dbf658995fc725b850452eb5832a1e627272248
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-cython-task-016:v0.1.1@sha256:0f5faca298805d01f881ef0b1dbf658995fc725b850452eb5832a1e627272248
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|
tasks/task_016/tests/docker-compose.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
main:
|
| 3 |
+
volumes:
|
| 4 |
+
- type: bind
|
| 5 |
+
source: ./grader.py
|
| 6 |
+
target: /tests/grader.py
|
| 7 |
+
read_only: true
|
tasks/task_016/tests/grader.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
import xml.etree.ElementTree as ET
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
TASK_ID = "task_016"
|
| 13 |
+
TASK_ROOT = Path("/app") / TASK_ID
|
| 14 |
+
LOG_ROOT = Path("/logs/verifier")
|
| 15 |
+
LOG_ROOT.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
env = os.environ.copy()
|
| 17 |
+
env.update(
|
| 18 |
+
{
|
| 19 |
+
"SCI_BENCH_TASK_ID": TASK_ID,
|
| 20 |
+
"SCI_BENCH_TASK_DIR": str(TASK_ROOT),
|
| 21 |
+
"PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}",
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]:
|
| 27 |
+
return subprocess.run(
|
| 28 |
+
command,
|
| 29 |
+
cwd=cwd,
|
| 30 |
+
env=env,
|
| 31 |
+
text=True,
|
| 32 |
+
stdout=subprocess.PIPE,
|
| 33 |
+
stderr=subprocess.STDOUT,
|
| 34 |
+
check=False,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
public = execute([sys.executable, "reproduce.py"], TASK_ROOT)
|
| 39 |
+
junit = LOG_ROOT / "junit.xml"
|
| 40 |
+
# Private tests are a task-owned directory. Their filenames are intentionally
|
| 41 |
+
# unconstrained; pytest discovers every supported test module recursively.
|
| 42 |
+
private = execute(
|
| 43 |
+
[
|
| 44 |
+
sys.executable,
|
| 45 |
+
"-m",
|
| 46 |
+
"pytest",
|
| 47 |
+
"-q",
|
| 48 |
+
f"--junitxml={junit}",
|
| 49 |
+
"/tests/private_tests",
|
| 50 |
+
],
|
| 51 |
+
TASK_ROOT,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
private_total = private_passed = private_failed = 0
|
| 55 |
+
if junit.is_file():
|
| 56 |
+
root = ET.parse(junit).getroot()
|
| 57 |
+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
|
| 58 |
+
private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites)
|
| 59 |
+
private_failed = sum(
|
| 60 |
+
int(suite.attrib.get("failures", "0"))
|
| 61 |
+
+ int(suite.attrib.get("errors", "0"))
|
| 62 |
+
for suite in suites
|
| 63 |
+
)
|
| 64 |
+
private_passed = max(private_total - private_failed, 0)
|
| 65 |
+
|
| 66 |
+
reward = int(public.returncode == 0 and private.returncode == 0)
|
| 67 |
+
summary = {
|
| 68 |
+
"reward": reward,
|
| 69 |
+
"task_id": TASK_ID,
|
| 70 |
+
"public": {
|
| 71 |
+
"passed": int(public.returncode == 0),
|
| 72 |
+
"collected": 1,
|
| 73 |
+
"return_code": public.returncode,
|
| 74 |
+
},
|
| 75 |
+
"private": {
|
| 76 |
+
"passed": private_passed,
|
| 77 |
+
"collected": private_total,
|
| 78 |
+
"failed": private_failed,
|
| 79 |
+
"return_code": private.returncode,
|
| 80 |
+
},
|
| 81 |
+
}
|
| 82 |
+
(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n")
|
| 83 |
+
(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n")
|
| 84 |
+
(LOG_ROOT / "ctrf.json").write_text(
|
| 85 |
+
json.dumps(
|
| 86 |
+
{
|
| 87 |
+
"reportFormat": "CTRF",
|
| 88 |
+
"specVersion": "0.0.0",
|
| 89 |
+
"results": {
|
| 90 |
+
"summary": {
|
| 91 |
+
"tests": private_total,
|
| 92 |
+
"passed": private_passed,
|
| 93 |
+
"failed": private_failed,
|
| 94 |
+
},
|
| 95 |
+
"tests": [],
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
indent=2,
|
| 99 |
+
)
|
| 100 |
+
+ "\n"
|
| 101 |
+
)
|
| 102 |
+
combined = (
|
| 103 |
+
"== public ==\n"
|
| 104 |
+
+ (public.stdout or "")
|
| 105 |
+
+ "\n== private ==\n"
|
| 106 |
+
+ (private.stdout or "")
|
| 107 |
+
)
|
| 108 |
+
(LOG_ROOT / "test-stdout.txt").write_text(combined)
|
| 109 |
+
(LOG_ROOT / "run.log").write_text(combined)
|
| 110 |
+
print(json.dumps(summary, sort_keys=True))
|
tasks/task_017/tests/Dockerfile
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-017:v0.1.1@sha256:400c6aa09d0bf39b2af577ba203f9c194bef16d82420b9d79cabcde5a65a6bdf
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-017:v0.1.1@sha256:400c6aa09d0bf39b2af577ba203f9c194bef16d82420b9d79cabcde5a65a6bdf
|
| 2 |
FROM ${VERIFIER_IMAGE}
|
| 3 |
+
|
| 4 |
+
COPY grader.py /tests/grader.py
|
| 5 |
+
RUN chmod 755 /tests/grader.py
|