diff --git a/tasks/task_073/tests/Dockerfile b/tasks/task_073/tests/Dockerfile index 2603c1fea4f78e20d36028df29173c8ffd837f21..a4906c8d6d68b4712dcc35c83c1e34a96f7f97be 100644 --- a/tasks/task_073/tests/Dockerfile +++ b/tasks/task_073/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-073:v0.1.0@sha256:6041a2f1f781e1e02e908984c07c6de7a1e2edd67a3ce90529522ebc2e72aee8 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_073/tests/docker-compose.yaml b/tasks/task_073/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_073/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_073/tests/grader.py b/tasks/task_073/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..cf5060450fb2417f03889afe5163ac9ca46ce62d --- /dev/null +++ b/tasks/task_073/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_073" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_074/tests/Dockerfile b/tasks/task_074/tests/Dockerfile index 6f457f9bbf9704eb3cfa45daae06d3cd2a65ffaa..6fb09ae7c81a1973f47beed2c59fad7af0bfd118 100644 --- a/tasks/task_074/tests/Dockerfile +++ b/tasks/task_074/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-074:v0.1.0@sha256:874067a5199b4db19f575c074b7cd51c1eddf03f7aa13c97810ea2873c917d86 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_074/tests/docker-compose.yaml b/tasks/task_074/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_074/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_074/tests/grader.py b/tasks/task_074/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..dc01b22c041a8e994d5afd6a5f4ba5e5761ae45d --- /dev/null +++ b/tasks/task_074/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_074" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_075/tests/Dockerfile b/tasks/task_075/tests/Dockerfile index b8fda75a112e0f383b8a3accc26e421b5158c456..2b6f11227e2df27cb9b885958f131b9da05b0d09 100644 --- a/tasks/task_075/tests/Dockerfile +++ b/tasks/task_075/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-c-task-075:v0.1.0@sha256:c50d05f06eee0035eb02e057017cbdbfae6a9855a900ac819bb90b937285a022 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_075/tests/docker-compose.yaml b/tasks/task_075/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_075/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_075/tests/grader.py b/tasks/task_075/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..92de198fa9a6b732ed42fcee26410b4f1bc9bc16 --- /dev/null +++ b/tasks/task_075/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_075" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_076/tests/Dockerfile b/tasks/task_076/tests/Dockerfile index 27509d8b071b8b169c9c09525684660f3de66037..8a903fd7ca3680b80b59c7595482c3ce2410d559 100644 --- a/tasks/task_076/tests/Dockerfile +++ b/tasks/task_076/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-076:v0.1.0@sha256:c40da6ce2cafe0194e2d74ca0380587b696890713c163a17624a855c86247404 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_076/tests/docker-compose.yaml b/tasks/task_076/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_076/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_076/tests/grader.py b/tasks/task_076/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..5d0d9ef908715104f8b7314ad9df36a75ab0efe5 --- /dev/null +++ b/tasks/task_076/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_076" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_077/tests/Dockerfile b/tasks/task_077/tests/Dockerfile index dbf41d78ab5955f77bb8dd208288c5cb8d6908c4..3f4eb4ba4e97441ee952256e4a5796a7054a5912 100644 --- a/tasks/task_077/tests/Dockerfile +++ b/tasks/task_077/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-077:v0.1.0@sha256:f9f3eb576dd41c94b0407e0a0395e1df75d6cad627be53a028bc995d4f66e633 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_077/tests/docker-compose.yaml b/tasks/task_077/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_077/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_077/tests/grader.py b/tasks/task_077/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..2803c3cde9c161988c5e36a2d6aaf40b065490d6 --- /dev/null +++ b/tasks/task_077/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_077" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_078/tests/Dockerfile b/tasks/task_078/tests/Dockerfile index b49d9bae017a2e7ef025261c05566022a6509c06..4d9deff9874a9bcb3a3601ddef650ba7efdec75c 100644 --- a/tasks/task_078/tests/Dockerfile +++ b/tasks/task_078/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-078:v0.1.0@sha256:9a64793e10d20c2c0b719ae87a72d795435b24f5efb8577071b693ec88b6f882 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_078/tests/docker-compose.yaml b/tasks/task_078/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_078/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_078/tests/grader.py b/tasks/task_078/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..9639e7106be2995d8f0086512201b0975a51538e --- /dev/null +++ b/tasks/task_078/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_078" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_079/tests/Dockerfile b/tasks/task_079/tests/Dockerfile index 9a3218b3bb34801ec28ba851f54d10b618b7c265..1704a0b2e89cbe5d516f07d928d6d3874ca0702b 100644 --- a/tasks/task_079/tests/Dockerfile +++ b/tasks/task_079/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-079:v0.1.0@sha256:243dfa0eb24b77c5c08a9141b632177711d7f438177f0f737c0c2d453c14f7f4 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_079/tests/docker-compose.yaml b/tasks/task_079/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_079/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_079/tests/grader.py b/tasks/task_079/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..11baac084b0bef6ffa5c5b3e91ea7aeacd65a304 --- /dev/null +++ b/tasks/task_079/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_079" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_080/tests/Dockerfile b/tasks/task_080/tests/Dockerfile index 6fa265481ff7e69261dda7ade1eae0385b53b31c..d0e5f61526e32ab20cc2c8ebbf86edf61eaf5444 100644 --- a/tasks/task_080/tests/Dockerfile +++ b/tasks/task_080/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-080:v0.1.0@sha256:0bd2b80b544ce97b0ecbab0c397a5d68014ee7cb2c3133be648db3d3ca0045ed FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_080/tests/docker-compose.yaml b/tasks/task_080/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_080/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_080/tests/grader.py b/tasks/task_080/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..dd6e3293fd9e88ebcca1af88432544cfdfc0ca90 --- /dev/null +++ b/tasks/task_080/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_080" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_081/tests/Dockerfile b/tasks/task_081/tests/Dockerfile index f9091e46058969dfaeeaabc1a6a8b729d8962f34..03f2ee5f0ce26bed3dae8c37a91da36cf5261167 100644 --- a/tasks/task_081/tests/Dockerfile +++ b/tasks/task_081/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-081:v0.1.0@sha256:3a3f4428f0129a1302f743125649b4bea7445e57912bdd734ad3452389003efa FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_081/tests/docker-compose.yaml b/tasks/task_081/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_081/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_081/tests/grader.py b/tasks/task_081/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..079c738fa75f5fa25f2c77698f36616da201d192 --- /dev/null +++ b/tasks/task_081/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_081" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_082/tests/Dockerfile b/tasks/task_082/tests/Dockerfile index 234208ad10d7ee9ba872afe72fb704d24f0e7bbb..3352df3f962e8ccb79bce396064970539f39950e 100644 --- a/tasks/task_082/tests/Dockerfile +++ b/tasks/task_082/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-082:v0.1.0@sha256:a829af72c8e716a904d83a590a865d07a7b9a31a8d4b7083afbf90b6611a937c FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_082/tests/docker-compose.yaml b/tasks/task_082/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_082/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_082/tests/grader.py b/tasks/task_082/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..2d36495d45c313800ea513ea8abd48d0bfdef505 --- /dev/null +++ b/tasks/task_082/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_082" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_083/tests/Dockerfile b/tasks/task_083/tests/Dockerfile index 45214e07b2bf8131fcf1e1faaa39fdf6087eee04..d77fe6357ea97c5ab4eb98c63018a017493aabed 100644 --- a/tasks/task_083/tests/Dockerfile +++ b/tasks/task_083/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-083:v0.1.0@sha256:a1c0f1dabd6d4c334c815cb398eda399fbb8b7739b7b5ec60ea8abb1882b7727 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_083/tests/docker-compose.yaml b/tasks/task_083/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_083/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_083/tests/grader.py b/tasks/task_083/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..ba53f0e57f9c619d8f2b4ec0d67262ff62b1efea --- /dev/null +++ b/tasks/task_083/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_083" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_084/tests/Dockerfile b/tasks/task_084/tests/Dockerfile index 5ec576948a534c02215a180e2e4525144ddeeb54..f739417d55afe69950501fd245981798eaaf7c79 100644 --- a/tasks/task_084/tests/Dockerfile +++ b/tasks/task_084/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-084:v0.1.0@sha256:8cbe4554c727f25c1584f79c48f574a3d08e1fcf6d3c4cb32df36a7d8482216a FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_084/tests/docker-compose.yaml b/tasks/task_084/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_084/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_084/tests/grader.py b/tasks/task_084/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..17fb8d28522a8ea5092c43747f1e61e9de9f636d --- /dev/null +++ b/tasks/task_084/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_084" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_085/tests/Dockerfile b/tasks/task_085/tests/Dockerfile index 5d4ebe5af55fa09da80da5db86438c16fc3e8718..120cf28a4fa2d77baaefeca5e1933c7bfecc996d 100644 --- a/tasks/task_085/tests/Dockerfile +++ b/tasks/task_085/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-fortran-task-085:v0.1.0@sha256:e68ac55c7cfb257756103351c305b97789d72f1e79203305d2aa7fa39e657eb1 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_085/tests/docker-compose.yaml b/tasks/task_085/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_085/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_085/tests/grader.py b/tasks/task_085/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..b859e35097a73aab1b24477be23cf8a419b85739 --- /dev/null +++ b/tasks/task_085/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_085" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_086/tests/Dockerfile b/tasks/task_086/tests/Dockerfile index d76a9e9823ab863ee00f43613a3906ab629bd2ee..958787b7fb36501d26b770f4ddde478db4b69a6f 100644 --- a/tasks/task_086/tests/Dockerfile +++ b/tasks/task_086/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-086:v0.1.0@sha256:fb47312ac7443db59115807334c5d2345e3a2fb7a8f83d89bc8bfb48f7ce4bac FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_086/tests/docker-compose.yaml b/tasks/task_086/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_086/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_086/tests/grader.py b/tasks/task_086/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..c212868d6c1de7070430945e546c01e2edfaf15b --- /dev/null +++ b/tasks/task_086/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_086" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_087/tests/Dockerfile b/tasks/task_087/tests/Dockerfile index ee3f64c67131e948314c8da8375a6ad86c14b4bb..04e90f747b8f08efc8fccb082bc8e2ea30af4d83 100644 --- a/tasks/task_087/tests/Dockerfile +++ b/tasks/task_087/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-087:v0.1.0@sha256:b1ce39c75913bccef5f09acfd2b989857c071fc64c7fdc0dbff092e14dc5270f FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_087/tests/docker-compose.yaml b/tasks/task_087/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_087/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_087/tests/grader.py b/tasks/task_087/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..3a05426c35f06f9bbf6d323a9497456a318157db --- /dev/null +++ b/tasks/task_087/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_087" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_088/tests/Dockerfile b/tasks/task_088/tests/Dockerfile index 46ef481dd0486a64f2e96b141bcd0b2086750a33..c61443ef722f7ab7bd9c60263b7b0146c0fe5ca3 100644 --- a/tasks/task_088/tests/Dockerfile +++ b/tasks/task_088/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-088:v0.1.0@sha256:9f8a00b079fb998f0672f57af8f75628dabc8582122a294f2b20cd304503ac6e FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_088/tests/docker-compose.yaml b/tasks/task_088/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_088/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_088/tests/grader.py b/tasks/task_088/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..cc429250e008c12ee443415f58a2eddbd50f263a --- /dev/null +++ b/tasks/task_088/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_088" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_089/tests/Dockerfile b/tasks/task_089/tests/Dockerfile index 71db30a0953d4c70daaa86c1fbf9dac931af5951..89e2cbefbe0ea116a8d285002a755808f931e977 100644 --- a/tasks/task_089/tests/Dockerfile +++ b/tasks/task_089/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-089:v0.1.0@sha256:66ee7d7df906e3cad4e9d27664f1c6ea9bd6673ef36d5ddd61f5aaa75c88db60 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_089/tests/docker-compose.yaml b/tasks/task_089/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_089/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_089/tests/grader.py b/tasks/task_089/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..06b3716b7cbebcded4ab152127d5c5b1c9b65228 --- /dev/null +++ b/tasks/task_089/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_089" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_090/tests/Dockerfile b/tasks/task_090/tests/Dockerfile index 97c6dc45398af8a821c5c79176bfb1f03ac31744..a390bed6f7611971cbe25839fa7a69bf3e7b6639 100644 --- a/tasks/task_090/tests/Dockerfile +++ b/tasks/task_090/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-090:v0.1.0@sha256:8ba7b5dff3e7bd208683b7d457ebfe6277ce4bdd218bea4d2e0ea322f49a5007 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_090/tests/docker-compose.yaml b/tasks/task_090/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_090/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_090/tests/grader.py b/tasks/task_090/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..7fa7893f0644b5a5a406e993aafd76ad944c6e48 --- /dev/null +++ b/tasks/task_090/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_090" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_091/tests/Dockerfile b/tasks/task_091/tests/Dockerfile index feab61f7e99700d19cb3cc848042e068d80ee501..a324a16e0ab905f5db65bd77e41daa61ca282706 100644 --- a/tasks/task_091/tests/Dockerfile +++ b/tasks/task_091/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-091:v0.1.1@sha256:ec8f7cd03251aa71c0c771816e9833c0daec737c669dc482635be41873933529 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_091/tests/docker-compose.yaml b/tasks/task_091/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_091/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_091/tests/grader.py b/tasks/task_091/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..46054dc3897d0bf32ec2ce573d655efbecc86130 --- /dev/null +++ b/tasks/task_091/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_091" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_092/tests/Dockerfile b/tasks/task_092/tests/Dockerfile index 9a9bf2c2b94832a010096810198c92f5ca40f2fb..651ce3c5b42f688d5a37861b4451f2e2a364c940 100644 --- a/tasks/task_092/tests/Dockerfile +++ b/tasks/task_092/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-092:v0.1.1@sha256:c2f3487455d2635edf02c1287cdd318c0679ea22f478d6a871150d5a5447f948 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_092/tests/docker-compose.yaml b/tasks/task_092/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_092/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_092/tests/grader.py b/tasks/task_092/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..179e7b8ba4fba02a84f0e747d760bee226a07a2f --- /dev/null +++ b/tasks/task_092/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_092" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_093/tests/Dockerfile b/tasks/task_093/tests/Dockerfile index 3fa3de08b1c6c9695f60786aec77b4fee2606f41..b254b144ab7d09607c277f692eaea99af004e2e4 100644 --- a/tasks/task_093/tests/Dockerfile +++ b/tasks/task_093/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-093:v0.1.1@sha256:6378d5a97c239e8867c6a09fd2a07ec026a7abfb0ddd80bb8bae56f8377408b7 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_093/tests/docker-compose.yaml b/tasks/task_093/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_093/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_093/tests/grader.py b/tasks/task_093/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..47bdda530a0f94665d4fa1f2d32e32e171342551 --- /dev/null +++ b/tasks/task_093/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_093" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_094/tests/Dockerfile b/tasks/task_094/tests/Dockerfile index b135d9775b45a9c8cc1173defd253e1b815005c6..e6a6a3fea4c19f7e019047166db965908c785d5e 100644 --- a/tasks/task_094/tests/Dockerfile +++ b/tasks/task_094/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-094:v0.1.1@sha256:f871bca783e8671572e5c2a95c5e9ce74a5cefdf0fa99298f0514beb63ad5f91 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_094/tests/docker-compose.yaml b/tasks/task_094/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_094/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_094/tests/grader.py b/tasks/task_094/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..7b5257d49d4769b30ecf80bac0117674a87a2db3 --- /dev/null +++ b/tasks/task_094/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_094" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_095/tests/Dockerfile b/tasks/task_095/tests/Dockerfile index f7d229542460e9484be72ecf86a8dc9e93b55b77..79a3a4620fbdf038ebd6dad66915d9fd5ba23643 100644 --- a/tasks/task_095/tests/Dockerfile +++ b/tasks/task_095/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-095:v0.1.1@sha256:62f2f24aa3222c0a3a6e3ecee6083aac09591629e44e0582c9952cc44e6cbaf3 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_095/tests/docker-compose.yaml b/tasks/task_095/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_095/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_095/tests/grader.py b/tasks/task_095/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..582f61399bca4a9e35c52d4dfe2abd81e2c98307 --- /dev/null +++ b/tasks/task_095/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_095" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_096/tests/Dockerfile b/tasks/task_096/tests/Dockerfile index 16a8fce769996659b932469947649b434af21981..c5e908e82017d979b0e65712c516e42361a66a3f 100644 --- a/tasks/task_096/tests/Dockerfile +++ b/tasks/task_096/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-096:v0.1.1@sha256:8dbb1d8bae6fcea0585e71a28f019d6daa33026072fcb83cad7cd36ed10cbb94 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_096/tests/docker-compose.yaml b/tasks/task_096/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_096/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_096/tests/grader.py b/tasks/task_096/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..a505a144d684625292461bc7d32f566716a9e8b4 --- /dev/null +++ b/tasks/task_096/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_096" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_097/tests/Dockerfile b/tasks/task_097/tests/Dockerfile index 108c6477a3e9258a16230d5696383d5d332de2d7..bc86c6d0c3480e5f06874c18cef4167908c8d5b6 100644 --- a/tasks/task_097/tests/Dockerfile +++ b/tasks/task_097/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-097:v0.1.1@sha256:12cbdb609f7316d4fa2700879bdbaedfb066aa2df6f0a4a5a8686204efa152c2 FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_097/tests/docker-compose.yaml b/tasks/task_097/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_097/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true diff --git a/tasks/task_097/tests/grader.py b/tasks/task_097/tests/grader.py new file mode 100644 index 0000000000000000000000000000000000000000..6dfdf89d13dde8101c0a2721446586081eeee4e7 --- /dev/null +++ b/tasks/task_097/tests/grader.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import json +import os +import subprocess +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +TASK_ID = "task_097" +TASK_ROOT = Path("/app") / TASK_ID +LOG_ROOT = Path("/logs/verifier") +LOG_ROOT.mkdir(parents=True, exist_ok=True) +env = os.environ.copy() +env.update( + { + "SCI_BENCH_TASK_ID": TASK_ID, + "SCI_BENCH_TASK_DIR": str(TASK_ROOT), + "PYTHONPATH": f"{TASK_ROOT}:{TASK_ROOT / 'source'}", + } +) + + +def execute(command: list[str], cwd: Path) -> subprocess.CompletedProcess[str]: + return subprocess.run( + command, + cwd=cwd, + env=env, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False, + ) + + +public = execute([sys.executable, "reproduce.py"], TASK_ROOT) +junit = LOG_ROOT / "junit.xml" +# Private tests are a task-owned directory. Their filenames are intentionally +# unconstrained; pytest discovers every supported test module recursively. +private = execute( + [ + sys.executable, + "-m", + "pytest", + "-q", + f"--junitxml={junit}", + "/tests/private_tests", + ], + TASK_ROOT, +) + +private_total = private_passed = private_failed = 0 +if junit.is_file(): + root = ET.parse(junit).getroot() + suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite") + private_total = sum(int(suite.attrib.get("tests", "0")) for suite in suites) + private_failed = sum( + int(suite.attrib.get("failures", "0")) + + int(suite.attrib.get("errors", "0")) + for suite in suites + ) + private_passed = max(private_total - private_failed, 0) + +reward = int(public.returncode == 0 and private.returncode == 0) +summary = { + "reward": reward, + "task_id": TASK_ID, + "public": { + "passed": int(public.returncode == 0), + "collected": 1, + "return_code": public.returncode, + }, + "private": { + "passed": private_passed, + "collected": private_total, + "failed": private_failed, + "return_code": private.returncode, + }, +} +(LOG_ROOT / "reward.json").write_text(json.dumps(summary, indent=2) + "\n") +(LOG_ROOT / "reward.txt").write_text(f"{reward:.1f}\n") +(LOG_ROOT / "ctrf.json").write_text( + json.dumps( + { + "reportFormat": "CTRF", + "specVersion": "0.0.0", + "results": { + "summary": { + "tests": private_total, + "passed": private_passed, + "failed": private_failed, + }, + "tests": [], + }, + }, + indent=2, + ) + + "\n" +) +combined = ( + "== public ==\n" + + (public.stdout or "") + + "\n== private ==\n" + + (private.stdout or "") +) +(LOG_ROOT / "test-stdout.txt").write_text(combined) +(LOG_ROOT / "run.log").write_text(combined) +print(json.dumps(summary, sort_keys=True)) diff --git a/tasks/task_098/tests/Dockerfile b/tasks/task_098/tests/Dockerfile index 4264473c06b2b011cd10149e2350252a22fe8292..80a77396e5895b4d02dc882bf343cee25edf5295 100644 --- a/tasks/task_098/tests/Dockerfile +++ b/tasks/task_098/tests/Dockerfile @@ -1,2 +1,5 @@ ARG VERIFIER_IMAGE=docker.io/kevinxulearning/swe-bench-science-verifier-python-task-098:v0.1.1@sha256:55b18bf0203de35a647f1cb292cf10b6381429a77a9858bd90bf79701a0ada0a FROM ${VERIFIER_IMAGE} + +COPY grader.py /tests/grader.py +RUN chmod 755 /tests/grader.py diff --git a/tasks/task_098/tests/docker-compose.yaml b/tasks/task_098/tests/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c5f2e97e5ab6736621a846c95722b74feff5663 --- /dev/null +++ b/tasks/task_098/tests/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + main: + volumes: + - type: bind + source: ./grader.py + target: /tests/grader.py + read_only: true