Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tasks/format-code-task-000103/environment/Dockerfile +3 -0
- tasks/format-code-task-000103/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000103/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000103/tests/test.patch +127 -0
- tasks/format-code-task-000103/tests/test.sh +41 -0
- tasks/format-code-task-000103/tests/test_command.sh +1 -0
- tasks/format-code-task-000104/environment/Dockerfile +3 -0
- tasks/format-code-task-000104/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000104/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000104/tests/test.patch +247 -0
- tasks/format-code-task-000104/tests/test.sh +40 -0
- tasks/format-code-task-000104/tests/test_command.sh +1 -0
- tasks/format-code-task-000105/environment/Dockerfile +3 -0
- tasks/format-code-task-000105/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000105/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000105/tests/test.patch +109 -0
- tasks/format-code-task-000105/tests/test.sh +39 -0
- tasks/format-code-task-000105/tests/test_command.sh +1 -0
- tasks/format-code-task-000156/environment/Dockerfile +3 -0
- tasks/format-code-task-000156/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000156/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000156/tests/test.patch +108 -0
- tasks/format-code-task-000156/tests/test.sh +45 -0
- tasks/format-code-task-000156/tests/test_command.sh +1 -0
- tasks/format-code-task-000158/environment/Dockerfile +3 -0
- tasks/format-code-task-000158/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000158/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000158/tests/test.patch +114 -0
- tasks/format-code-task-000158/tests/test.sh +39 -0
- tasks/format-code-task-000158/tests/test_command.sh +1 -0
- tasks/format-code-task-000160/environment/Dockerfile +3 -0
- tasks/format-code-task-000160/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000160/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000160/tests/test.patch +101 -0
- tasks/format-code-task-000160/tests/test.sh +39 -0
- tasks/format-code-task-000160/tests/test_command.sh +1 -0
- tasks/format-code-task-000167/environment/Dockerfile +3 -0
- tasks/format-code-task-000167/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000167/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000167/tests/test.patch +148 -0
- tasks/format-code-task-000167/tests/test.sh +38 -0
- tasks/format-code-task-000167/tests/test_command.sh +1 -0
- tasks/format-code-task-000169/environment/Dockerfile +3 -0
- tasks/format-code-task-000169/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000169/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000169/tests/test.patch +227 -0
- tasks/format-code-task-000169/tests/test.sh +38 -0
- tasks/format-code-task-000169/tests/test_command.sh +1 -0
- tasks/format-code-task-000193/environment/Dockerfile +3 -0
- tasks/format-code-task-000193/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000103/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ce6a14e8770b45cfe55150ae7fea639a567e6dbede5bf58e521398e72137e283
|
tasks/format-code-task-000103/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000103/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000103/tests/test.patch
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/oracle/controllers/instancecontroller/instance_controller_parameters_test.go b/oracle/controllers/instancecontroller/instance_controller_parameters_test.go
|
| 2 |
+
index a63c794..9da307a 100644
|
| 3 |
+
--- a/oracle/controllers/instancecontroller/instance_controller_parameters_test.go
|
| 4 |
+
+++ b/oracle/controllers/instancecontroller/instance_controller_parameters_test.go
|
| 5 |
+
@@ -8,7 +8,7 @@ import (
|
| 6 |
+
commonv1alpha1 "github.com/GoogleCloudPlatform/elcarro-oracle-operator/common/api/v1alpha1"
|
| 7 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/api/v1alpha1"
|
| 8 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/controllers/testhelpers"
|
| 9 |
+
- pb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/config_agent/protos"
|
| 10 |
+
+ dbdpb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/oracle"
|
| 11 |
+
. "github.com/onsi/ginkgo"
|
| 12 |
+
. "github.com/onsi/gomega"
|
| 13 |
+
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
| 14 |
+
@@ -64,7 +64,11 @@ func TestSanityCheckForReservedParameters(t *testing.T) {
|
| 15 |
+
fakeClientFactory := &testhelpers.FakeClientFactory{}
|
| 16 |
+
fakeClientFactory.Reset()
|
| 17 |
+
fakeConfigAgentClient := fakeClientFactory.Caclient
|
| 18 |
+
- fakeConfigAgentClient.SetMethodToResp("FetchServiceImageMetaData", &pb.FetchServiceImageMetaDataResponse{
|
| 19 |
+
+
|
| 20 |
+
+ fakeDatabaseClientFactory := &testhelpers.FakeDatabaseClientFactory{}
|
| 21 |
+
+ fakeDatabaseClientFactory.Reset()
|
| 22 |
+
+ fakeDatabaseClient := fakeDatabaseClientFactory.Dbclient
|
| 23 |
+
+ fakeDatabaseClient.SetMethodToResp("FetchServiceImageMetaData", &dbdpb.FetchServiceImageMetaDataResponse{
|
| 24 |
+
Version: "19.3",
|
| 25 |
+
CdbName: "GCLOUD",
|
| 26 |
+
OracleHome: "/u01/app/oracle/product/19.3/db",
|
| 27 |
+
diff --git a/oracle/controllers/instancecontroller/instance_controller_restore_test.go b/oracle/controllers/instancecontroller/instance_controller_restore_test.go
|
| 28 |
+
index 876a89f..1b34047 100644
|
| 29 |
+
--- a/oracle/controllers/instancecontroller/instance_controller_restore_test.go
|
| 30 |
+
+++ b/oracle/controllers/instancecontroller/instance_controller_restore_test.go
|
| 31 |
+
@@ -10,7 +10,7 @@ import (
|
| 32 |
+
commonv1alpha1 "github.com/GoogleCloudPlatform/elcarro-oracle-operator/common/api/v1alpha1"
|
| 33 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/api/v1alpha1"
|
| 34 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/controllers/testhelpers"
|
| 35 |
+
- pb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/config_agent/protos"
|
| 36 |
+
+ dbdpb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/oracle"
|
| 37 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/k8s"
|
| 38 |
+
"github.com/go-logr/logr"
|
| 39 |
+
. "github.com/onsi/ginkgo"
|
| 40 |
+
@@ -40,8 +40,9 @@ func testInstanceRestore() {
|
| 41 |
+
fakeDatabaseClient = fakeDatabaseClientFactory.Dbclient
|
| 42 |
+
|
| 43 |
+
fakeConfigAgentClient.SetAsyncPhysicalRestore(true)
|
| 44 |
+
- fakeClientFactory.Caclient.SetMethodToResp(
|
| 45 |
+
- "FetchServiceImageMetaData", &pb.FetchServiceImageMetaDataResponse{
|
| 46 |
+
+
|
| 47 |
+
+ fakeDatabaseClient.SetMethodToResp(
|
| 48 |
+
+ "FetchServiceImageMetaData", &dbdpb.FetchServiceImageMetaDataResponse{
|
| 49 |
+
Version: "19.3",
|
| 50 |
+
CdbName: "",
|
| 51 |
+
OracleHome: "/u01/app/oracle/product/19.3/db",
|
| 52 |
+
@@ -176,7 +177,8 @@ func testInstanceRestore() {
|
| 53 |
+
|
| 54 |
+
// reset method call counters used later
|
| 55 |
+
fakeConfigAgentClient.Reset()
|
| 56 |
+
- fakeConfigAgentClient.SetMethodToResp("FetchServiceImageMetaData", &pb.FetchServiceImageMetaDataResponse{
|
| 57 |
+
+
|
| 58 |
+
+ fakeDatabaseClient.SetMethodToResp("FetchServiceImageMetaData", &dbdpb.FetchServiceImageMetaDataResponse{
|
| 59 |
+
Version: "12.2",
|
| 60 |
+
CdbName: "GCLOUD",
|
| 61 |
+
OracleHome: "/u01/app/oracle/product/12.2/db",
|
| 62 |
+
diff --git a/oracle/controllers/instancecontroller/instance_controller_test.go b/oracle/controllers/instancecontroller/instance_controller_test.go
|
| 63 |
+
index 32d2d21..2ac267f 100644
|
| 64 |
+
--- a/oracle/controllers/instancecontroller/instance_controller_test.go
|
| 65 |
+
+++ b/oracle/controllers/instancecontroller/instance_controller_test.go
|
| 66 |
+
@@ -21,7 +21,6 @@ import (
|
| 67 |
+
"testing"
|
| 68 |
+
"time"
|
| 69 |
+
|
| 70 |
+
- pb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/config_agent/protos"
|
| 71 |
+
"github.com/go-logr/logr"
|
| 72 |
+
. "github.com/onsi/ginkgo"
|
| 73 |
+
. "github.com/onsi/gomega"
|
| 74 |
+
@@ -34,6 +33,7 @@ import (
|
| 75 |
+
commonv1alpha1 "github.com/GoogleCloudPlatform/elcarro-oracle-operator/common/api/v1alpha1"
|
| 76 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/api/v1alpha1"
|
| 77 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/controllers/testhelpers"
|
| 78 |
+
+ dbdpb "github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/agents/oracle"
|
| 79 |
+
"github.com/GoogleCloudPlatform/elcarro-oracle-operator/oracle/pkg/k8s"
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
@@ -84,15 +84,15 @@ var _ = Describe("Instance controller", func() {
|
| 83 |
+
|
| 84 |
+
BeforeEach(func() {
|
| 85 |
+
fakeClientFactory.Reset()
|
| 86 |
+
- fakeClientFactory.Caclient.SetMethodToResp(
|
| 87 |
+
- "FetchServiceImageMetaData", &pb.FetchServiceImageMetaDataResponse{
|
| 88 |
+
+
|
| 89 |
+
+ fakeDatabaseClientFactory.Reset()
|
| 90 |
+
+ fakeDatabaseClientFactory.Dbclient.SetMethodToResp(
|
| 91 |
+
+ "FetchServiceImageMetaData", &dbdpb.FetchServiceImageMetaDataResponse{
|
| 92 |
+
Version: "12.2",
|
| 93 |
+
CdbName: "GCLOUD",
|
| 94 |
+
OracleHome: "/u01/app/oracle/product/12.2/db",
|
| 95 |
+
SeededImage: true,
|
| 96 |
+
})
|
| 97 |
+
-
|
| 98 |
+
- fakeDatabaseClientFactory.Reset()
|
| 99 |
+
})
|
| 100 |
+
|
| 101 |
+
Context("New instance", testInstanceProvision)
|
| 102 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 103 |
+
new file mode 100644
|
| 104 |
+
--- /dev/null
|
| 105 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 106 |
+
@@ -0,0 +1,10 @@
|
| 107 |
+
+H4sIAAAAAAAAA+2TTY/TMBCGe86vmNVeQMh2km2CBOLECYkTcANU5WPaWOvYwR/d1Yofj+NKtF2J
|
| 108 |
+
+FtCuEDCPFDl2Zl5PPK95G6TqV6i3YvFY5JHnVZXGyP0xvRdVWZR5frXMy0VeFFVdL6B6tIoOCM43
|
| 109 |
+
+FmBhjfGn4s59/0vh+/57dH7VmXFsdM/d8HB7nOl/UVVX3/tfVnXs/7IuqgXkD1fCj/nP+395IVqp
|
| 110 |
+
+Rdu4Iet6SCZosc+yS3ij49EoBdehxeQStDB/hpjQWIkOnqCPOc9SBGsm6dBu0T4FuQZtPEwWHWrP
|
| 111 |
+
+o9aHAVOug+AQOqO9NUqhZTZoL0eEaMCkfTPIbgCLX4KM2eCHKAGNBxGcFcp0jRIH9aTaeRb3+wgX
|
| 112 |
+
+wNanwlKtn1/OkjqDyHjdSwtsOpGU4rpgVdR279/C4P3kXgixkX4ILY+XJWVYjbF45uTGHSlYVNg4
|
| 113 |
+
+dKI3N1qZphfbkl/x8jBolVZWSupwu2rGvl7yaEi+uYNPafeZrzB7lN3eAXsdWzROYlfYtJucVNv/
|
| 114 |
+
++5mz+UXJ456fEj+O/I1tOq/O6ceQJGxHYHb9E+LZWs4efxf0bIj4WMT5lDfodyZfS4WOZxuzm7It
|
| 115 |
+
+sM5Es74qgM2ONcFDnecOuDC26RSKvaudkPPd0R3u10T2p686QRAEQRAEQRAEQRAEQRAEQRAEQRAE
|
| 116 |
+
+QRD/KN8A3NhOjAAoAAA=
|
| 117 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 118 |
+
new file mode 100755
|
| 119 |
+
--- /dev/null
|
| 120 |
+
+++ b/mimo_test_command.sh
|
| 121 |
+
@@ -0,0 +1,6 @@
|
| 122 |
+
+#!/usr/bin/env bash
|
| 123 |
+
+
|
| 124 |
+
+set -uo pipefail
|
| 125 |
+
+cd /testbed || exit 1
|
| 126 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 127 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000103/tests/test.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
oracle/controllers/instancecontroller/instance_controller_parameters_test.go
|
| 25 |
+
oracle/controllers/instancecontroller/instance_controller_restore_test.go
|
| 26 |
+
oracle/controllers/instancecontroller/instance_controller_test.go
|
| 27 |
+
mimo_build_env.tar.gz.b64
|
| 28 |
+
mimo_test_command.sh
|
| 29 |
+
EOF_RESET_TEST_FILES
|
| 30 |
+
|
| 31 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 32 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 33 |
+
cat "$V/apply.log" >&2
|
| 34 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 35 |
+
exit 1
|
| 36 |
+
fi
|
| 37 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 38 |
+
RC=$?
|
| 39 |
+
tail -c 12000 "$V/test_output.log"
|
| 40 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 41 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000103/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000104/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b54d400b21c23f77cfddb955fbdd191ed31af6803d0c37c21888bf556292d332
|
tasks/format-code-task-000104/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000104/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000104/tests/test.patch
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/internal/gcsx/append_object_creator_test.go b/internal/gcsx/append_object_creator_test.go
|
| 2 |
+
index b5fae06ba0..70cb5e9651 100644
|
| 3 |
+
--- a/internal/gcsx/append_object_creator_test.go
|
| 4 |
+
+++ b/internal/gcsx/append_object_creator_test.go
|
| 5 |
+
@@ -201,6 +201,74 @@ func (t *AppendObjectCreatorTest) CallsComposeObjects() {
|
| 6 |
+
ExpectEq(tmpObject.Generation, src.Generation)
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
+func (t *AppendObjectCreatorTest) CallsComposeObjectsWithObjectProperties() {
|
| 10 |
+
+ t.srcObject.Name = "foo"
|
| 11 |
+
+ t.srcObject.Generation = 17
|
| 12 |
+
+ t.srcObject.MetaGeneration = 23
|
| 13 |
+
+ t.srcObject.CacheControl = "testCacheControl"
|
| 14 |
+
+ t.srcObject.ContentDisposition = "inline"
|
| 15 |
+
+ t.srcObject.ContentEncoding = "gzip"
|
| 16 |
+
+ t.srcObject.ContentType = "text/plain"
|
| 17 |
+
+ t.srcObject.CustomTime = "2022-04-02T00:30:00Z"
|
| 18 |
+
+ t.srcObject.EventBasedHold = true
|
| 19 |
+
+ t.srcObject.StorageClass = "STANDARD"
|
| 20 |
+
+ t.srcObject.Metadata = map[string]string {
|
| 21 |
+
+ "test_key": "test_value",
|
| 22 |
+
+ }
|
| 23 |
+
+ t.mtime = time.Now().Add(123 * time.Second).UTC()
|
| 24 |
+
+
|
| 25 |
+
+
|
| 26 |
+
+ tmpObject := &gcs.Object{
|
| 27 |
+
+ Name: "bar",
|
| 28 |
+
+ Generation: 19,
|
| 29 |
+
+ }
|
| 30 |
+
+
|
| 31 |
+
+ ExpectCall(t.bucket, "CreateObject")(Any(), Any()).
|
| 32 |
+
+ WillOnce(Return(tmpObject, nil))
|
| 33 |
+
+
|
| 34 |
+
+
|
| 35 |
+
+ var req *gcs.ComposeObjectsRequest
|
| 36 |
+
+ ExpectCall(t.bucket, "ComposeObjects")(Any(), Any()).
|
| 37 |
+
+ WillOnce(DoAll(SaveArg(1, &req), Return(nil, errors.New(""))))
|
| 38 |
+
+
|
| 39 |
+
+
|
| 40 |
+
+ ExpectCall(t.bucket, "DeleteObject")(Any(), deleteReqName(tmpObject.Name)).
|
| 41 |
+
+ WillOnce(Return(nil))
|
| 42 |
+
+
|
| 43 |
+
+
|
| 44 |
+
+ t.call()
|
| 45 |
+
+
|
| 46 |
+
+ AssertNe(nil, req)
|
| 47 |
+
+ ExpectEq(t.srcObject.Name, req.DstName)
|
| 48 |
+
+ ExpectThat(
|
| 49 |
+
+ req.DstGenerationPrecondition,
|
| 50 |
+
+ Pointee(Equals(t.srcObject.Generation)))
|
| 51 |
+
+ ExpectThat(
|
| 52 |
+
+ req.DstMetaGenerationPrecondition,
|
| 53 |
+
+ Pointee(Equals(t.srcObject.MetaGeneration)))
|
| 54 |
+
+ ExpectEq(t.srcObject.CacheControl, req.CacheControl)
|
| 55 |
+
+ ExpectEq(t.srcObject.ContentDisposition, req.ContentDisposition)
|
| 56 |
+
+ ExpectEq(t.srcObject.ContentEncoding, req.ContentEncoding)
|
| 57 |
+
+ ExpectEq(t.srcObject.ContentType, req.ContentType)
|
| 58 |
+
+ ExpectEq(t.srcObject.CustomTime, req.CustomTime)
|
| 59 |
+
+ ExpectEq(t.srcObject.EventBasedHold, req.EventBasedHold)
|
| 60 |
+
+
|
| 61 |
+
+ ExpectEq(2, len(req.Metadata))
|
| 62 |
+
+ ExpectEq(t.mtime.Format(time.RFC3339Nano), req.Metadata["gcsfuse_mtime"])
|
| 63 |
+
+ ExpectEq("test_value", req.Metadata["test_key"])
|
| 64 |
+
+
|
| 65 |
+
+ AssertEq(2, len(req.Sources))
|
| 66 |
+
+ var src gcs.ComposeSource
|
| 67 |
+
+
|
| 68 |
+
+ src = req.Sources[0]
|
| 69 |
+
+ ExpectEq(t.srcObject.Name, src.Name)
|
| 70 |
+
+ ExpectEq(t.srcObject.Generation, src.Generation)
|
| 71 |
+
+
|
| 72 |
+
+ src = req.Sources[1]
|
| 73 |
+
+ ExpectEq(tmpObject.Name, src.Name)
|
| 74 |
+
+ ExpectEq(tmpObject.Generation, src.Generation)
|
| 75 |
+
+}
|
| 76 |
+
+
|
| 77 |
+
func (t *AppendObjectCreatorTest) ComposeObjectsFails() {
|
| 78 |
+
// CreateObject
|
| 79 |
+
tmpObject := &gcs.Object{
|
| 80 |
+
diff --git a/internal/gcsx/syncer_test.go b/internal/gcsx/syncer_test.go
|
| 81 |
+
index 0f3e23e4bf..f8da2ca698 100644
|
| 82 |
+
--- a/internal/gcsx/syncer_test.go
|
| 83 |
+
+++ b/internal/gcsx/syncer_test.go
|
| 84 |
+
@@ -25,6 +25,7 @@ import (
|
| 85 |
+
"github.com/jacobsa/gcloud/gcs"
|
| 86 |
+
"github.com/jacobsa/gcloud/gcs/gcsfake"
|
| 87 |
+
. "github.com/jacobsa/oglematchers"
|
| 88 |
+
+ . "github.com/jacobsa/oglemock"
|
| 89 |
+
. "github.com/jacobsa/ogletest"
|
| 90 |
+
"github.com/jacobsa/timeutil"
|
| 91 |
+
"golang.org/x/net/context"
|
| 92 |
+
@@ -32,6 +33,134 @@ import (
|
| 93 |
+
|
| 94 |
+
func TestSyncer(t *testing.T) { RunTests(t) }
|
| 95 |
+
|
| 96 |
+
+
|
| 97 |
+
+
|
| 98 |
+
+
|
| 99 |
+
+
|
| 100 |
+
+type FullObjectCreatorTest struct {
|
| 101 |
+
+ ctx context.Context
|
| 102 |
+
+ bucket gcs.MockBucket
|
| 103 |
+
+ creator objectCreator
|
| 104 |
+
+
|
| 105 |
+
+ srcObject gcs.Object
|
| 106 |
+
+ srcContents string
|
| 107 |
+
+ mtime time.Time
|
| 108 |
+
+}
|
| 109 |
+
+
|
| 110 |
+
+func init() { RegisterTestSuite(&FullObjectCreatorTest{}) }
|
| 111 |
+
+
|
| 112 |
+
+func (t *FullObjectCreatorTest) SetUp(ti *TestInfo) {
|
| 113 |
+
+ t.ctx = ti.Ctx
|
| 114 |
+
+
|
| 115 |
+
+
|
| 116 |
+
+ t.bucket = gcs.NewMockBucket(ti.MockController, "bucket")
|
| 117 |
+
+
|
| 118 |
+
+
|
| 119 |
+
+ t.creator = &fullObjectCreator{
|
| 120 |
+
+ bucket: t.bucket,
|
| 121 |
+
+ }
|
| 122 |
+
+}
|
| 123 |
+
+
|
| 124 |
+
+func (t *FullObjectCreatorTest) call() (o *gcs.Object, err error) {
|
| 125 |
+
+ o, err = t.creator.Create(
|
| 126 |
+
+ t.ctx,
|
| 127 |
+
+ &t.srcObject,
|
| 128 |
+
+ t.mtime,
|
| 129 |
+
+ strings.NewReader(t.srcContents))
|
| 130 |
+
+
|
| 131 |
+
+ return
|
| 132 |
+
+}
|
| 133 |
+
+
|
| 134 |
+
+
|
| 135 |
+
+
|
| 136 |
+
+
|
| 137 |
+
+
|
| 138 |
+
+func (t *FullObjectCreatorTest) CallsCreateObject() {
|
| 139 |
+
+ t.srcContents = "taco"
|
| 140 |
+
+
|
| 141 |
+
+
|
| 142 |
+
+ var req *gcs.CreateObjectRequest
|
| 143 |
+
+ ExpectCall(t.bucket, "CreateObject")(Any(), Any()).
|
| 144 |
+
+ WillOnce(DoAll(SaveArg(1, &req), Return(nil, errors.New(""))))
|
| 145 |
+
+
|
| 146 |
+
+
|
| 147 |
+
+ t.call()
|
| 148 |
+
+
|
| 149 |
+
+ AssertNe(nil, req)
|
| 150 |
+
+ ExpectThat(req.GenerationPrecondition, Pointee(Equals(0)))
|
| 151 |
+
+
|
| 152 |
+
+ b, err := ioutil.ReadAll(req.Contents)
|
| 153 |
+
+ AssertEq(nil, err)
|
| 154 |
+
+ ExpectEq(t.srcContents, string(b))
|
| 155 |
+
+}
|
| 156 |
+
+
|
| 157 |
+
+func (t *FullObjectCreatorTest) CreateObjectFails() {
|
| 158 |
+
+ var err error
|
| 159 |
+
+
|
| 160 |
+
+
|
| 161 |
+
+ ExpectCall(t.bucket, "CreateObject")(Any(), Any()).
|
| 162 |
+
+ WillOnce(Return(nil, errors.New("taco")))
|
| 163 |
+
+
|
| 164 |
+
+
|
| 165 |
+
+ _, err = t.call()
|
| 166 |
+
+
|
| 167 |
+
+ ExpectThat(err, Error(HasSubstr("CreateObject")))
|
| 168 |
+
+ ExpectThat(err, Error(HasSubstr("taco")))
|
| 169 |
+
+}
|
| 170 |
+
+
|
| 171 |
+
+func (t *FullObjectCreatorTest) CreateObjectReturnsPreconditionError() {
|
| 172 |
+
+ var err error
|
| 173 |
+
+
|
| 174 |
+
+
|
| 175 |
+
+ ExpectCall(t.bucket, "CreateObject")(Any(), Any()).
|
| 176 |
+
+ WillOnce(Return(nil, &gcs.PreconditionError{Err: errors.New("taco")}))
|
| 177 |
+
+
|
| 178 |
+
+
|
| 179 |
+
+ _, err = t.call()
|
| 180 |
+
+
|
| 181 |
+
+ var preconditionErr *gcs.PreconditionError
|
| 182 |
+
+ ExpectTrue(errors.As(err, &preconditionErr))
|
| 183 |
+
+ ExpectThat(err, Error(HasSubstr("CreateObject")))
|
| 184 |
+
+ ExpectThat(err, Error(HasSubstr("taco")))
|
| 185 |
+
+}
|
| 186 |
+
+
|
| 187 |
+
+func (t *FullObjectCreatorTest) CallsCreateObjectsWithObjectProperties() {
|
| 188 |
+
+ t.srcObject.Name = "foo"
|
| 189 |
+
+ t.srcObject.Generation = 17
|
| 190 |
+
+ t.srcObject.MetaGeneration = 23
|
| 191 |
+
+ t.srcObject.CacheControl = "testCacheControl"
|
| 192 |
+
+ t.srcObject.ContentDisposition = "inline"
|
| 193 |
+
+ t.srcObject.ContentEncoding = "gzip"
|
| 194 |
+
+ t.srcObject.ContentType = "text/plain"
|
| 195 |
+
+ t.srcObject.CustomTime = "2022-04-02T00:30:00Z"
|
| 196 |
+
+ t.srcObject.EventBasedHold = true
|
| 197 |
+
+ t.srcObject.StorageClass = "STANDARD"
|
| 198 |
+
+ t.srcObject.Metadata = map[string]string {
|
| 199 |
+
+ "test_key": "test_value",
|
| 200 |
+
+ }
|
| 201 |
+
+ t.mtime = time.Now().Add(123 * time.Second).UTC()
|
| 202 |
+
+
|
| 203 |
+
+ var req *gcs.CreateObjectRequest
|
| 204 |
+
+ ExpectCall(t.bucket, "CreateObject")(Any(), Any()).
|
| 205 |
+
+ WillOnce(DoAll(SaveArg(1, &req), Return(nil, errors.New(""))))
|
| 206 |
+
+
|
| 207 |
+
+
|
| 208 |
+
+ t.call()
|
| 209 |
+
+
|
| 210 |
+
+ AssertNe(nil, req)
|
| 211 |
+
+ ExpectEq(t.srcObject.Name, req.Name)
|
| 212 |
+
+ ExpectEq(t.srcObject.CacheControl, req.CacheControl)
|
| 213 |
+
+ ExpectEq(t.srcObject.ContentDisposition, req.ContentDisposition)
|
| 214 |
+
+ ExpectEq(t.srcObject.ContentEncoding, req.ContentEncoding)
|
| 215 |
+
+ ExpectEq(t.srcObject.ContentType, req.ContentType)
|
| 216 |
+
+ ExpectEq(t.srcObject.CustomTime, req.CustomTime)
|
| 217 |
+
+ ExpectEq(t.srcObject.EventBasedHold, req.EventBasedHold)
|
| 218 |
+
+
|
| 219 |
+
+ ExpectEq(2, len(req.Metadata))
|
| 220 |
+
+ ExpectEq(t.mtime.Format(time.RFC3339Nano), req.Metadata["gcsfuse_mtime"])
|
| 221 |
+
+ ExpectEq("test_value", req.Metadata["test_key"])
|
| 222 |
+
+}
|
| 223 |
+
+
|
| 224 |
+
////////////////////////////////////////////////////////////////////////
|
| 225 |
+
// fakeObjectCreator
|
| 226 |
+
////////////////////////////////////////////////////////////////////////
|
| 227 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 228 |
+
new file mode 100644
|
| 229 |
+
--- /dev/null
|
| 230 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 231 |
+
@@ -0,0 +1,5 @@
|
| 232 |
+
+H4sIAAAAAAAAA+3Rz4rCMBAG8Jx9ikH24B7aJrWpJw/iA3hYz0qbBP+giaSp7MI+/NZeFEG9KOL6
|
| 233 |
+
+/S4zJAOZ8MVlvdroubH7hD0KbwykbGvjvLa9kClPc5mKPGNciJxnjOTDNjpRV6HwRMw7F67N3bp/
|
| 234 |
+
+UfEx/2CqMFduuy2sjqvl/d64lb/oD87yz/JUMOL3W+GyN89faWqDL43uLBwdWor2FClX2zAUFCcr
|
| 235 |
+
+G4y3xSZZqOo7ocjXlrqz3rSZHO12xupJuTYqjL0pgvO/h/OvH6uM//zodp79PQAAAAAAAAAAAAAA
|
| 236 |
+
+AAAAAACAf+0P6UaZJwAoAAA=
|
| 237 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 238 |
+
new file mode 100755
|
| 239 |
+
--- /dev/null
|
| 240 |
+
+++ b/mimo_test_command.sh
|
| 241 |
+
@@ -0,0 +1,6 @@
|
| 242 |
+
+#!/usr/bin/env bash
|
| 243 |
+
+
|
| 244 |
+
+set -uo pipefail
|
| 245 |
+
+cd /testbed || exit 1
|
| 246 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 247 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000104/tests/test.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
internal/gcsx/append_object_creator_test.go
|
| 25 |
+
internal/gcsx/syncer_test.go
|
| 26 |
+
mimo_build_env.tar.gz.b64
|
| 27 |
+
mimo_test_command.sh
|
| 28 |
+
EOF_RESET_TEST_FILES
|
| 29 |
+
|
| 30 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 31 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 32 |
+
cat "$V/apply.log" >&2
|
| 33 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 34 |
+
exit 1
|
| 35 |
+
fi
|
| 36 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 37 |
+
RC=$?
|
| 38 |
+
tail -c 12000 "$V/test_output.log"
|
| 39 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 40 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000104/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000105/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:13a78ffaf2a5084faeac5b58b0c54823c7f97427724b7b44f73a00b2c5f3937a
|
tasks/format-code-task-000105/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000105/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000105/tests/test.patch
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/pkg/util/fs_util_test.go b/pkg/util/fs_util_test.go
|
| 2 |
+
index 20f80820..23badddf 100644
|
| 3 |
+
--- a/pkg/util/fs_util_test.go
|
| 4 |
+
+++ b/pkg/util/fs_util_test.go
|
| 5 |
+
@@ -536,3 +536,82 @@ func TestExtractFile(t *testing.T) {
|
| 6 |
+
})
|
| 7 |
+
}
|
| 8 |
+
}
|
| 9 |
+
+
|
| 10 |
+
+func Test_CopySymlink(t *testing.T) {
|
| 11 |
+
+ type setup func(t *testing.T, dest string)
|
| 12 |
+
+ tests := []struct {
|
| 13 |
+
+ name string
|
| 14 |
+
+ linkTgt string
|
| 15 |
+
+ setupDest setup
|
| 16 |
+
+ }{
|
| 17 |
+
+ {
|
| 18 |
+
+ name: "dest does not exist, relative target",
|
| 19 |
+
+ linkTgt: "the-target",
|
| 20 |
+
+ setupDest: func(t *testing.T, dest string) {
|
| 21 |
+
+
|
| 22 |
+
+ },
|
| 23 |
+
+ },
|
| 24 |
+
+ {
|
| 25 |
+
+ name: "dest does not exist, absolute target",
|
| 26 |
+
+ linkTgt: "/usr/local/lib/libpython3.7m.so",
|
| 27 |
+
+ setupDest: func(t *testing.T, dest string) {
|
| 28 |
+
+
|
| 29 |
+
+ },
|
| 30 |
+
+ },
|
| 31 |
+
+ {
|
| 32 |
+
+ name: "dest is existing symlink, relative target",
|
| 33 |
+
+ linkTgt: "the-target",
|
| 34 |
+
+ setupDest: func(t *testing.T, dest string) {
|
| 35 |
+
+ if err := os.Symlink("some-other-target", dest); err != nil {
|
| 36 |
+
+ t.Fatal(err)
|
| 37 |
+
+ }
|
| 38 |
+
+ },
|
| 39 |
+
+ },
|
| 40 |
+
+ {
|
| 41 |
+
+ name: "dest is existing symlink, absolute target",
|
| 42 |
+
+ linkTgt: "/usr/local/lib/libpython3.7m.so",
|
| 43 |
+
+ setupDest: func(t *testing.T, dest string) {
|
| 44 |
+
+ if err := os.Symlink("/some/other/path", dest); err != nil {
|
| 45 |
+
+ t.Fatal(err)
|
| 46 |
+
+ }
|
| 47 |
+
+ },
|
| 48 |
+
+ },
|
| 49 |
+
+ }
|
| 50 |
+
+ for _, tt := range tests {
|
| 51 |
+
+ t.Run(tt.name, func(t *testing.T) {
|
| 52 |
+
+ testDir, err := ioutil.TempDir("", "copysymlink")
|
| 53 |
+
+ if err != nil {
|
| 54 |
+
+ t.Fatalf("err creating tempdir: %v", err)
|
| 55 |
+
+ }
|
| 56 |
+
+ defer os.RemoveAll(testDir)
|
| 57 |
+
+
|
| 58 |
+
+ src := filepath.Join(testDir, "src.link")
|
| 59 |
+
+ if err := os.Symlink(tt.linkTgt, src); err != nil {
|
| 60 |
+
+ t.Fatalf("err creating src symlink: %v", err)
|
| 61 |
+
+ }
|
| 62 |
+
+
|
| 63 |
+
+ dest := filepath.Join(testDir, "dest.link")
|
| 64 |
+
+ tt.setupDest(t, dest)
|
| 65 |
+
+
|
| 66 |
+
+ if err := CopySymlink(src, dest); err != nil {
|
| 67 |
+
+ t.Fatalf("CopySymlink returned error: %v", err)
|
| 68 |
+
+ }
|
| 69 |
+
+
|
| 70 |
+
+ fi, err := os.Lstat(dest)
|
| 71 |
+
+ if err != nil {
|
| 72 |
+
+ t.Fatalf("Lstat(dest) failed: %v", err)
|
| 73 |
+
+ }
|
| 74 |
+
+ if fi.Mode()&os.ModeSymlink == 0 {
|
| 75 |
+
+ t.Fatalf("expected dest to be a symlink, mode=%v", fi.Mode())
|
| 76 |
+
+ }
|
| 77 |
+
+
|
| 78 |
+
+ got, err := os.Readlink(dest)
|
| 79 |
+
+ if err != nil {
|
| 80 |
+
+ t.Fatalf("Readlink(dest) failed: %v", err)
|
| 81 |
+
+ }
|
| 82 |
+
+ if got != tt.linkTgt {
|
| 83 |
+
+ t.Errorf("symlink target mismatch: got %q, want %q", got, tt.linkTgt)
|
| 84 |
+
+ }
|
| 85 |
+
+ })
|
| 86 |
+
+ }
|
| 87 |
+
+}
|
| 88 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 89 |
+
new file mode 100644
|
| 90 |
+
index 00000000..1ad83dfd
|
| 91 |
+
--- /dev/null
|
| 92 |
+
+++ b/test_commands.json
|
| 93 |
+
@@ -0,0 +1,3 @@
|
| 94 |
+
+{
|
| 95 |
+
+ "test_commands": ["ln -sfn $(pwd) /go/src/github.com/GoogleContainerTools/kaniko && cd /go/src/github.com/GoogleContainerTools/kaniko && GO111MODULE=off go test -run Test_CopySymlink -v ./pkg/util/"]
|
| 96 |
+
+}
|
| 97 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 98 |
+
new file mode 100755
|
| 99 |
+
--- /dev/null
|
| 100 |
+
+++ b/mimo_test_command.sh
|
| 101 |
+
@@ -0,0 +1,8 @@
|
| 102 |
+
+#!/usr/bin/env bash
|
| 103 |
+
+
|
| 104 |
+
+set -uo pipefail
|
| 105 |
+
+cd /testbed
|
| 106 |
+
+rc=0
|
| 107 |
+
+ln -sfn $(pwd) /go/src/github.com/GoogleContainerTools/kaniko && cd /go/src/github.com/GoogleContainerTools/kaniko && GO111MODULE=off go test -run Test_CopySymlink -v ./pkg/util/
|
| 108 |
+
+rc=$(( rc | $? ))
|
| 109 |
+
+exit $rc
|
tasks/format-code-task-000105/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
pkg/util/fs_util_test.go
|
| 25 |
+
test_commands.json
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000105/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000156/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:0d3abf1cdb3cf0f0ba2304b4d07b0e7e3854b3c5cc4563843fde832a8e2c14bc
|
tasks/format-code-task-000156/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000156/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000156/tests/test.patch
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 0000000..140d7c5
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/test_commands.json
|
| 6 |
+
@@ -0,0 +1,3 @@
|
| 7 |
+
+{
|
| 8 |
+
+ "test_commands": ["python -m pytest tests/atest/rules/errors/variables_import_with_args/ tests/atest/rules/duplications/duplicated_variables_import/"]
|
| 9 |
+
+}
|
| 10 |
+
diff --git a/tests/atest/rules/duplications/duplicated_variables_import/expected_output_args.txt b/tests/atest/rules/duplications/duplicated_variables_import/expected_output_args.txt
|
| 11 |
+
new file mode 100644
|
| 12 |
+
index 0000000..098b9a6
|
| 13 |
+
--- /dev/null
|
| 14 |
+
+++ b/tests/atest/rules/duplications/duplicated_variables_import/expected_output_args.txt
|
| 15 |
+
@@ -0,0 +1 @@
|
| 16 |
+
+test_args.robot:3:1 [W] 0807 Duplicated variables import with path 'variables.robot' (first occurrence in line 2)
|
| 17 |
+
diff --git a/tests/atest/rules/duplications/duplicated_variables_import/test_args.robot b/tests/atest/rules/duplications/duplicated_variables_import/test_args.robot
|
| 18 |
+
new file mode 100644
|
| 19 |
+
index 0000000..c7df222
|
| 20 |
+
--- /dev/null
|
| 21 |
+
+++ b/tests/atest/rules/duplications/duplicated_variables_import/test_args.robot
|
| 22 |
+
@@ -0,0 +1,10 @@
|
| 23 |
+
+*** Settings ***
|
| 24 |
+
+Variables variables.robot arg
|
| 25 |
+
+Variables variables.robot arg
|
| 26 |
+
+Variables vars.yaml arg1
|
| 27 |
+
+Variables vars.yaml arg1
|
| 28 |
+
+
|
| 29 |
+
+
|
| 30 |
+
+*** Test Cases ***
|
| 31 |
+
+Test
|
| 32 |
+
+ Log message
|
| 33 |
+
diff --git a/tests/atest/rules/duplications/duplicated_variables_import/test_rule.py b/tests/atest/rules/duplications/duplicated_variables_import/test_rule.py
|
| 34 |
+
index 6f32193..72ee026 100644
|
| 35 |
+
--- a/tests/atest/rules/duplications/duplicated_variables_import/test_rule.py
|
| 36 |
+
+++ b/tests/atest/rules/duplications/duplicated_variables_import/test_rule.py
|
| 37 |
+
@@ -4,3 +4,6 @@ from tests.atest.utils import RuleAcceptance
|
| 38 |
+
class TestRuleAcceptance(RuleAcceptance):
|
| 39 |
+
def test_rule(self):
|
| 40 |
+
self.check_rule(src_files=["test.robot"], expected_file="expected_output.txt")
|
| 41 |
+
+
|
| 42 |
+
+ def test_duplicated_with_args(self):
|
| 43 |
+
+ self.check_rule(src_files=["test_args.robot"], expected_file="expected_output_args.txt")
|
| 44 |
+
diff --git a/tests/atest/rules/errors/variables_import_with_args/expected_output.txt b/tests/atest/rules/errors/variables_import_with_args/expected_output.txt
|
| 45 |
+
index ab260a4..a62e5a0 100644
|
| 46 |
+
--- a/tests/atest/rules/errors/variables_import_with_args/expected_output.txt
|
| 47 |
+
+++ b/tests/atest/rules/errors/variables_import_with_args/expected_output.txt
|
| 48 |
+
@@ -1,2 +1 @@
|
| 49 |
+
-test.robot:11:1 [E] 0404 Robot and YAML variable files do not take arguments
|
| 50 |
+
-test.robot:16:1 [E] 0404 Robot and YAML variable files do not take arguments
|
| 51 |
+
|
| 52 |
+
+test.robot:11:1 [E] 0404 YAML variable files do not take arguments
|
| 53 |
+
diff --git a/tests/atest/rules/errors/variables_import_with_args/expected_output_module.txt b/tests/atest/rules/errors/variables_import_with_args/expected_output_module.txt
|
| 54 |
+
new file mode 100644
|
| 55 |
+
index 0000000..6ac1dab
|
| 56 |
+
--- /dev/null
|
| 57 |
+
+++ b/tests/atest/rules/errors/variables_import_with_args/expected_output_module.txt
|
| 58 |
+
@@ -0,0 +1,2 @@
|
| 59 |
+
+test_module.robot:4:1 [E] 0404 YAML variable files do not take arguments
|
| 60 |
+
+test_module.robot:5:1 [E] 0404 YAML variable files do not take arguments
|
| 61 |
+
diff --git a/tests/atest/rules/errors/variables_import_with_args/test_module.robot b/tests/atest/rules/errors/variables_import_with_args/test_module.robot
|
| 62 |
+
new file mode 100644
|
| 63 |
+
index 0000000..240b7b8
|
| 64 |
+
--- /dev/null
|
| 65 |
+
+++ b/tests/atest/rules/errors/variables_import_with_args/test_module.robot
|
| 66 |
+
@@ -0,0 +1,18 @@
|
| 67 |
+
+*** Settings ***
|
| 68 |
+
+Variables variables ${ENVIRON}
|
| 69 |
+
+Variables other.py arg1
|
| 70 |
+
+Variables vars.yaml arg1
|
| 71 |
+
+Variables vars.yml arg2
|
| 72 |
+
+Variables vars.json arg3
|
| 73 |
+
+Variables variables.robot arg
|
| 74 |
+
+Variables no_args.yaml
|
| 75 |
+
+Variables no_args
|
| 76 |
+
+
|
| 77 |
+
+
|
| 78 |
+
+*** Variables ***
|
| 79 |
+
+${ENVIRON} dev
|
| 80 |
+
+
|
| 81 |
+
+
|
| 82 |
+
+*** Test Cases ***
|
| 83 |
+
+Test
|
| 84 |
+
+ Log message
|
| 85 |
+
diff --git a/tests/atest/rules/errors/variables_import_with_args/test_rule.py b/tests/atest/rules/errors/variables_import_with_args/test_rule.py
|
| 86 |
+
index 6f32193..cd26eec 100644
|
| 87 |
+
--- a/tests/atest/rules/errors/variables_import_with_args/test_rule.py
|
| 88 |
+
+++ b/tests/atest/rules/errors/variables_import_with_args/test_rule.py
|
| 89 |
+
@@ -4,3 +4,6 @@ from tests.atest.utils import RuleAcceptance
|
| 90 |
+
class TestRuleAcceptance(RuleAcceptance):
|
| 91 |
+
def test_rule(self):
|
| 92 |
+
self.check_rule(src_files=["test.robot"], expected_file="expected_output.txt")
|
| 93 |
+
+
|
| 94 |
+
+ def test_module_and_extensions(self):
|
| 95 |
+
+ self.check_rule(src_files=["test_module.robot"], expected_file="expected_output_module.txt")
|
| 96 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 97 |
+
new file mode 100755
|
| 98 |
+
--- /dev/null
|
| 99 |
+
+++ b/mimo_test_command.sh
|
| 100 |
+
@@ -0,0 +1,8 @@
|
| 101 |
+
+#!/usr/bin/env bash
|
| 102 |
+
+
|
| 103 |
+
+set -uo pipefail
|
| 104 |
+
+cd /testbed
|
| 105 |
+
+rc=0
|
| 106 |
+
+python -m pytest -rA tests/atest/rules/duplications/duplicated_variables_import/test_rule.py::TestRuleAcceptance::test_duplicated_with_args tests/atest/rules/errors/variables_import_with_args/test_rule.py::TestRuleAcceptance::test_module_and_extensions
|
| 107 |
+
+rc=$(( rc | $? ))
|
| 108 |
+
+exit $rc
|
tasks/format-code-task-000156/tests/test.sh
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test_commands.json
|
| 25 |
+
tests/atest/rules/duplications/duplicated_variables_import/expected_output_args.txt
|
| 26 |
+
tests/atest/rules/duplications/duplicated_variables_import/test_args.robot
|
| 27 |
+
tests/atest/rules/duplications/duplicated_variables_import/test_rule.py
|
| 28 |
+
tests/atest/rules/errors/variables_import_with_args/expected_output.txt
|
| 29 |
+
tests/atest/rules/errors/variables_import_with_args/expected_output_module.txt
|
| 30 |
+
tests/atest/rules/errors/variables_import_with_args/test_module.robot
|
| 31 |
+
tests/atest/rules/errors/variables_import_with_args/test_rule.py
|
| 32 |
+
mimo_test_command.sh
|
| 33 |
+
EOF_RESET_TEST_FILES
|
| 34 |
+
|
| 35 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 36 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 37 |
+
cat "$V/apply.log" >&2
|
| 38 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 39 |
+
exit 1
|
| 40 |
+
fi
|
| 41 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 42 |
+
RC=$?
|
| 43 |
+
tail -c 12000 "$V/test_output.log"
|
| 44 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 45 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000156/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000158/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b93f3a9056fc4647d911b2488423c78764f54f2209971d712c23e7546bc28880
|
tasks/format-code-task-000158/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000158/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000158/tests/test.patch
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 0000000..48178e4
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/test_commands.json
|
| 6 |
+
@@ -0,0 +1,3 @@
|
| 7 |
+
+{
|
| 8 |
+
+ "test_commands": ["python -m pytest tests/test_simplify.py -k sim117 -v"]
|
| 9 |
+
+}
|
| 10 |
+
diff --git a/tests/test_simplify.py b/tests/test_simplify.py
|
| 11 |
+
index 006c4b0..981016c 100644
|
| 12 |
+
--- a/tests/test_simplify.py
|
| 13 |
+
+++ b/tests/test_simplify.py
|
| 14 |
+
@@ -490,3 +490,87 @@ def test_sim300_int():
|
| 15 |
+
assert ret == {
|
| 16 |
+
"1:0 SIM300 Use 'age == 42' instead of '42 == age' (Yoda-conditions)"
|
| 17 |
+
}
|
| 18 |
+
+
|
| 19 |
+
+
|
| 20 |
+
+def test_sim117_basic():
|
| 21 |
+
+ ret = _results(
|
| 22 |
+
+ """with A() as a:
|
| 23 |
+
+ with B() as b:
|
| 24 |
+
+ print('hello')"""
|
| 25 |
+
+ )
|
| 26 |
+
+ assert ret == {
|
| 27 |
+
+ "1:0 SIM117 Use 'with A() as a, B() as b:' "
|
| 28 |
+
+ "instead of multiple with statements"
|
| 29 |
+
+ }
|
| 30 |
+
+
|
| 31 |
+
+
|
| 32 |
+
+def test_sim117_not_triggered_single_with():
|
| 33 |
+
+ ret = _results(
|
| 34 |
+
+ """with A() as a:
|
| 35 |
+
+ print('hello')"""
|
| 36 |
+
+ )
|
| 37 |
+
+ assert ret == set()
|
| 38 |
+
+
|
| 39 |
+
+
|
| 40 |
+
+def test_sim117_not_triggered_extra_code_after():
|
| 41 |
+
+ ret = _results(
|
| 42 |
+
+ """with A() as a:
|
| 43 |
+
+ with B() as b:
|
| 44 |
+
+ print('hello')
|
| 45 |
+
+ print('after')"""
|
| 46 |
+
+ )
|
| 47 |
+
+ assert ret == set()
|
| 48 |
+
+
|
| 49 |
+
+
|
| 50 |
+
+def test_sim117_not_triggered_extra_code_before():
|
| 51 |
+
+ ret = _results(
|
| 52 |
+
+ """with A() as a:
|
| 53 |
+
+ print('first')
|
| 54 |
+
+ with B() as b:
|
| 55 |
+
+ print('hello')"""
|
| 56 |
+
+ )
|
| 57 |
+
+ assert ret == set()
|
| 58 |
+
+
|
| 59 |
+
+
|
| 60 |
+
+def test_sim117_triple_nesting():
|
| 61 |
+
+ ret = _results(
|
| 62 |
+
+ """with A() as a:
|
| 63 |
+
+ with B() as b:
|
| 64 |
+
+ with C() as c:
|
| 65 |
+
+ print('hi')"""
|
| 66 |
+
+ )
|
| 67 |
+
+ assert ret == {
|
| 68 |
+
+ (
|
| 69 |
+
+ "1:0 SIM117 Use 'with A() as a, B() as b:' "
|
| 70 |
+
+ "instead of multiple with statements"
|
| 71 |
+
+ ),
|
| 72 |
+
+ (
|
| 73 |
+
+ "2:4 SIM117 Use 'with B() as b, C() as c:' "
|
| 74 |
+
+ "instead of multiple with statements"
|
| 75 |
+
+ ),
|
| 76 |
+
+ }
|
| 77 |
+
+
|
| 78 |
+
+
|
| 79 |
+
+def test_sim117_multi_items_inner():
|
| 80 |
+
+ ret = _results(
|
| 81 |
+
+ """with A() as a:
|
| 82 |
+
+ with B() as b, C() as c:
|
| 83 |
+
+ print('hi')"""
|
| 84 |
+
+ )
|
| 85 |
+
+ assert ret == {
|
| 86 |
+
+ "1:0 SIM117 Use 'with A() as a, B() as b, C() as c:' "
|
| 87 |
+
+ "instead of multiple with statements"
|
| 88 |
+
+ }
|
| 89 |
+
+
|
| 90 |
+
+
|
| 91 |
+
+def test_sim117_long_line_still_reports():
|
| 92 |
+
+ ret = _results(
|
| 93 |
+
+ """with SomeVeryLongContextManagerName() as long_alias_name_one:
|
| 94 |
+
+ with AnotherLongContextManagerName() as long_alias_name_two:
|
| 95 |
+
+ print('hi')"""
|
| 96 |
+
+ )
|
| 97 |
+
+ assert ret == {
|
| 98 |
+
+ "1:0 SIM117 Use 'with SomeVeryLongContextManagerName() "
|
| 99 |
+
+ "as long_alias_name_one, AnotherLongContextManagerName() "
|
| 100 |
+
+ "as long_alias_name_two:' instead of multiple with statements"
|
| 101 |
+
+ }
|
| 102 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 103 |
+
new file mode 100755
|
| 104 |
+
--- /dev/null
|
| 105 |
+
+++ b/mimo_test_command.sh
|
| 106 |
+
@@ -0,0 +1,8 @@
|
| 107 |
+
+#!/usr/bin/env bash
|
| 108 |
+
+
|
| 109 |
+
+set -uo pipefail
|
| 110 |
+
+cd /testbed
|
| 111 |
+
+rc=0
|
| 112 |
+
+python -m pytest -v -rA tests/test_simplify.py::test_sim117_basic tests/test_simplify.py::test_sim117_not_triggered_single_with tests/test_simplify.py::test_sim117_not_triggered_extra_code_after tests/test_simplify.py::test_sim117_not_triggered_extra_code_before tests/test_simplify.py::test_sim117_triple_nesting tests/test_simplify.py::test_sim117_multi_items_inner tests/test_simplify.py::test_sim117_long_line_still_reports
|
| 113 |
+
+rc=$(( rc | $? ))
|
| 114 |
+
+exit $rc
|
tasks/format-code-task-000158/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test_commands.json
|
| 25 |
+
tests/test_simplify.py
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000158/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000160/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fda2ea380bd2b2f7bc4a8877cc070cdf2ce83aee588536c58e614460360ec13d
|
tasks/format-code-task-000160/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000160/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000160/tests/test.patch
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 0000000..5f27839
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/test_commands.json
|
| 6 |
+
@@ -0,0 +1,3 @@
|
| 7 |
+
+{
|
| 8 |
+
+ "test_commands": ["python -m pytest tests/test_simplify.py -k sim901 -v"]
|
| 9 |
+
+}
|
| 10 |
+
diff --git a/tests/test_simplify.py b/tests/test_simplify.py
|
| 11 |
+
index b61bc7c..3308fca 100644
|
| 12 |
+
--- a/tests/test_simplify.py
|
| 13 |
+
+++ b/tests/test_simplify.py
|
| 14 |
+
@@ -878,3 +878,74 @@ else:
|
| 15 |
+
has_sim401 = True
|
| 16 |
+
assert msg == expected_proposal
|
| 17 |
+
assert has_sim401
|
| 18 |
+
+
|
| 19 |
+
+
|
| 20 |
+
+import re as _re_sim901
|
| 21 |
+
+
|
| 22 |
+
+_SIM901_BOOL_RE = _re_sim901.compile(
|
| 23 |
+
+ r"^(\d+):(\d+) SIM\d+ Use '(?P<inner>.+)' instead of 'bool\((?P=inner)\)'$"
|
| 24 |
+
+)
|
| 25 |
+
+
|
| 26 |
+
+
|
| 27 |
+
+def _sim901_bool_warnings(ret):
|
| 28 |
+
+ """Return [(line, col, inner)] for any 'Use X instead of bool(X)' warning,
|
| 29 |
+
+ independent of the specific SIMxxx rule code chosen by the implementation.
|
| 30 |
+
+ The issue does not pin down a code, so any unique SIM code is acceptable.
|
| 31 |
+
+ """
|
| 32 |
+
+ out = []
|
| 33 |
+
+ for msg in ret:
|
| 34 |
+
+ m = _SIM901_BOOL_RE.match(msg)
|
| 35 |
+
+ if m:
|
| 36 |
+
+ out.append((int(m.group(1)), int(m.group(2)), m.group("inner")))
|
| 37 |
+
+ return out
|
| 38 |
+
+
|
| 39 |
+
+
|
| 40 |
+
+def test_sim901_bool_eq():
|
| 41 |
+
+ """Issue example: bool(a == b) should report a 'use comparison directly' warning."""
|
| 42 |
+
+ ret = _results("bool(a == b)")
|
| 43 |
+
+ assert _sim901_bool_warnings(ret) == [(1, 0, "a == b")]
|
| 44 |
+
+
|
| 45 |
+
+
|
| 46 |
+
+def test_sim901_bool_lt():
|
| 47 |
+
+ ret = _results("bool(a < b)")
|
| 48 |
+
+ assert _sim901_bool_warnings(ret) == [(1, 0, "a < b")]
|
| 49 |
+
+
|
| 50 |
+
+
|
| 51 |
+
+def test_sim901_bool_ne():
|
| 52 |
+
+ ret = _results("bool(a != b)")
|
| 53 |
+
+ assert _sim901_bool_warnings(ret) == [(1, 0, "a != b")]
|
| 54 |
+
+
|
| 55 |
+
+
|
| 56 |
+
+def test_sim901_bool_in():
|
| 57 |
+
+ ret = _results("bool(a in b)")
|
| 58 |
+
+ assert _sim901_bool_warnings(ret) == [(1, 0, "a in b")]
|
| 59 |
+
+
|
| 60 |
+
+
|
| 61 |
+
+def test_sim901_no_trigger_on_plain_compare():
|
| 62 |
+
+ """A bare comparison (no bool wrap) must not trigger any bool() warning."""
|
| 63 |
+
+ ret = _results("a == b")
|
| 64 |
+
+ assert _sim901_bool_warnings(ret) == []
|
| 65 |
+
+
|
| 66 |
+
+
|
| 67 |
+
+def test_sim901_no_trigger_on_bool_of_name():
|
| 68 |
+
+ """bool(x) where x isn't a comparison must not trigger."""
|
| 69 |
+
+ ret = _results("bool(x)")
|
| 70 |
+
+ assert _sim901_bool_warnings(ret) == []
|
| 71 |
+
+
|
| 72 |
+
+
|
| 73 |
+
+def test_sim901_no_trigger_on_bool_of_call():
|
| 74 |
+
+ """bool(some_call()) must not trigger."""
|
| 75 |
+
+ ret = _results("bool(foo())")
|
| 76 |
+
+ assert _sim901_bool_warnings(ret) == []
|
| 77 |
+
+
|
| 78 |
+
+
|
| 79 |
+
+def test_sim901_no_trigger_on_bool_of_not():
|
| 80 |
+
+ """bool(not x) must not trigger - issue scope is 'bool(comparison)' only."""
|
| 81 |
+
+ ret = _results("bool(not x)")
|
| 82 |
+
+ assert _sim901_bool_warnings(ret) == []
|
| 83 |
+
+
|
| 84 |
+
+
|
| 85 |
+
+def test_sim901_no_trigger_on_nested_bool():
|
| 86 |
+
+ """bool(bool(x)) must not trigger - issue scope is 'bool(comparison)' only."""
|
| 87 |
+
+ ret = _results("bool(bool(x))")
|
| 88 |
+
+ assert _sim901_bool_warnings(ret) == []
|
| 89 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 90 |
+
new file mode 100755
|
| 91 |
+
--- /dev/null
|
| 92 |
+
+++ b/mimo_test_command.sh
|
| 93 |
+
@@ -0,0 +1,8 @@
|
| 94 |
+
+#!/usr/bin/env bash
|
| 95 |
+
+
|
| 96 |
+
+set -uo pipefail
|
| 97 |
+
+cd /testbed
|
| 98 |
+
+rc=0
|
| 99 |
+
+python -m pytest -v -rA tests/test_simplify.py::test_sim901_bool_eq tests/test_simplify.py::test_sim901_bool_lt tests/test_simplify.py::test_sim901_bool_ne tests/test_simplify.py::test_sim901_bool_in tests/test_simplify.py::test_sim901_no_trigger_on_plain_compare tests/test_simplify.py::test_sim901_no_trigger_on_bool_of_name tests/test_simplify.py::test_sim901_no_trigger_on_bool_of_call tests/test_simplify.py::test_sim901_no_trigger_on_bool_of_not tests/test_simplify.py::test_sim901_no_trigger_on_nested_bool
|
| 100 |
+
+rc=$(( rc | $? ))
|
| 101 |
+
+exit $rc
|
tasks/format-code-task-000160/tests/test.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test_commands.json
|
| 25 |
+
tests/test_simplify.py
|
| 26 |
+
mimo_test_command.sh
|
| 27 |
+
EOF_RESET_TEST_FILES
|
| 28 |
+
|
| 29 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 30 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 31 |
+
cat "$V/apply.log" >&2
|
| 32 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 33 |
+
exit 1
|
| 34 |
+
fi
|
| 35 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 36 |
+
RC=$?
|
| 37 |
+
tail -c 12000 "$V/test_output.log"
|
| 38 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 39 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000160/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000167/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d466ad2b4e56ed8cdb07817c6185c8ebdfa949d4faeb96b0605a6996fc125de6
|
tasks/format-code-task-000167/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000167/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000167/tests/test.patch
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/components/modal/modal.spec.ts b/components/modal/modal.spec.ts
|
| 2 |
+
index e8ffe1779..7d25f4abe 100644
|
| 3 |
+
--- a/components/modal/modal.spec.ts
|
| 4 |
+
+++ b/components/modal/modal.spec.ts
|
| 5 |
+
@@ -552,8 +552,14 @@ describe('NzModal', () => {
|
| 6 |
+
fixture.detectChanges();
|
| 7 |
+
|
| 8 |
+
const modal = overlayContainerElement.querySelector('nz-modal-container') as HTMLElement;
|
| 9 |
+
+ const mask = overlayContainerElement.querySelector('.ant-modal-mask') as HTMLElement;
|
| 10 |
+
+ const readZIndex = (element: HTMLElement): string => {
|
| 11 |
+
+ const computed = getComputedStyle(element).zIndex;
|
| 12 |
+
+ return computed === 'auto' ? element.style.zIndex : computed;
|
| 13 |
+
+ };
|
| 14 |
+
|
| 15 |
+
- expect(modal.style.zIndex).toBe('1001');
|
| 16 |
+
+ expect(readZIndex(modal)).toBe('1001');
|
| 17 |
+
+ expect(readZIndex(mask)).toBe('1001');
|
| 18 |
+
|
| 19 |
+
modalRef.updateConfig({
|
| 20 |
+
nzZIndex: 1100
|
| 21 |
+
@@ -561,7 +567,79 @@ describe('NzModal', () => {
|
| 22 |
+
fixture.detectChanges();
|
| 23 |
+
flushMicrotasks();
|
| 24 |
+
|
| 25 |
+
- expect(modal.style.zIndex).toBe('1100');
|
| 26 |
+
+ expect(readZIndex(modal)).toBe('1100');
|
| 27 |
+
+ expect(readZIndex(mask)).toBe('1100');
|
| 28 |
+
+
|
| 29 |
+
+ modalRef.close();
|
| 30 |
+
+ fixture.detectChanges();
|
| 31 |
+
+ flush();
|
| 32 |
+
+ }));
|
| 33 |
+
+
|
| 34 |
+
+ it('should apply z-index to the corresponding mask in stacked modals', fakeAsync(() => {
|
| 35 |
+
+ const firstModalRef = modalService.create({
|
| 36 |
+
+ nzContent: 'first modal',
|
| 37 |
+
+ nzZIndex: 1001
|
| 38 |
+
+ });
|
| 39 |
+
+ fixture.detectChanges();
|
| 40 |
+
+ flushMicrotasks();
|
| 41 |
+
+
|
| 42 |
+
+ const secondModalRef = modalService.create({
|
| 43 |
+
+ nzContent: 'second modal',
|
| 44 |
+
+ nzZIndex: 1307
|
| 45 |
+
+ });
|
| 46 |
+
+ fixture.detectChanges();
|
| 47 |
+
+ flushMicrotasks();
|
| 48 |
+
+
|
| 49 |
+
+ const modals = Array.from(overlayContainerElement.querySelectorAll('nz-modal-container')) as HTMLElement[];
|
| 50 |
+
+ const masks = Array.from(overlayContainerElement.querySelectorAll('.ant-modal-mask')) as HTMLElement[];
|
| 51 |
+
+ const readZIndex = (element: HTMLElement): string => {
|
| 52 |
+
+ const computed = getComputedStyle(element).zIndex;
|
| 53 |
+
+ return computed === 'auto' ? element.style.zIndex : computed;
|
| 54 |
+
+ };
|
| 55 |
+
+
|
| 56 |
+
+ expect(modals.length).toBe(2);
|
| 57 |
+
+ expect(masks.length).toBe(2);
|
| 58 |
+
+ expect(readZIndex(modals[0])).toBe('1001');
|
| 59 |
+
+ expect(readZIndex(masks[0])).toBe('1001');
|
| 60 |
+
+ expect(readZIndex(modals[1])).toBe('1307');
|
| 61 |
+
+ expect(readZIndex(masks[1])).toBe('1307');
|
| 62 |
+
+ expect(Number(readZIndex(masks[1]))).toBeGreaterThan(Number(readZIndex(modals[0])));
|
| 63 |
+
+
|
| 64 |
+
+ firstModalRef.close();
|
| 65 |
+
+ secondModalRef.close();
|
| 66 |
+
+ fixture.detectChanges();
|
| 67 |
+
+ flush();
|
| 68 |
+
+ }));
|
| 69 |
+
+
|
| 70 |
+
+ it('should keep mask z-index when nzMaskStyle is applied or updated', fakeAsync(() => {
|
| 71 |
+
+ const modalRef = modalService.create({
|
| 72 |
+
+ nzContent: 'modal with mask style',
|
| 73 |
+
+ nzZIndex: 1200,
|
| 74 |
+
+ nzMaskStyle: {
|
| 75 |
+
+ backgroundColor: 'rgba(0, 0, 0, 0.2)'
|
| 76 |
+
+ }
|
| 77 |
+
+ });
|
| 78 |
+
+ fixture.detectChanges();
|
| 79 |
+
+ flushMicrotasks();
|
| 80 |
+
+
|
| 81 |
+
+ const mask = overlayContainerElement.querySelector('.ant-modal-mask') as HTMLElement;
|
| 82 |
+
+ const readZIndex = (element: HTMLElement): string => {
|
| 83 |
+
+ const computed = getComputedStyle(element).zIndex;
|
| 84 |
+
+ return computed === 'auto' ? element.style.zIndex : computed;
|
| 85 |
+
+ };
|
| 86 |
+
+
|
| 87 |
+
+ expect(readZIndex(mask)).toBe('1200');
|
| 88 |
+
+
|
| 89 |
+
+ modalRef.updateConfig({
|
| 90 |
+
+ nzMaskStyle: {
|
| 91 |
+
+ backgroundColor: 'rgba(0, 0, 0, 0.3)'
|
| 92 |
+
+ }
|
| 93 |
+
+ });
|
| 94 |
+
+ fixture.detectChanges();
|
| 95 |
+
+ flushMicrotasks();
|
| 96 |
+
+
|
| 97 |
+
+ expect(getComputedStyle(mask).backgroundColor).toBe('rgba(0, 0, 0, 0.3)');
|
| 98 |
+
+ expect(readZIndex(mask)).toBe('1200');
|
| 99 |
+
|
| 100 |
+
modalRef.close();
|
| 101 |
+
fixture.detectChanges();
|
| 102 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 103 |
+
new file mode 100755
|
| 104 |
+
--- /dev/null
|
| 105 |
+
+++ b/mimo_test_command.sh
|
| 106 |
+
@@ -0,0 +1,42 @@
|
| 107 |
+
+#!/bin/bash
|
| 108 |
+
+set -uo pipefail
|
| 109 |
+
+cd /testbed
|
| 110 |
+
+
|
| 111 |
+
+
|
| 112 |
+
+
|
| 113 |
+
+dev-switch node 20
|
| 114 |
+
+
|
| 115 |
+
+
|
| 116 |
+
+apt-get install -y -qq libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 \
|
| 117 |
+
+ libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 \
|
| 118 |
+
+ libasound2t64 libnspr4 libnss3 libxshmfence1 libxfixes3 libgtk-3-0 2>/dev/null || true
|
| 119 |
+
+
|
| 120 |
+
+
|
| 121 |
+
+npm install --legacy-peer-deps 2>&1 | tail -5
|
| 122 |
+
+
|
| 123 |
+
+
|
| 124 |
+
+sed -i 's/statements.push.apply(statements, tslib_1.__spread(c.statements));/if (c.statements) { statements.push.apply(statements, tslib_1.__spread(c.statements)); }/' \
|
| 125 |
+
+ node_modules/@angular/compiler-cli/ngcc/src/rendering/renderer.js
|
| 126 |
+
+
|
| 127 |
+
+
|
| 128 |
+
+npm install tslib@2.0.3 --legacy-peer-deps 2>&1 | tail -3
|
| 129 |
+
+
|
| 130 |
+
+
|
| 131 |
+
+rm -rf node_modules/.cache
|
| 132 |
+
+npx ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points 2>&1 | tail -5
|
| 133 |
+
+
|
| 134 |
+
+export NODE_OPTIONS=--openssl-legacy-provider
|
| 135 |
+
+
|
| 136 |
+
+
|
| 137 |
+
+case "${1:-}" in
|
| 138 |
+
+ base)
|
| 139 |
+
+ node node_modules/.bin/ng test --no-watch --no-progress --browsers=ChromeHeadlessCI --include='**/modal.spec.ts'
|
| 140 |
+
+ ;;
|
| 141 |
+
+ new)
|
| 142 |
+
+ node node_modules/.bin/ng test --no-watch --no-progress --browsers=ChromeHeadlessCI --include='**/modal.spec.ts'
|
| 143 |
+
+ ;;
|
| 144 |
+
+ *)
|
| 145 |
+
+ echo "usage: $0 base|new"
|
| 146 |
+
+ exit 2
|
| 147 |
+
+ ;;
|
| 148 |
+
+esac
|
tasks/format-code-task-000167/tests/test.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
components/modal/modal.spec.ts
|
| 25 |
+
mimo_test_command.sh
|
| 26 |
+
EOF_RESET_TEST_FILES
|
| 27 |
+
|
| 28 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 29 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 30 |
+
cat "$V/apply.log" >&2
|
| 31 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 35 |
+
RC=$?
|
| 36 |
+
tail -c 12000 "$V/test_output.log"
|
| 37 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 38 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000167/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
|
tasks/format-code-task-000169/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:8f560c1b3bc6df40649ee985b85d04675f778f29cccfafe9ed725b16ab06c600
|
tasks/format-code-task-000169/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|
tasks/format-code-task-000169/environment/setup/setup.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
|
| 3 |
+
# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
[ -f "$M/ready" ] && exit 0
|
| 6 |
+
chmod 700 "$M"
|
| 7 |
+
fail() { echo "setup: $*" >&2; exit 1; }
|
| 8 |
+
# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
|
| 9 |
+
write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
|
| 10 |
+
|
| 11 |
+
# Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
|
| 12 |
+
CWD=/testbed
|
| 13 |
+
git config --global --add safe.directory "$CWD"
|
| 14 |
+
cd "$CWD" || fail "no working directory $CWD"
|
| 15 |
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
|
| 16 |
+
git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
|
| 17 |
+
fi
|
| 18 |
+
BASE=$(git rev-parse HEAD 2>/dev/null)
|
| 19 |
+
[ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
|
| 20 |
+
echo "$BASE" > "$M/base"
|
| 21 |
+
# Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
|
| 22 |
+
# so .git is hidden while the agent works and put back for grading.
|
| 23 |
+
LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
|
| 24 |
+
rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
|
| 25 |
+
git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
|
| 26 |
+
find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
|
| 27 |
+
if [ "$LATER" -gt 0 ]; then
|
| 28 |
+
mv "$CWD/.git" "$M/git-hidden"
|
| 29 |
+
echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
|
| 30 |
+
fi
|
| 31 |
+
write_blocklist
|
| 32 |
+
|
| 33 |
+
touch "$M/ready"
|
| 34 |
+
echo "setup done"
|
tasks/format-code-task-000169/tests/test.patch
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test/test_recipe.py b/test/test_recipe.py
|
| 2 |
+
index e28808c..dd0ed67 100644
|
| 3 |
+
--- a/test/test_recipe.py
|
| 4 |
+
+++ b/test/test_recipe.py
|
| 5 |
+
@@ -21,8 +21,12 @@ from __future__ import print_function
|
| 6 |
+
|
| 7 |
+
import logging # pylint: disable=unused-import
|
| 8 |
+
import os
|
| 9 |
+
+import shutil
|
| 10 |
+
+import tempfile
|
| 11 |
+
+import uuid
|
| 12 |
+
import unittest
|
| 13 |
+
|
| 14 |
+
+import hpccm
|
| 15 |
+
from hpccm.common import container_type
|
| 16 |
+
from hpccm.recipe import recipe
|
| 17 |
+
|
| 18 |
+
@@ -253,3 +257,181 @@ RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://
|
| 19 |
+
rm -rf /var/tmp/openmpi-2.1.2.tar.bz2 /var/tmp/openmpi-2.1.2
|
| 20 |
+
ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:$LD_LIBRARY_PATH \
|
| 21 |
+
PATH=/usr/local/openmpi/bin:$PATH''')
|
| 22 |
+
+
|
| 23 |
+
+
|
| 24 |
+
+ def _write_recipe(self, directory, filename, contents):
|
| 25 |
+
+ """Create a temporary recipe fixture and return its path."""
|
| 26 |
+
+ path = os.path.join(directory, filename)
|
| 27 |
+
+ parent = os.path.dirname(path)
|
| 28 |
+
+ if not os.path.isdir(parent):
|
| 29 |
+
+ os.makedirs(parent)
|
| 30 |
+
+ with open(path, 'w') as f:
|
| 31 |
+
+ f.write(contents)
|
| 32 |
+
+ return path
|
| 33 |
+
+
|
| 34 |
+
+ def test_include_stage0_and_shared_values(self):
|
| 35 |
+
+ """included recipes contribute Stage0 state and shared values"""
|
| 36 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 37 |
+
+ try:
|
| 38 |
+
+ fragment_name = 'shared-{}.py'.format(uuid.uuid4().hex)
|
| 39 |
+
+ image = 'stage0-image-{}:latest'.format(uuid.uuid4().hex)
|
| 40 |
+
+ package = 'stage0-package-{}'.format(uuid.uuid4().hex)
|
| 41 |
+
+ self._write_recipe(tmpdir, fragment_name,
|
| 42 |
+
+ "Stage0 += baseimage(image={!r})\n"
|
| 43 |
+
+ "extra_package = {!r}\n".format(image, package))
|
| 44 |
+
+ main = self._write_recipe(
|
| 45 |
+
+ tmpdir, 'main.py',
|
| 46 |
+
+ "hpccm.include({!r})\n"
|
| 47 |
+
+ "Stage0 += packages(ospackages=[extra_package])\n".format(
|
| 48 |
+
+ fragment_name))
|
| 49 |
+
+
|
| 50 |
+
+ result = recipe(main)
|
| 51 |
+
+
|
| 52 |
+
+ self.assertIn('FROM {}'.format(image), result)
|
| 53 |
+
+ self.assertIn(package, result)
|
| 54 |
+
+ finally:
|
| 55 |
+
+ shutil.rmtree(tmpdir)
|
| 56 |
+
+
|
| 57 |
+
+ def test_include_arbitrary_sibling_recipe_name(self):
|
| 58 |
+
+ """include works for ordinary sibling recipe names"""
|
| 59 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 60 |
+
+ try:
|
| 61 |
+
+ fragment_name = 'common-build-{}.py'.format(uuid.uuid4().hex)
|
| 62 |
+
+ image = 'sibling-image-{}:latest'.format(uuid.uuid4().hex)
|
| 63 |
+
+ package = 'sibling-package-{}'.format(uuid.uuid4().hex)
|
| 64 |
+
+ self._write_recipe(tmpdir, fragment_name,
|
| 65 |
+
+ "Stage0 += baseimage(image={!r})\n"
|
| 66 |
+
+ "custom_package = {!r}\n".format(
|
| 67 |
+
+ image, package))
|
| 68 |
+
+ main = self._write_recipe(
|
| 69 |
+
+ tmpdir, 'main.py',
|
| 70 |
+
+ "hpccm.include({!r})\n"
|
| 71 |
+
+ "Stage0 += packages(ospackages=[custom_package])\n".format(
|
| 72 |
+
+ fragment_name))
|
| 73 |
+
+
|
| 74 |
+
+ result = recipe(main)
|
| 75 |
+
+
|
| 76 |
+
+ self.assertIn('FROM {}'.format(image), result)
|
| 77 |
+
+ self.assertIn(package, result)
|
| 78 |
+
+ finally:
|
| 79 |
+
+ shutil.rmtree(tmpdir)
|
| 80 |
+
+
|
| 81 |
+
+ def test_include_stage1_singularity_output(self):
|
| 82 |
+
+ """included recipes contribute Stage1 content for Singularity"""
|
| 83 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 84 |
+
+ try:
|
| 85 |
+
+ fragment_name = 'stage1-{}.py'.format(uuid.uuid4().hex)
|
| 86 |
+
+ image = 'stage1-image-{}:latest'.format(uuid.uuid4().hex)
|
| 87 |
+
+ package = 'stage1-package-{}'.format(uuid.uuid4().hex)
|
| 88 |
+
+ self._write_recipe(tmpdir, fragment_name,
|
| 89 |
+
+ "Stage1 += baseimage(image={!r})\n".format(
|
| 90 |
+
+ image))
|
| 91 |
+
+ main = self._write_recipe(
|
| 92 |
+
+ tmpdir, 'main.py',
|
| 93 |
+
+ "hpccm.include({!r})\n"
|
| 94 |
+
+ "Stage1 += packages(ospackages=[{!r}])\n".format(
|
| 95 |
+
+ fragment_name, package))
|
| 96 |
+
+
|
| 97 |
+
+ result = recipe(main, ctype=container_type.SINGULARITY,
|
| 98 |
+
+ singularity_version='3.2')
|
| 99 |
+
+
|
| 100 |
+
+ self.assertIn('From: {}'.format(image), result)
|
| 101 |
+
+ self.assertIn(package, result)
|
| 102 |
+
+ finally:
|
| 103 |
+
+ shutil.rmtree(tmpdir)
|
| 104 |
+
+
|
| 105 |
+
+ def test_include_relative_to_main_recipe_from_different_cwd(self):
|
| 106 |
+
+ """relative includes are resolved from the recipe file location"""
|
| 107 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 108 |
+
+ old_cwd = os.getcwd()
|
| 109 |
+
+ try:
|
| 110 |
+
+ recipe_dir = os.path.join(tmpdir, 'recipes')
|
| 111 |
+
+ other_cwd = os.path.join(tmpdir, 'elsewhere')
|
| 112 |
+
+ os.makedirs(other_cwd)
|
| 113 |
+
+ fragment_name = os.path.join(
|
| 114 |
+
+ 'fragments', 'toolchain-{}.py'.format(uuid.uuid4().hex))
|
| 115 |
+
+ image = 'relative-image-{}:latest'.format(uuid.uuid4().hex)
|
| 116 |
+
+ package = 'relative-package-{}'.format(uuid.uuid4().hex)
|
| 117 |
+
+ self._write_recipe(
|
| 118 |
+
+ recipe_dir, fragment_name,
|
| 119 |
+
+ "Stage0 += baseimage(image={!r})\n".format(image))
|
| 120 |
+
+ main = self._write_recipe(
|
| 121 |
+
+ recipe_dir, 'main.py',
|
| 122 |
+
+ "hpccm.include({!r})\n"
|
| 123 |
+
+ "Stage0 += packages(ospackages=[{!r}])\n".format(
|
| 124 |
+
+ fragment_name, package))
|
| 125 |
+
+
|
| 126 |
+
+ os.chdir(other_cwd)
|
| 127 |
+
+ result = recipe(main)
|
| 128 |
+
+
|
| 129 |
+
+ self.assertIn('FROM {}'.format(image), result)
|
| 130 |
+
+ self.assertIn(package, result)
|
| 131 |
+
+ finally:
|
| 132 |
+
+ os.chdir(old_cwd)
|
| 133 |
+
+ shutil.rmtree(tmpdir)
|
| 134 |
+
+
|
| 135 |
+
+ def test_include_absolute_path(self):
|
| 136 |
+
+ """absolute include paths are used as absolute paths"""
|
| 137 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 138 |
+
+ try:
|
| 139 |
+
+ image = 'absolute-image-{}:latest'.format(uuid.uuid4().hex)
|
| 140 |
+
+ package = 'absolute-package-{}'.format(uuid.uuid4().hex)
|
| 141 |
+
+ fragment = self._write_recipe(
|
| 142 |
+
+ tmpdir, 'absolute-{}.py'.format(uuid.uuid4().hex),
|
| 143 |
+
+ "Stage0 += baseimage(image={!r})\n".format(image))
|
| 144 |
+
+ main_dir = os.path.join(tmpdir, 'main-recipe')
|
| 145 |
+
+ main = self._write_recipe(
|
| 146 |
+
+ main_dir, 'main.py',
|
| 147 |
+
+ "hpccm.include({!r})\n"
|
| 148 |
+
+ "Stage0 += packages(ospackages=[{!r}])\n".format(
|
| 149 |
+
+ fragment, package))
|
| 150 |
+
+
|
| 151 |
+
+ result = recipe(main)
|
| 152 |
+
+
|
| 153 |
+
+ self.assertIn('FROM {}'.format(image), result)
|
| 154 |
+
+ self.assertIn(package, result)
|
| 155 |
+
+ finally:
|
| 156 |
+
+ shutil.rmtree(tmpdir)
|
| 157 |
+
+
|
| 158 |
+
+ def test_include_missing_default_exits(self):
|
| 159 |
+
+ """missing includes exit by default"""
|
| 160 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 161 |
+
+ try:
|
| 162 |
+
+ missing = os.path.join(
|
| 163 |
+
+ tmpdir, 'missing-{}.py'.format(uuid.uuid4().hex))
|
| 164 |
+
+ with self.assertRaises(SystemExit) as context:
|
| 165 |
+
+ hpccm.include(missing)
|
| 166 |
+
+ self.assertEqual(context.exception.code, 1)
|
| 167 |
+
+ finally:
|
| 168 |
+
+ shutil.rmtree(tmpdir)
|
| 169 |
+
+
|
| 170 |
+
+ def test_include_raise_exceptions_propagates(self):
|
| 171 |
+
+ """raise_exceptions=True propagates included recipe errors"""
|
| 172 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 173 |
+
+ try:
|
| 174 |
+
+ error_name = 'IncludeRaised{}'.format(uuid.uuid4().hex)
|
| 175 |
+
+ bad = self._write_recipe(
|
| 176 |
+
+ tmpdir, 'bad-{}.py'.format(uuid.uuid4().hex),
|
| 177 |
+
+ "class {0}(Exception):\n"
|
| 178 |
+
+ " pass\n"
|
| 179 |
+
+ "raise {0}\n".format(error_name))
|
| 180 |
+
+
|
| 181 |
+
+ with self.assertRaises(Exception) as context:
|
| 182 |
+
+ hpccm.include(bad, raise_exceptions=True)
|
| 183 |
+
+ self.assertEqual(type(context.exception).__name__, error_name)
|
| 184 |
+
+ finally:
|
| 185 |
+
+ shutil.rmtree(tmpdir)
|
| 186 |
+
+
|
| 187 |
+
+ def test_include_runtime_error_default_exits(self):
|
| 188 |
+
+ """runtime errors in included recipes exit by default"""
|
| 189 |
+
+ tmpdir = tempfile.mkdtemp()
|
| 190 |
+
+ try:
|
| 191 |
+
+ bad = self._write_recipe(
|
| 192 |
+
+ tmpdir, 'runtime-{}.py'.format(uuid.uuid4().hex),
|
| 193 |
+
+ "raise RuntimeError()\n")
|
| 194 |
+
+
|
| 195 |
+
+ with self.assertRaises(SystemExit) as context:
|
| 196 |
+
+ hpccm.include(bad)
|
| 197 |
+
+ self.assertEqual(context.exception.code, 1)
|
| 198 |
+
+ finally:
|
| 199 |
+
+ shutil.rmtree(tmpdir)
|
| 200 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 201 |
+
new file mode 100755
|
| 202 |
+
--- /dev/null
|
| 203 |
+
+++ b/mimo_test_command.sh
|
| 204 |
+
@@ -0,0 +1,23 @@
|
| 205 |
+
+#!/bin/bash
|
| 206 |
+
+set -uo pipefail
|
| 207 |
+
+cd /testbed
|
| 208 |
+
+
|
| 209 |
+
+
|
| 210 |
+
+dev-switch python3 3.11
|
| 211 |
+
+python3 -m pip install -e . --no-input
|
| 212 |
+
+
|
| 213 |
+
+
|
| 214 |
+
+case "${1:-}" in
|
| 215 |
+
+ base)
|
| 216 |
+
+ python3 -m pytest test/test_recipe.py -v \
|
| 217 |
+
+ -k 'not test_include_stage0_and_shared_values and not test_include_arbitrary_sibling_recipe_name and not test_include_stage1_singularity_output and not test_include_relative_to_main_recipe_from_different_cwd and not test_include_absolute_path and not test_include_missing_default_exits and not test_include_raise_exceptions_propagates and not test_include_runtime_error_default_exits'
|
| 218 |
+
+ ;;
|
| 219 |
+
+ new)
|
| 220 |
+
+ python3 -m pytest test/test_recipe.py -v \
|
| 221 |
+
+ -k 'test_include_stage0_and_shared_values or test_include_arbitrary_sibling_recipe_name or test_include_stage1_singularity_output or test_include_relative_to_main_recipe_from_different_cwd or test_include_absolute_path or test_include_missing_default_exits or test_include_raise_exceptions_propagates or test_include_runtime_error_default_exits'
|
| 222 |
+
+ ;;
|
| 223 |
+
+ *)
|
| 224 |
+
+ echo "usage: $0 base|new"
|
| 225 |
+
+ exit 2
|
| 226 |
+
+ ;;
|
| 227 |
+
+esac
|
tasks/format-code-task-000169/tests/test.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
|
| 3 |
+
# task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
|
| 4 |
+
M=/var/lib/mimo
|
| 5 |
+
CWD=/testbed
|
| 6 |
+
V=/logs/verifier
|
| 7 |
+
mkdir -p "$V"
|
| 8 |
+
BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
|
| 9 |
+
cd "$CWD" || exit 1
|
| 10 |
+
if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
|
| 11 |
+
# the agent's change against the base, so its own commits count too
|
| 12 |
+
git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
|
| 13 |
+
git reset -q
|
| 14 |
+
if ! (
|
| 15 |
+
while IFS= read -r tf; do
|
| 16 |
+
[ -z "$tf" ] && continue
|
| 17 |
+
if git cat-file -e $BASE:"$tf" 2>/dev/null; then
|
| 18 |
+
git checkout $BASE -- "$tf" 2>/dev/null || true
|
| 19 |
+
else
|
| 20 |
+
git rm -f --cached "$tf" >/dev/null 2>&1 || true
|
| 21 |
+
rm -f "$tf"
|
| 22 |
+
fi
|
| 23 |
+
done <<'EOF_RESET_TEST_FILES'
|
| 24 |
+
test/test_recipe.py
|
| 25 |
+
mimo_test_command.sh
|
| 26 |
+
EOF_RESET_TEST_FILES
|
| 27 |
+
|
| 28 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 29 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 30 |
+
cat "$V/apply.log" >&2
|
| 31 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 35 |
+
RC=$?
|
| 36 |
+
tail -c 12000 "$V/test_output.log"
|
| 37 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 38 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000169/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
|
tasks/format-code-task-000193/environment/Dockerfile
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The task's image, pinned by digest (the same as [environment].docker_image).
|
| 2 |
+
# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
|
| 3 |
+
FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:617c2e22bfbf34176a2903b7906302840e40d37630ef5be5c3d1e80bbc1c0f4c
|
tasks/format-code-task-000193/environment/setup/files/blocklist
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mimo answer-leak blocklist (mimoagent)
|
| 2 |
+
0.0.0.0 github.com
|
| 3 |
+
0.0.0.0 www.github.com
|
| 4 |
+
0.0.0.0 api.github.com
|
| 5 |
+
0.0.0.0 raw.githubusercontent.com
|
| 6 |
+
0.0.0.0 codeload.github.com
|
| 7 |
+
0.0.0.0 objects.githubusercontent.com
|
| 8 |
+
0.0.0.0 gist.github.com
|
| 9 |
+
0.0.0.0 gist.githubusercontent.com
|
| 10 |
+
0.0.0.0 gitlab.com
|
| 11 |
+
0.0.0.0 bitbucket.org
|
| 12 |
+
0.0.0.0 sourceforge.net
|
| 13 |
+
0.0.0.0 git.kernel.org
|
| 14 |
+
0.0.0.0 chromium.googlesource.com
|
| 15 |
+
0.0.0.0 android.googlesource.com
|
| 16 |
+
0.0.0.0 sourcegraph.com
|
| 17 |
+
0.0.0.0 bugs.chromium.org
|
| 18 |
+
0.0.0.0 issues.oss-fuzz.com
|
| 19 |
+
0.0.0.0 oss-fuzz.com
|
| 20 |
+
0.0.0.0 osv.dev
|
| 21 |
+
0.0.0.0 api.osv.dev
|
| 22 |
+
0.0.0.0 bugzilla.mozilla.org
|
| 23 |
+
0.0.0.0 proxy.golang.org
|
| 24 |
+
0.0.0.0 sum.golang.org
|
| 25 |
+
0.0.0.0 pkg.go.dev
|
| 26 |
+
0.0.0.0 google.com
|
| 27 |
+
0.0.0.0 www.google.com
|
| 28 |
+
0.0.0.0 bing.com
|
| 29 |
+
0.0.0.0 www.bing.com
|
| 30 |
+
0.0.0.0 duckduckgo.com
|
| 31 |
+
0.0.0.0 html.duckduckgo.com
|
| 32 |
+
0.0.0.0 search.brave.com
|
| 33 |
+
0.0.0.0 stackoverflow.com
|