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-000043/environment/Dockerfile +3 -0
- tasks/format-code-task-000043/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000043/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000043/tests/test.patch +217 -0
- tasks/format-code-task-000043/tests/test.sh +38 -0
- tasks/format-code-task-000043/tests/test_command.sh +1 -0
- tasks/format-code-task-000044/environment/Dockerfile +3 -0
- tasks/format-code-task-000044/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000044/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000044/tests/test.patch +226 -0
- tasks/format-code-task-000044/tests/test.sh +39 -0
- tasks/format-code-task-000044/tests/test_command.sh +1 -0
- tasks/format-code-task-000088/environment/Dockerfile +3 -0
- tasks/format-code-task-000088/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000088/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000088/tests/test.patch +123 -0
- tasks/format-code-task-000088/tests/test.sh +39 -0
- tasks/format-code-task-000088/tests/test_command.sh +1 -0
- tasks/format-code-task-000100/environment/Dockerfile +3 -0
- tasks/format-code-task-000100/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000100/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000100/tests/test.patch +89 -0
- tasks/format-code-task-000100/tests/test.sh +39 -0
- tasks/format-code-task-000100/tests/test_command.sh +1 -0
- tasks/format-code-task-000107/environment/Dockerfile +3 -0
- tasks/format-code-task-000107/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000107/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000107/tests/test.patch +73 -0
- tasks/format-code-task-000107/tests/test.sh +39 -0
- tasks/format-code-task-000107/tests/test_command.sh +1 -0
- tasks/format-code-task-000109/environment/Dockerfile +3 -0
- tasks/format-code-task-000109/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000109/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000109/tests/test.patch +253 -0
- tasks/format-code-task-000109/tests/test.sh +46 -0
- tasks/format-code-task-000109/tests/test_command.sh +1 -0
- tasks/format-code-task-000131/environment/Dockerfile +3 -0
- tasks/format-code-task-000131/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000131/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000131/tests/test.patch +61 -0
- tasks/format-code-task-000131/tests/test.sh +39 -0
- tasks/format-code-task-000131/tests/test_command.sh +1 -0
- tasks/format-code-task-000136/environment/Dockerfile +3 -0
- tasks/format-code-task-000136/environment/setup/files/blocklist +33 -0
- tasks/format-code-task-000136/environment/setup/setup.sh +34 -0
- tasks/format-code-task-000136/tests/test.patch +209 -0
- tasks/format-code-task-000136/tests/test.sh +39 -0
- tasks/format-code-task-000136/tests/test_command.sh +1 -0
- tasks/format-code-task-000138/environment/Dockerfile +3 -0
- tasks/format-code-task-000138/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000043/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:22dbc5e3bb2b375a9032d568dcf57e02f1fcc0391f31cdc9ae5106cb4ef46404
|
tasks/format-code-task-000043/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-000043/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-000043/tests/test.patch
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test/data/dataset/test_dataframe_upload.py b/test/data/dataset/test_dataframe_upload.py
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 00000000..f0ce5690
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/test/data/dataset/test_dataframe_upload.py
|
| 6 |
+
@@ -0,0 +1,190 @@
|
| 7 |
+
+# -*- coding: utf-8 -*-
|
| 8 |
+
+
|
| 9 |
+
+
|
| 10 |
+
+
|
| 11 |
+
+
|
| 12 |
+
+
|
| 13 |
+
+
|
| 14 |
+
+
|
| 15 |
+
+import unittest
|
| 16 |
+
+import pandas as pd
|
| 17 |
+
+
|
| 18 |
+
+from cartoframes.data import Dataset, StrategiesRegistry
|
| 19 |
+
+from cartoframes.data.dataset.registry.base_dataset import BaseDataset
|
| 20 |
+
+from cartoframes.lib import context
|
| 21 |
+
+
|
| 22 |
+
+
|
| 23 |
+
+class CapturingContext():
|
| 24 |
+
+
|
| 25 |
+
+
|
| 26 |
+
+ def __init__(self):
|
| 27 |
+
+ self.copy_query = None
|
| 28 |
+
+ self.copy_data = None
|
| 29 |
+
+ self.long_running_query = None
|
| 30 |
+
+
|
| 31 |
+
+ def upload(self, query, data):
|
| 32 |
+
+ self.copy_query = query
|
| 33 |
+
+ self.copy_data = list(data)
|
| 34 |
+
+
|
| 35 |
+
+ def execute_query(self, query, **kwargs):
|
| 36 |
+
+ return {'rows': [{'current_schema': 'public'}]}
|
| 37 |
+
+
|
| 38 |
+
+ def execute_long_running_query(self, query):
|
| 39 |
+
+ self.long_running_query = query
|
| 40 |
+
+
|
| 41 |
+
+ def get_schema(self):
|
| 42 |
+
+ return 'public'
|
| 43 |
+
+
|
| 44 |
+
+
|
| 45 |
+
+class TestDataFrameUpload(unittest.TestCase):
|
| 46 |
+
+ def setUp(self):
|
| 47 |
+
+ self._capture = CapturingContext()
|
| 48 |
+
+ self._original_create_context = context.create_context
|
| 49 |
+
+ context.create_context = lambda credentials: self._capture
|
| 50 |
+
+
|
| 51 |
+
+ self._original_exists = BaseDataset.exists
|
| 52 |
+
+ BaseDataset.exists = lambda instance: False
|
| 53 |
+
+
|
| 54 |
+
+ def tearDown(self):
|
| 55 |
+
+ context.create_context = self._original_create_context
|
| 56 |
+
+ BaseDataset.exists = self._original_exists
|
| 57 |
+
+ StrategiesRegistry.instance = None
|
| 58 |
+
+
|
| 59 |
+
+ def _upload(self, df, **kwargs):
|
| 60 |
+
+ kwargs.setdefault('table_name', 'fake_table')
|
| 61 |
+
+ kwargs.setdefault('credentials', 'fake')
|
| 62 |
+
+ Dataset(df).upload(**kwargs)
|
| 63 |
+
+ return self._capture
|
| 64 |
+
+
|
| 65 |
+
+
|
| 66 |
+
+
|
| 67 |
+
+ def test_cartodb_id_and_the_geom_are_both_kept(self):
|
| 68 |
+
+ df = pd.DataFrame.from_dict({'cartodb_id': [1], 'the_geom': ['POINT (1 1)']})
|
| 69 |
+
+ cap = self._upload(df)
|
| 70 |
+
+
|
| 71 |
+
+ self.assertEqual(
|
| 72 |
+
+ cap.copy_query,
|
| 73 |
+
+ "COPY fake_table(cartodb_id,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 74 |
+
+ self.assertEqual(cap.copy_data, [b'1|SRID=4326;POINT (1 1)\n'])
|
| 75 |
+
+
|
| 76 |
+
+ def test_create_table_has_no_dangling_comma(self):
|
| 77 |
+
+ df = pd.DataFrame.from_dict({'cartodb_id': [1], 'the_geom': ['POINT (1 1)']})
|
| 78 |
+
+ cap = self._upload(df)
|
| 79 |
+
+
|
| 80 |
+
+ self.assertIn(
|
| 81 |
+
+ 'CREATE TABLE fake_table (cartodb_id bigint, the_geom geometry(Point, 4326))',
|
| 82 |
+
+ cap.long_running_query)
|
| 83 |
+
+ self.assertNotIn('(,', cap.long_running_query)
|
| 84 |
+
+
|
| 85 |
+
+ def test_single_geometry_column_is_renamed_to_the_geom(self):
|
| 86 |
+
+ df = pd.DataFrame([['POINT (1 1)']], columns=['geom'])
|
| 87 |
+
+ cap = self._upload(df)
|
| 88 |
+
+
|
| 89 |
+
+ self.assertEqual(
|
| 90 |
+
+ cap.copy_query,
|
| 91 |
+
+ "COPY fake_table(the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 92 |
+
+ self.assertEqual(cap.copy_data, [b'SRID=4326;POINT (1 1)\n'])
|
| 93 |
+
+
|
| 94 |
+
+ def test_several_geometry_columns_prioritize_the_geom(self):
|
| 95 |
+
+ df = pd.DataFrame([['POINT (0 0)', 'POINT (1 1)', 'POINT (2 2)']],
|
| 96 |
+
+ columns=['geom', 'the_geom', 'geometry'])
|
| 97 |
+
+ cap = self._upload(df)
|
| 98 |
+
+
|
| 99 |
+
+ self.assertEqual(
|
| 100 |
+
+ cap.copy_query,
|
| 101 |
+
+ "COPY fake_table(geom,the_geom,geometry) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 102 |
+
+ self.assertEqual(cap.copy_data, [b'POINT (0 0)|SRID=4326;POINT (1 1)|POINT (2 2)\n'])
|
| 103 |
+
+
|
| 104 |
+
+ def test_the_geom_webmercator_is_dropped(self):
|
| 105 |
+
+ df = pd.DataFrame([[1, 'POINT (1 1)', 'fake']],
|
| 106 |
+
+ columns=['cartodb_id', 'the_geom', 'the_geom_webmercator'])
|
| 107 |
+
+ cap = self._upload(df)
|
| 108 |
+
+
|
| 109 |
+
+ self.assertEqual(
|
| 110 |
+
+ cap.copy_query,
|
| 111 |
+
+ "COPY fake_table(cartodb_id,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 112 |
+
+ self.assertEqual(cap.copy_data, [b'1|SRID=4326;POINT (1 1)\n'])
|
| 113 |
+
+
|
| 114 |
+
+ def test_ordinary_columns_without_geometry(self):
|
| 115 |
+
+ df = pd.DataFrame([[1, True, 'text']], columns=['col1', 'col2', 'col3'])
|
| 116 |
+
+ cap = self._upload(df)
|
| 117 |
+
+
|
| 118 |
+
+ self.assertEqual(
|
| 119 |
+
+ cap.copy_query,
|
| 120 |
+
+ "COPY fake_table(col1,col2,col3) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 121 |
+
+ self.assertEqual(cap.copy_data, [b'1|True|text\n'])
|
| 122 |
+
+
|
| 123 |
+
+ def test_column_names_are_normalized(self):
|
| 124 |
+
+ df = pd.DataFrame([[1]], columns=['My Column'])
|
| 125 |
+
+ cap = self._upload(df)
|
| 126 |
+
+
|
| 127 |
+
+ self.assertEqual(
|
| 128 |
+
+ cap.copy_query,
|
| 129 |
+
+ "COPY fake_table(my_column) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 130 |
+
+ self.assertEqual(cap.copy_data, [b'1\n'])
|
| 131 |
+
+
|
| 132 |
+
+ def test_null_values_become_empty_fields(self):
|
| 133 |
+
+ df = pd.DataFrame.from_dict({'test': [None, [None, None]]})
|
| 134 |
+
+ cap = self._upload(df)
|
| 135 |
+
+
|
| 136 |
+
+ self.assertEqual(
|
| 137 |
+
+ cap.copy_query,
|
| 138 |
+
+ "COPY fake_table(test) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 139 |
+
+ self.assertEqual(cap.copy_data, [b'\n', b'\n'])
|
| 140 |
+
+
|
| 141 |
+
+ def test_null_geometry_becomes_empty_field(self):
|
| 142 |
+
+ df = pd.DataFrame.from_dict({'test': [None], 'the_geom': [None]})
|
| 143 |
+
+ cap = self._upload(df)
|
| 144 |
+
+
|
| 145 |
+
+ self.assertEqual(
|
| 146 |
+
+ cap.copy_query,
|
| 147 |
+
+ "COPY fake_table(test,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 148 |
+
+ self.assertEqual(cap.copy_data, [b'|\n'])
|
| 149 |
+
+
|
| 150 |
+
+
|
| 151 |
+
+
|
| 152 |
+
+ def test_with_lnglat_appends_synthesized_geometry(self):
|
| 153 |
+
+ df = pd.DataFrame([[1, 1]], columns=['lng', 'lat'])
|
| 154 |
+
+ cap = self._upload(df, with_lnglat=('lng', 'lat'))
|
| 155 |
+
+
|
| 156 |
+
+ self.assertEqual(
|
| 157 |
+
+ cap.copy_query,
|
| 158 |
+
+ "COPY fake_table(lng,lat,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 159 |
+
+ self.assertEqual(cap.copy_data, [b'1|1|SRID=4326;POINT (1 1)\n'])
|
| 160 |
+
+
|
| 161 |
+
+ def test_with_lnglat_drops_existing_geometry(self):
|
| 162 |
+
+ df = pd.DataFrame([[1, 1, 'POINT (2 2)']], columns=['lng', 'lat', 'the_geom'])
|
| 163 |
+
+ cap = self._upload(df, with_lnglat=('lng', 'lat'))
|
| 164 |
+
+
|
| 165 |
+
+ self.assertEqual(
|
| 166 |
+
+ cap.copy_query,
|
| 167 |
+
+ "COPY fake_table(lng,lat,the_geom) FROM stdin WITH (FORMAT csv, DELIMITER '|');")
|
| 168 |
+
+ self.assertEqual(cap.copy_data, [b'1|1|SRID=4326;POINT (1 1)\n'])
|
| 169 |
+
+
|
| 170 |
+
+ def test_with_lnglat_synthesized_geometry_in_create_table(self):
|
| 171 |
+
+ df = pd.DataFrame([[1, 1]], columns=['lng', 'lat'])
|
| 172 |
+
+ cap = self._upload(df, with_lnglat=('lng', 'lat'))
|
| 173 |
+
+
|
| 174 |
+
+ self.assertIn(
|
| 175 |
+
+ 'CREATE TABLE fake_table (lng bigint, lat bigint, the_geom geometry(Point, 4326))',
|
| 176 |
+
+ cap.long_running_query)
|
| 177 |
+
+
|
| 178 |
+
+
|
| 179 |
+
+
|
| 180 |
+
+ def test_create_table_type_mapping(self):
|
| 181 |
+
+ df = pd.DataFrame.from_dict({
|
| 182 |
+
+ 'a_int': pd.Series([1], dtype='int64'),
|
| 183 |
+
+ 'a_float': pd.Series([1.0], dtype='float64'),
|
| 184 |
+
+ 'a_text': pd.Series(['x'], dtype='object'),
|
| 185 |
+
+ 'a_bool': pd.Series([True], dtype='bool'),
|
| 186 |
+
+ })
|
| 187 |
+
+ cap = self._upload(df)
|
| 188 |
+
+
|
| 189 |
+
+ self.assertIn('a_int bigint', cap.long_running_query)
|
| 190 |
+
+ self.assertIn('a_float numeric', cap.long_running_query)
|
| 191 |
+
+ self.assertIn('a_text text', cap.long_running_query)
|
| 192 |
+
+ self.assertIn('a_bool boolean', cap.long_running_query)
|
| 193 |
+
+
|
| 194 |
+
+
|
| 195 |
+
+if __name__ == '__main__':
|
| 196 |
+
+ unittest.main()
|
| 197 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 198 |
+
new file mode 100755
|
| 199 |
+
--- /dev/null
|
| 200 |
+
+++ b/mimo_test_command.sh
|
| 201 |
+
@@ -0,0 +1,16 @@
|
| 202 |
+
+#!/usr/bin/env bash
|
| 203 |
+
+
|
| 204 |
+
+
|
| 205 |
+
+
|
| 206 |
+
+
|
| 207 |
+
+set -euo pipefail
|
| 208 |
+
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 209 |
+
+cd /testbed
|
| 210 |
+
+
|
| 211 |
+
+
|
| 212 |
+
+
|
| 213 |
+
+
|
| 214 |
+
+python -m pytest test/utils/test_columns.py -q
|
| 215 |
+
+
|
| 216 |
+
+
|
| 217 |
+
+python -m pytest test/data/dataset/test_dataframe_upload.py -q
|
tasks/format-code-task-000043/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/data/dataset/test_dataframe_upload.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-000043/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000044/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:119cc3e86df0e2ee6fe6fc7862ed26dda72bbbae0585f9a9088a41c877a9337f
|
tasks/format-code-task-000044/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-000044/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-000044/tests/test.patch
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js
|
| 2 |
+
index 7366dc552058..032503c1bdfb 100644
|
| 3 |
+
--- a/Specs/Core/TransformsSpec.js
|
| 4 |
+
+++ b/Specs/Core/TransformsSpec.js
|
| 5 |
+
@@ -243,6 +243,62 @@ defineSuite([
|
| 6 |
+
expect(actualTranslation).toEqual(origin);
|
| 7 |
+
});
|
| 8 |
+
|
| 9 |
+
+ it('aircraftHeadingPitchRollToFixedFrame works without a result parameter', function() {
|
| 10 |
+
+ var origin = new Cartesian3(1.0, 0.0, 0.0);
|
| 11 |
+
+ var heading = CesiumMath.toRadians(20.0);
|
| 12 |
+
+ var pitch = CesiumMath.toRadians(30.0);
|
| 13 |
+
+ var roll = CesiumMath.toRadians(40.0);
|
| 14 |
+
+
|
| 15 |
+
+ var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll));
|
| 16 |
+
+ var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3());
|
| 17 |
+
+ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3());
|
| 18 |
+
+ var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3());
|
| 19 |
+
+
|
| 20 |
+
+ Cartesian3.fromElements(-expectedX.z, expectedX.y, expectedX.x, expectedX);
|
| 21 |
+
+ Cartesian3.fromElements(-expectedY.z, expectedY.y, expectedY.x, expectedY);
|
| 22 |
+
+ Cartesian3.fromElements(-expectedZ.z, expectedZ.y, expectedZ.x, expectedZ);
|
| 23 |
+
+
|
| 24 |
+
+ var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE);
|
| 25 |
+
+ var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4()));
|
| 26 |
+
+ var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4()));
|
| 27 |
+
+ var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4()));
|
| 28 |
+
+ var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4()));
|
| 29 |
+
+
|
| 30 |
+
+ expect(actualX).toEqual(expectedX);
|
| 31 |
+
+ expect(actualY).toEqual(expectedY);
|
| 32 |
+
+ expect(actualZ).toEqual(expectedZ);
|
| 33 |
+
+ expect(actualTranslation).toEqual(origin);
|
| 34 |
+
+ });
|
| 35 |
+
+
|
| 36 |
+
+ it('aircraftHeadingPitchRollToFixedFrame works with a result parameter', function() {
|
| 37 |
+
+ var origin = new Cartesian3(1.0, 0.0, 0.0);
|
| 38 |
+
+ var heading = CesiumMath.toRadians(20.0);
|
| 39 |
+
+ var pitch = CesiumMath.toRadians(30.0);
|
| 40 |
+
+ var roll = CesiumMath.toRadians(40.0);
|
| 41 |
+
+
|
| 42 |
+
+ var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll));
|
| 43 |
+
+ var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3());
|
| 44 |
+
+ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3());
|
| 45 |
+
+ var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3());
|
| 46 |
+
+
|
| 47 |
+
+ Cartesian3.fromElements(-expectedX.z, expectedX.y, expectedX.x, expectedX);
|
| 48 |
+
+ Cartesian3.fromElements(-expectedY.z, expectedY.y, expectedY.x, expectedY);
|
| 49 |
+
+ Cartesian3.fromElements(-expectedZ.z, expectedZ.y, expectedZ.x, expectedZ);
|
| 50 |
+
+
|
| 51 |
+
+ var result = new Matrix4();
|
| 52 |
+
+ var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result);
|
| 53 |
+
+ var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4()));
|
| 54 |
+
+ var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4()));
|
| 55 |
+
+ var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4()));
|
| 56 |
+
+ var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4()));
|
| 57 |
+
+
|
| 58 |
+
+ expect(returnedResult).toBe(result);
|
| 59 |
+
+ expect(actualX).toEqual(expectedX);
|
| 60 |
+
+ expect(actualY).toEqual(expectedY);
|
| 61 |
+
+ expect(actualZ).toEqual(expectedZ);
|
| 62 |
+
+ expect(actualTranslation).toEqual(origin);
|
| 63 |
+
+ });
|
| 64 |
+
+
|
| 65 |
+
it('headingPitchRollQuaternion works without a result parameter', function() {
|
| 66 |
+
var origin = new Cartesian3(1.0, 0.0, 0.0);
|
| 67 |
+
var heading = CesiumMath.toRadians(20.0);
|
| 68 |
+
@@ -273,6 +329,36 @@ defineSuite([
|
| 69 |
+
expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11);
|
| 70 |
+
});
|
| 71 |
+
|
| 72 |
+
+ it('aircraftHeadingPitchRollQuaternion works without a result parameter', function() {
|
| 73 |
+
+ var origin = new Cartesian3(1.0, 0.0, 0.0);
|
| 74 |
+
+ var heading = CesiumMath.toRadians(20.0);
|
| 75 |
+
+ var pitch = CesiumMath.toRadians(30.0);
|
| 76 |
+
+ var roll = CesiumMath.toRadians(40.0);
|
| 77 |
+
+
|
| 78 |
+
+ var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE);
|
| 79 |
+
+ var expected = Matrix4.getRotation(transform, new Matrix3());
|
| 80 |
+
+
|
| 81 |
+
+ var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE);
|
| 82 |
+
+ var actual = Matrix3.fromQuaternion(quaternion);
|
| 83 |
+
+ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11);
|
| 84 |
+
+ });
|
| 85 |
+
+
|
| 86 |
+
+ it('aircraftHeadingPitchRollQuaternion works with a result parameter', function() {
|
| 87 |
+
+ var origin = new Cartesian3(1.0, 0.0, 0.0);
|
| 88 |
+
+ var heading = CesiumMath.toRadians(20.0);
|
| 89 |
+
+ var pitch = CesiumMath.toRadians(30.0);
|
| 90 |
+
+ var roll = CesiumMath.toRadians(40.0);
|
| 91 |
+
+
|
| 92 |
+
+ var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE);
|
| 93 |
+
+ var expected = Matrix4.getRotation(transform, new Matrix3());
|
| 94 |
+
+
|
| 95 |
+
+ var result = new Quaternion();
|
| 96 |
+
+ var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result);
|
| 97 |
+
+ var actual = Matrix3.fromQuaternion(quaternion);
|
| 98 |
+
+ expect(quaternion).toBe(result);
|
| 99 |
+
+ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11);
|
| 100 |
+
+ });
|
| 101 |
+
+
|
| 102 |
+
it('computeTemeToPseudoFixedMatrix works before noon', function() {
|
| 103 |
+
var time = JulianDate.fromDate(new Date('June 29, 2015 12:00:00 UTC'));
|
| 104 |
+
var t = Transforms.computeTemeToPseudoFixedMatrix(time);
|
| 105 |
+
@@ -795,6 +881,54 @@ defineSuite([
|
| 106 |
+
}).toThrowDeveloperError();
|
| 107 |
+
});
|
| 108 |
+
|
| 109 |
+
+ it('aircraftHeadingPitchRollToFixedFrame throws without an origin', function() {
|
| 110 |
+
+ expect(function() {
|
| 111 |
+
+ Transforms.aircraftHeadingPitchRollToFixedFrame(undefined, 0.0, 0.0, 0.0);
|
| 112 |
+
+ }).toThrowDeveloperError();
|
| 113 |
+
+ });
|
| 114 |
+
+
|
| 115 |
+
+ it('aircraftHeadingPitchRollToFixedFrame throws without an heading', function() {
|
| 116 |
+
+ expect(function() {
|
| 117 |
+
+ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, undefined, 0.0, 0.0);
|
| 118 |
+
+ }).toThrowDeveloperError();
|
| 119 |
+
+ });
|
| 120 |
+
+
|
| 121 |
+
+ it('aircraftHeadingPitchRollToFixedFrame throws without an pitch', function() {
|
| 122 |
+
+ expect(function() {
|
| 123 |
+
+ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, undefined, 0.0);
|
| 124 |
+
+ }).toThrowDeveloperError();
|
| 125 |
+
+ });
|
| 126 |
+
+
|
| 127 |
+
+ it('aircraftHeadingPitchRollToFixedFrame throws without an roll', function() {
|
| 128 |
+
+ expect(function() {
|
| 129 |
+
+ Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, 0.0, 0.0, undefined);
|
| 130 |
+
+ }).toThrowDeveloperError();
|
| 131 |
+
+ });
|
| 132 |
+
+
|
| 133 |
+
+ it('aircraftHeadingPitchRollQuaternion throws without an origin', function() {
|
| 134 |
+
+ expect(function() {
|
| 135 |
+
+ Transforms.aircraftHeadingPitchRollQuaternion(undefined, 0.0, 0.0, 0.0);
|
| 136 |
+
+ }).toThrowDeveloperError();
|
| 137 |
+
+ });
|
| 138 |
+
+
|
| 139 |
+
+ it('aircraftHeadingPitchRollQuaternion throws without an heading', function() {
|
| 140 |
+
+ expect(function() {
|
| 141 |
+
+ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, undefined, 0.0, 0.0);
|
| 142 |
+
+ }).toThrowDeveloperError();
|
| 143 |
+
+ });
|
| 144 |
+
+
|
| 145 |
+
+ it('aircraftHeadingPitchRollQuaternion throws without an pitch', function() {
|
| 146 |
+
+ expect(function() {
|
| 147 |
+
+ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, 0.0, undefined, 0.0);
|
| 148 |
+
+ }).toThrowDeveloperError();
|
| 149 |
+
+ });
|
| 150 |
+
+
|
| 151 |
+
+ it('aircraftHeadingPitchRollQuaternion throws without an roll', function() {
|
| 152 |
+
+ expect(function() {
|
| 153 |
+
+ Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, 0.0, 0.0, undefined);
|
| 154 |
+
+ }).toThrowDeveloperError();
|
| 155 |
+
+ });
|
| 156 |
+
+
|
| 157 |
+
it('computeTemeToPseudoFixedMatrix throws without a date', function() {
|
| 158 |
+
expect(function() {
|
| 159 |
+
Transforms.computeTemeToPseudoFixedMatrix(undefined);
|
| 160 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 161 |
+
new file mode 100644
|
| 162 |
+
--- /dev/null
|
| 163 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 164 |
+
@@ -0,0 +1,51 @@
|
| 165 |
+
+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
|
| 215 |
+
+beJqAFAAAA==
|
| 216 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 217 |
+
new file mode 100755
|
| 218 |
+
--- /dev/null
|
| 219 |
+
+++ b/mimo_test_command.sh
|
| 220 |
+
@@ -0,0 +1,6 @@
|
| 221 |
+
+#!/usr/bin/env bash
|
| 222 |
+
+
|
| 223 |
+
+set -uo pipefail
|
| 224 |
+
+cd /testbed || exit 1
|
| 225 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 226 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000044/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 |
+
Specs/Core/TransformsSpec.js
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 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-000044/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000088/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:2853a9b39cc1171be5ad4f4b3d49fac166c4c01da1b2208f726d22447f8322c0
|
tasks/format-code-task-000088/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-000088/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-000088/tests/test.patch
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/controllers/exclude_processes_test.go b/controllers/exclude_processes_test.go
|
| 2 |
+
index d49102374..bb59b37c1 100644
|
| 3 |
+
--- a/controllers/exclude_processes_test.go
|
| 4 |
+
+++ b/controllers/exclude_processes_test.go
|
| 5 |
+
@@ -830,6 +830,97 @@ var _ = Describe("exclude_processes", func() {
|
| 6 |
+
})
|
| 7 |
+
})
|
| 8 |
+
})
|
| 9 |
+
+
|
| 10 |
+
+ When("transaction system processes should be excluded", func() {
|
| 11 |
+
+ When("a stateless and a log process should be excluded", func() {
|
| 12 |
+
+ BeforeEach(func() {
|
| 13 |
+
+ var pickedStateless, pickedLog bool
|
| 14 |
+
+
|
| 15 |
+
+ _, processGroupIDs, err := cluster.GetCurrentProcessGroupsAndProcessCounts()
|
| 16 |
+
+ Expect(err).NotTo(HaveOccurred())
|
| 17 |
+
+ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassLog, processGroupIDs[fdbv1beta2.ProcessClassLog]), fdbv1beta2.ProcessClassLog, nil))
|
| 18 |
+
+ cluster.Status.ProcessGroups[len(cluster.Status.ProcessGroups)-1].ProcessGroupConditions = nil
|
| 19 |
+
+ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassStateless, processGroupIDs[fdbv1beta2.ProcessClassStateless]), fdbv1beta2.ProcessClassStateless, nil))
|
| 20 |
+
+ cluster.Status.ProcessGroups[len(cluster.Status.ProcessGroups)-1].ProcessGroupConditions = nil
|
| 21 |
+
+
|
| 22 |
+
+ markedForRemoval := make([]fdbv1beta2.ProcessGroupID, 0, 2)
|
| 23 |
+
+ for _, processGroup := range cluster.Status.ProcessGroups {
|
| 24 |
+
+ if !processGroup.ProcessClass.IsTransaction() || processGroup.ProcessClass == fdbv1beta2.ProcessClassClusterController {
|
| 25 |
+
+ continue
|
| 26 |
+
+ }
|
| 27 |
+
+
|
| 28 |
+
+ if pickedLog && pickedStateless {
|
| 29 |
+
+ break
|
| 30 |
+
+ }
|
| 31 |
+
+
|
| 32 |
+
+ if !processGroup.ProcessClass.IsLogProcess() {
|
| 33 |
+
+ if pickedStateless {
|
| 34 |
+
+ continue
|
| 35 |
+
+ }
|
| 36 |
+
+ pickedStateless = true
|
| 37 |
+
+ }
|
| 38 |
+
+
|
| 39 |
+
+ if processGroup.ProcessClass.IsLogProcess() {
|
| 40 |
+
+ if pickedLog {
|
| 41 |
+
+ continue
|
| 42 |
+
+ }
|
| 43 |
+
+ pickedLog = true
|
| 44 |
+
+ }
|
| 45 |
+
+
|
| 46 |
+
+ processGroup.MarkForRemoval()
|
| 47 |
+
+ markedForRemoval = append(markedForRemoval, processGroup.ProcessGroupID)
|
| 48 |
+
+ }
|
| 49 |
+
+
|
| 50 |
+
+ Expect(markedForRemoval).To(HaveLen(2))
|
| 51 |
+
+ })
|
| 52 |
+
+
|
| 53 |
+
+ When("no processes are missing", func() {
|
| 54 |
+
+ It("should exclude the process", func() {
|
| 55 |
+
+ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient)
|
| 56 |
+
+ Expect(err).NotTo(HaveOccurred())
|
| 57 |
+
+
|
| 58 |
+
+ Expect(req).To(BeNil())
|
| 59 |
+
+ Expect(adminClient.ExcludedAddresses).To(HaveLen(2))
|
| 60 |
+
+ })
|
| 61 |
+
+ })
|
| 62 |
+
+
|
| 63 |
+
+ When("a transaction process is missing", func() {
|
| 64 |
+
+ var missingProcssGroup *fdbv1beta2.ProcessGroupStatus
|
| 65 |
+
+
|
| 66 |
+
+ BeforeEach(func() {
|
| 67 |
+
+ _, processGroupIDs, err := cluster.GetCurrentProcessGroupsAndProcessCounts()
|
| 68 |
+
+ Expect(err).NotTo(HaveOccurred())
|
| 69 |
+
+
|
| 70 |
+
+ missingProcssGroup = fdbv1beta2.NewProcessGroupStatus(cluster.GetNextRandomProcessGroupID(fdbv1beta2.ProcessClassLog, processGroupIDs[fdbv1beta2.ProcessClassLog]), fdbv1beta2.ProcessClassLog, nil)
|
| 71 |
+
+ cluster.Status.ProcessGroups = append(cluster.Status.ProcessGroups, missingProcssGroup)
|
| 72 |
+
+
|
| 73 |
+
+ clusterReconciler.InSimulation = false
|
| 74 |
+
+ })
|
| 75 |
+
+
|
| 76 |
+
+ It("should not exclude the process", func() {
|
| 77 |
+
+ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient)
|
| 78 |
+
+ Expect(err).NotTo(HaveOccurred())
|
| 79 |
+
+
|
| 80 |
+
+ Expect(req).NotTo(BeNil())
|
| 81 |
+
+ Expect(adminClient.ExcludedAddresses).To(BeEmpty())
|
| 82 |
+
+ })
|
| 83 |
+
+
|
| 84 |
+
+ When("the transaction process is missing for more than 10 minutes", func() {
|
| 85 |
+
+ BeforeEach(func() {
|
| 86 |
+
+ missingProcssGroup.ProcessGroupConditions[0].Timestamp = time.Now().Add(-10 * time.Minute).Unix()
|
| 87 |
+
+ })
|
| 88 |
+
+
|
| 89 |
+
+ It("should exclude the process", func() {
|
| 90 |
+
+ adminClient, err := mock.NewMockAdminClientUncast(cluster, k8sClient)
|
| 91 |
+
+ Expect(err).NotTo(HaveOccurred())
|
| 92 |
+
+
|
| 93 |
+
+ Expect(req).To(BeNil())
|
| 94 |
+
+ Expect(adminClient.ExcludedAddresses).To(HaveLen(2))
|
| 95 |
+
+ })
|
| 96 |
+
+ })
|
| 97 |
+
+ })
|
| 98 |
+
+ })
|
| 99 |
+
+ })
|
| 100 |
+
})
|
| 101 |
+
})
|
| 102 |
+
|
| 103 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 104 |
+
new file mode 100644
|
| 105 |
+
--- /dev/null
|
| 106 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 107 |
+
@@ -0,0 +1,5 @@
|
| 108 |
+
+H4sIAAAAAAAAA+3SPU/DMBAG4Mz5FUeZ8+FAkqkDY7cO7FFimzQi8SF/VPx8TBYqJOjSCgHvs9xZ
|
| 109 |
+
+d5LPOudDmGbVaXMskmspo7au1xh9jmsu6kpUVds27V1SCtGIOqH6ahOdCM73liixzP67vnP1Xyr/
|
| 110 |
+
+2L/XzneSl6U3KneHy91xbv+iPdl/GfvEfVNVCZWXG+Fr/3z/tzfFMJli6N0hlYrWTzBolY5M7ynl
|
| 111 |
+
+hWTjLc+ztq6gzAZDj7HwsN85yiQH47eCsiNlflo0h3gqF8rGyTyPnD+xDG670a9yDkp3L5aldk67
|
| 112 |
+
+TfrT7wYAAAAAAAAAAAAAAAAAAAAA+AveAMBBKUoAKAAA
|
| 113 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 114 |
+
new file mode 100755
|
| 115 |
+
--- /dev/null
|
| 116 |
+
+++ b/mimo_test_command.sh
|
| 117 |
+
@@ -0,0 +1,6 @@
|
| 118 |
+
+#!/usr/bin/env bash
|
| 119 |
+
+
|
| 120 |
+
+set -uo pipefail
|
| 121 |
+
+cd /testbed || exit 1
|
| 122 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 123 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000088/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 |
+
controllers/exclude_processes_test.go
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 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-000088/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000100/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:c69033924f2984abe48b7d34902ce4bdc0eca6f7ca08101779b3d655014b1ee4
|
tasks/format-code-task-000100/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-000100/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-000100/tests/test.patch
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/tests/pint_pickle_test.py b/tests/pint_pickle_test.py
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 0000000000..0b99eb6b6b
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/tests/pint_pickle_test.py
|
| 6 |
+
@@ -0,0 +1,62 @@
|
| 7 |
+
+
|
| 8 |
+
+
|
| 9 |
+
+
|
| 10 |
+
+
|
| 11 |
+
+
|
| 12 |
+
+
|
| 13 |
+
+
|
| 14 |
+
+
|
| 15 |
+
+
|
| 16 |
+
+
|
| 17 |
+
+
|
| 18 |
+
+
|
| 19 |
+
+
|
| 20 |
+
+
|
| 21 |
+
+
|
| 22 |
+
+
|
| 23 |
+
+import pickle
|
| 24 |
+
+import unittest
|
| 25 |
+
+
|
| 26 |
+
+import pint
|
| 27 |
+
+
|
| 28 |
+
+import perfkitbenchmarker
|
| 29 |
+
+
|
| 30 |
+
+
|
| 31 |
+
+class TestPintPickling(unittest.TestCase):
|
| 32 |
+
+
|
| 33 |
+
+ def testSameUnitRegistry(self):
|
| 34 |
+
+ q_prepickle = perfkitbenchmarker.UNIT_REGISTRY.second
|
| 35 |
+
+ q_pickled = pickle.dumps(q_prepickle)
|
| 36 |
+
+ q_postpickle = pickle.loads(q_pickled)
|
| 37 |
+
+
|
| 38 |
+
+ self.assertEqual(q_prepickle, q_postpickle)
|
| 39 |
+
+
|
| 40 |
+
+ def testNewUnitRegistry(self):
|
| 41 |
+
+
|
| 42 |
+
+
|
| 43 |
+
+
|
| 44 |
+
+
|
| 45 |
+
+ q_prepickle = perfkitbenchmarker.UNIT_REGISTRY.second
|
| 46 |
+
+ q_pickled = pickle.dumps(q_prepickle)
|
| 47 |
+
+
|
| 48 |
+
+ perfkitbenchmarker.UNIT_REGISTRY = pint.UnitRegistry()
|
| 49 |
+
+
|
| 50 |
+
+ q_postpickle = pickle.loads(q_pickled)
|
| 51 |
+
+
|
| 52 |
+
+ with self.assertRaises(TypeError):
|
| 53 |
+
+
|
| 54 |
+
+
|
| 55 |
+
+
|
| 56 |
+
+
|
| 57 |
+
+ q_prepickle.to(q_postpickle)
|
| 58 |
+
+
|
| 59 |
+
+ new_second = perfkitbenchmarker.UNIT_REGISTRY.second
|
| 60 |
+
+ self.assertEqual(q_postpickle, new_second)
|
| 61 |
+
+
|
| 62 |
+
+
|
| 63 |
+
+
|
| 64 |
+
+ q_postpickle.to(new_second)
|
| 65 |
+
+
|
| 66 |
+
+
|
| 67 |
+
+if __name__ == '__main__':
|
| 68 |
+
+ unittest.main()
|
| 69 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 70 |
+
new file mode 100644
|
| 71 |
+
--- /dev/null
|
| 72 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 73 |
+
@@ -0,0 +1,5 @@
|
| 74 |
+
+H4sIAAAAAAAAA+3SPUvEMBgH8M79FA+lgw59STEpCDfcINwiOriXvgQu2CahzRXv25t2UQ70ljtE
|
| 75 |
+
+/f+GJCThScI/aXNQfVdJPWfBteReyfnae6f9Oma8yIuSs7Lw+xgTeRkQv9qNPjlMrh6JgtEY992+
|
| 76 |
+
+c+u/VPqRv5OTq1ozDLXu0ml/uTPO5c+EOMn/ThQioPxyV/jaP8+/7WgNvpFdKN+sGR09b192myje
|
| 77 |
+
+PT0+ZKk9Ll+jUfo+XuajUM51T1F8sy6Q0spRchuF9uj2RlMykB/5erQ0U2aVdpVV7Wsvq2XG16Nk
|
| 78 |
+
+Dn/61QAAAAAAAAAAAAAAAAAAAAAAf8M7+YENmQAoAAA=
|
| 79 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 80 |
+
new file mode 100755
|
| 81 |
+
--- /dev/null
|
| 82 |
+
+++ b/mimo_test_command.sh
|
| 83 |
+
@@ -0,0 +1,6 @@
|
| 84 |
+
+#!/usr/bin/env bash
|
| 85 |
+
+
|
| 86 |
+
+set -uo pipefail
|
| 87 |
+
+cd /testbed || exit 1
|
| 88 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 89 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000100/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 |
+
tests/pint_pickle_test.py
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 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-000100/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000107/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:17db0205ebae2dcee4fe9cd60a6fdd1ee563680579d4acce990f28e0e8920323
|
tasks/format-code-task-000107/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-000107/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-000107/tests/test.patch
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/pkg/skaffold/build/custom/custom_test.go b/pkg/skaffold/build/custom/custom_test.go
|
| 2 |
+
index c79d3684f..436df3008 100644
|
| 3 |
+
--- a/pkg/skaffold/build/custom/custom_test.go
|
| 4 |
+
+++ b/pkg/skaffold/build/custom/custom_test.go
|
| 5 |
+
@@ -42,24 +42,24 @@ func TestRetrieveEnv(t *testing.T) {
|
| 6 |
+
tag: "gcr.io/image/tag:mytag",
|
| 7 |
+
environ: nil,
|
| 8 |
+
buildContext: "/some/path",
|
| 9 |
+
- expected: []string{"IMAGES=gcr.io/image/tag:mytag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path"},
|
| 10 |
+
+ expected: []string{"IMAGE=gcr.io/image/tag:mytag", "IMAGES=gcr.io/image/tag:mytag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path"},
|
| 11 |
+
}, {
|
| 12 |
+
description: "make sure environ is correctly applied",
|
| 13 |
+
tag: "gcr.io/image/tag:anothertag",
|
| 14 |
+
environ: []string{"PATH=/path", "HOME=/root"},
|
| 15 |
+
buildContext: "/some/path",
|
| 16 |
+
- expected: []string{"IMAGES=gcr.io/image/tag:anothertag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path", "PATH=/path", "HOME=/root"},
|
| 17 |
+
+ expected: []string{"IMAGE=gcr.io/image/tag:anothertag", "IMAGES=gcr.io/image/tag:anothertag", "PUSH_IMAGE=false", "BUILD_CONTEXT=/some/path", "PATH=/path", "HOME=/root"},
|
| 18 |
+
}, {
|
| 19 |
+
description: "push image is true",
|
| 20 |
+
tag: "gcr.io/image/push:tag",
|
| 21 |
+
pushImages: true,
|
| 22 |
+
- expected: []string{"IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT="},
|
| 23 |
+
+ expected: []string{"IMAGE=gcr.io/image/push:tag", "IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT="},
|
| 24 |
+
}, {
|
| 25 |
+
description: "add additional env",
|
| 26 |
+
tag: "gcr.io/image/push:tag",
|
| 27 |
+
pushImages: true,
|
| 28 |
+
additionalEnv: []string{"KUBECONTEXT=mycluster"},
|
| 29 |
+
- expected: []string{"IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT=", "KUBECONTEXT=mycluster"},
|
| 30 |
+
+ expected: []string{"IMAGE=gcr.io/image/push:tag", "IMAGES=gcr.io/image/push:tag", "PUSH_IMAGE=true", "BUILD_CONTEXT=", "KUBECONTEXT=mycluster"},
|
| 31 |
+
},
|
| 32 |
+
}
|
| 33 |
+
for _, test := range tests {
|
| 34 |
+
@@ -94,7 +94,7 @@ func TestRetrieveCmd(t *testing.T) {
|
| 35 |
+
},
|
| 36 |
+
},
|
| 37 |
+
tag: "image:tag",
|
| 38 |
+
- expected: expectedCmd("./build.sh", "workspace", nil, []string{"IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT=workspace"}),
|
| 39 |
+
+ expected: expectedCmd("./build.sh", "workspace", nil, []string{"IMAGE=image:tag", "IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT=workspace"}),
|
| 40 |
+
}, {
|
| 41 |
+
description: "buildcommand with multiple args",
|
| 42 |
+
artifact: &latest.Artifact{
|
| 43 |
+
@@ -105,7 +105,7 @@ func TestRetrieveCmd(t *testing.T) {
|
| 44 |
+
},
|
| 45 |
+
},
|
| 46 |
+
tag: "image:tag",
|
| 47 |
+
- expected: expectedCmd("./build.sh", "", []string{"--flag", "--anotherflag"}, []string{"IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT="}),
|
| 48 |
+
+ expected: expectedCmd("./build.sh", "", []string{"--flag", "--anotherflag"}, []string{"IMAGE=image:tag", "IMAGES=image:tag", "PUSH_IMAGE=false", "BUILD_CONTEXT="}),
|
| 49 |
+
},
|
| 50 |
+
}
|
| 51 |
+
for _, test := range tests {
|
| 52 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 53 |
+
new file mode 100644
|
| 54 |
+
index 000000000..9b824fefe
|
| 55 |
+
--- /dev/null
|
| 56 |
+
+++ b/test_commands.json
|
| 57 |
+
@@ -0,0 +1,3 @@
|
| 58 |
+
+{
|
| 59 |
+
+ "test_commands": ["go test ./pkg/skaffold/build/custom/... -run 'TestRetrieveEnv|TestRetrieveCmd'"]
|
| 60 |
+
+}
|
| 61 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 62 |
+
new file mode 100755
|
| 63 |
+
--- /dev/null
|
| 64 |
+
+++ b/mimo_test_command.sh
|
| 65 |
+
@@ -0,0 +1,8 @@
|
| 66 |
+
+#!/usr/bin/env bash
|
| 67 |
+
+
|
| 68 |
+
+set -uo pipefail
|
| 69 |
+
+cd /testbed
|
| 70 |
+
+rc=0
|
| 71 |
+
+go test ./pkg/skaffold/build/custom/... -run 'TestRetrieveEnv|TestRetrieveCmd'
|
| 72 |
+
+rc=$(( rc | $? ))
|
| 73 |
+
+exit $rc
|
tasks/format-code-task-000107/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/skaffold/build/custom/custom_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-000107/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000109/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:44fa53b2c677e24a2d7af58ff9af5b9d4b92a78c63d324a2542a8a1c4a82ff72
|
tasks/format-code-task-000109/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-000109/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-000109/tests/test.patch
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/cmd/skaffold/app/cmd/dev_test.go b/cmd/skaffold/app/cmd/dev_test.go
|
| 2 |
+
index 6ab37b8caa3..ff5d3347bae 100644
|
| 3 |
+
--- a/cmd/skaffold/app/cmd/dev_test.go
|
| 4 |
+
+++ b/cmd/skaffold/app/cmd/dev_test.go
|
| 5 |
+
@@ -22,6 +22,7 @@ import (
|
| 6 |
+
"testing"
|
| 7 |
+
|
| 8 |
+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
|
| 9 |
+
+ "github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
|
| 10 |
+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/manifest"
|
| 11 |
+
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner"
|
| 12 |
+
runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext/v2"
|
| 13 |
+
@@ -32,10 +33,11 @@ import (
|
| 14 |
+
|
| 15 |
+
type mockDevRunner struct {
|
| 16 |
+
runner.Runner
|
| 17 |
+
- hasBuilt bool
|
| 18 |
+
- hasDeployed bool
|
| 19 |
+
- errDev error
|
| 20 |
+
- calls []string
|
| 21 |
+
+ hasBuilt bool
|
| 22 |
+
+ hasDeployed bool
|
| 23 |
+
+ errDev error
|
| 24 |
+
+ calls []string
|
| 25 |
+
+ manifestsByConfig *manifest.ManifestListByConfig
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
func (r *mockDevRunner) Dev(context.Context, io.Writer, []*latest.Artifact) error {
|
| 29 |
+
@@ -58,11 +60,16 @@ func (r *mockDevRunner) Prune(context.Context, io.Writer) error {
|
| 30 |
+
return nil
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
-func (r *mockDevRunner) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error {
|
| 34 |
+
+func (r *mockDevRunner) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error {
|
| 35 |
+
r.calls = append(r.calls, "Cleanup")
|
| 36 |
+
return nil
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
+func (r *mockDevRunner) Render(ctx context.Context, out io.Writer, builds []graph.Artifact, offline bool) (*manifest.ManifestListByConfig, error) {
|
| 40 |
+
+ r.calls = append(r.calls, "Render")
|
| 41 |
+
+ return r.manifestsByConfig, nil
|
| 42 |
+
+}
|
| 43 |
+
+
|
| 44 |
+
func TestDoDev(t *testing.T) {
|
| 45 |
+
tests := []struct {
|
| 46 |
+
description string
|
| 47 |
+
@@ -74,7 +81,7 @@ func TestDoDev(t *testing.T) {
|
| 48 |
+
description: "cleanup and then prune",
|
| 49 |
+
hasBuilt: true,
|
| 50 |
+
hasDeployed: true,
|
| 51 |
+
- expectedCalls: []string{"Dev", "HasDeployed", "HasBuilt", "Cleanup", "Prune"},
|
| 52 |
+
+ expectedCalls: []string{"Dev", "HasDeployed", "HasBuilt", "Render", "Cleanup", "Prune"},
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
description: "hasn't deployed",
|
| 56 |
+
@@ -139,7 +146,11 @@ func (m *mockConfigChangeRunner) Prune(context.Context, io.Writer) error {
|
| 57 |
+
return nil
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
-func (m *mockConfigChangeRunner) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error {
|
| 61 |
+
+func (m *mockConfigChangeRunner) Render(ctx context.Context, out io.Writer, builds []graph.Artifact, offline bool) (*manifest.ManifestListByConfig, error) {
|
| 62 |
+
+ return nil, nil
|
| 63 |
+
+}
|
| 64 |
+
+
|
| 65 |
+
+func (m *mockConfigChangeRunner) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error {
|
| 66 |
+
return nil
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
diff --git a/integration/delete_test.go b/integration/delete_test.go
|
| 70 |
+
new file mode 100644
|
| 71 |
+
index 00000000000..e37004b7b6b
|
| 72 |
+
--- /dev/null
|
| 73 |
+
+++ b/integration/delete_test.go
|
| 74 |
+
@@ -0,0 +1,73 @@
|
| 75 |
+
+
|
| 76 |
+
+
|
| 77 |
+
+
|
| 78 |
+
+
|
| 79 |
+
+
|
| 80 |
+
+
|
| 81 |
+
+
|
| 82 |
+
+
|
| 83 |
+
+
|
| 84 |
+
+
|
| 85 |
+
+
|
| 86 |
+
+
|
| 87 |
+
+
|
| 88 |
+
+
|
| 89 |
+
+
|
| 90 |
+
+
|
| 91 |
+
+package integration
|
| 92 |
+
+
|
| 93 |
+
+import (
|
| 94 |
+
+ "testing"
|
| 95 |
+
+ "time"
|
| 96 |
+
+
|
| 97 |
+
+ "github.com/GoogleContainerTools/skaffold/integration/skaffold"
|
| 98 |
+
+)
|
| 99 |
+
+
|
| 100 |
+
+func TestDelete(t *testing.T) {
|
| 101 |
+
+ var tests = []struct {
|
| 102 |
+
+ description string
|
| 103 |
+
+ dir string
|
| 104 |
+
+ args []string
|
| 105 |
+
+ pods []string
|
| 106 |
+
+ deployments []string
|
| 107 |
+
+ env []string
|
| 108 |
+
+ }{
|
| 109 |
+
+ {
|
| 110 |
+
+ description: "getting-started",
|
| 111 |
+
+ dir: "testdata/getting-started",
|
| 112 |
+
+ pods: []string{"getting-started"},
|
| 113 |
+
+ },
|
| 114 |
+
+ {
|
| 115 |
+
+ description: "microservices",
|
| 116 |
+
+ dir: "examples/microservices",
|
| 117 |
+
+ args: []string{"--status-check=false"},
|
| 118 |
+
+ deployments: []string{"leeroy-app", "leeroy-web"},
|
| 119 |
+
+ },
|
| 120 |
+
+ {
|
| 121 |
+
+ description: "multi-config-microservices",
|
| 122 |
+
+ dir: "examples/multi-config-microservices",
|
| 123 |
+
+ deployments: []string{"leeroy-app", "leeroy-web"},
|
| 124 |
+
+ },
|
| 125 |
+
+ {
|
| 126 |
+
+ description: "multiple deployers",
|
| 127 |
+
+ dir: "testdata/deploy-multiple",
|
| 128 |
+
+ pods: []string{"deploy-kubectl", "deploy-kustomize"},
|
| 129 |
+
+ },
|
| 130 |
+
+ }
|
| 131 |
+
+
|
| 132 |
+
+ MarkIntegrationTest(t, CanRunWithoutGcp)
|
| 133 |
+
+
|
| 134 |
+
+ for _, test := range tests {
|
| 135 |
+
+ t.Run(test.description, func(t *testing.T) {
|
| 136 |
+
+ ns, client := SetupNamespace(t)
|
| 137 |
+
+
|
| 138 |
+
+ args := append(test.args, "--cache-artifacts=false")
|
| 139 |
+
+ skaffold.Run(args...).InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFail(t)
|
| 140 |
+
+
|
| 141 |
+
+ client.WaitForPodsReady(test.pods...)
|
| 142 |
+
+ client.waitForDeploymentsToStabilizeWithTimeout(time.Minute*2, test.deployments...)
|
| 143 |
+
+
|
| 144 |
+
+ skaffold.Delete().InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFail(t)
|
| 145 |
+
+ })
|
| 146 |
+
+ }
|
| 147 |
+
+}
|
| 148 |
+
diff --git a/pkg/skaffold/deploy/cloudrun/deploy_test.go b/pkg/skaffold/deploy/cloudrun/deploy_test.go
|
| 149 |
+
index c0b55254c8d..382ba52925d 100644
|
| 150 |
+
--- a/pkg/skaffold/deploy/cloudrun/deploy_test.go
|
| 151 |
+
+++ b/pkg/skaffold/deploy/cloudrun/deploy_test.go
|
| 152 |
+
@@ -327,9 +327,11 @@ func TestCleanup(tOuter *testing.T) {
|
| 153 |
+
deployer, _ := NewDeployer(&runcontext.RunContext{}, &label.DefaultLabeller{}, &latest.CloudRunDeploy{ProjectID: test.defaultProject, Region: test.region}, configName)
|
| 154 |
+
deployer.clientOptions = append(deployer.clientOptions, option.WithEndpoint(ts.URL), option.WithoutAuthentication())
|
| 155 |
+
deployer.useGcpOptions = false
|
| 156 |
+
+ manifestListByConfig := manifest.NewManifestListByConfig()
|
| 157 |
+
manifest, _ := json.Marshal(test.toDelete)
|
| 158 |
+
manifests := [][]byte{manifest}
|
| 159 |
+
- err := deployer.Cleanup(context.Background(), os.Stderr, false, manifests)
|
| 160 |
+
+ manifestListByConfig.Add(configName, manifests)
|
| 161 |
+
+ err := deployer.Cleanup(context.Background(), os.Stderr, false, &manifestListByConfig)
|
| 162 |
+
if test.httpErr == 0 && err != nil {
|
| 163 |
+
t.Fatalf("Expected success but got err: %v", err)
|
| 164 |
+
} else if test.httpErr != 0 && err == nil {
|
| 165 |
+
diff --git a/pkg/skaffold/deploy/deploy_mux_test.go b/pkg/skaffold/deploy/deploy_mux_test.go
|
| 166 |
+
index f6a4212f52b..9f9fc67968d 100644
|
| 167 |
+
--- a/pkg/skaffold/deploy/deploy_mux_test.go
|
| 168 |
+
+++ b/pkg/skaffold/deploy/deploy_mux_test.go
|
| 169 |
+
@@ -87,7 +87,7 @@ func (m *MockDeployer) Dependencies() ([]string, error) {
|
| 170 |
+
return m.dependencies, m.dependenciesErr
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
-func (m *MockDeployer) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error {
|
| 174 |
+
+func (m *MockDeployer) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error {
|
| 175 |
+
return m.cleanupErr
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
diff --git a/pkg/skaffold/deploy/kubectl/kubectl_test.go b/pkg/skaffold/deploy/kubectl/kubectl_test.go
|
| 179 |
+
index b8a93544186..a9edb4d4705 100644
|
| 180 |
+
--- a/pkg/skaffold/deploy/kubectl/kubectl_test.go
|
| 181 |
+
+++ b/pkg/skaffold/deploy/kubectl/kubectl_test.go
|
| 182 |
+
@@ -337,7 +337,7 @@ func TestKubectlCleanup(t *testing.T) {
|
| 183 |
+
true)
|
| 184 |
+
t.CheckNoError(errR)
|
| 185 |
+
|
| 186 |
+
- err = k.Cleanup(context.Background(), io.Discard, test.dryRun, m.GetForConfig(configName))
|
| 187 |
+
+ err = k.Cleanup(context.Background(), io.Discard, test.dryRun, m)
|
| 188 |
+
|
| 189 |
+
t.CheckError(test.shouldErr, err)
|
| 190 |
+
})
|
| 191 |
+
diff --git a/pkg/skaffold/render/generate/generate_test.go b/pkg/skaffold/render/generate/generate_test.go
|
| 192 |
+
index f15e39b2a9d..d638b6e5d4d 100644
|
| 193 |
+
--- a/pkg/skaffold/render/generate/generate_test.go
|
| 194 |
+
+++ b/pkg/skaffold/render/generate/generate_test.go
|
| 195 |
+
@@ -183,7 +183,7 @@ func TestGenerate(t *testing.T) {
|
| 196 |
+
|
| 197 |
+
func TestGenerateFromURLManifest(t *testing.T) {
|
| 198 |
+
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| 199 |
+
- fmt.Fprintln(w, podYaml)
|
| 200 |
+
+ fmt.Fprint(w, podYaml)
|
| 201 |
+
}))
|
| 202 |
+
|
| 203 |
+
defer ts.Close()
|
| 204 |
+
diff --git a/pkg/skaffold/runner/timings_test.go b/pkg/skaffold/runner/timings_test.go
|
| 205 |
+
index 7553022e1ce..43ad2e13419 100644
|
| 206 |
+
--- a/pkg/skaffold/runner/timings_test.go
|
| 207 |
+
+++ b/pkg/skaffold/runner/timings_test.go
|
| 208 |
+
@@ -100,7 +100,7 @@ func (m *mockDeployer) Deploy(context.Context, io.Writer, []graph.Artifact, *man
|
| 209 |
+
return nil
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
-func (m *mockDeployer) Cleanup(context.Context, io.Writer, bool, manifest.ManifestList) error {
|
| 213 |
+
+func (m *mockDeployer) Cleanup(context.Context, io.Writer, bool, *manifest.ManifestListByConfig) error {
|
| 214 |
+
if m.err {
|
| 215 |
+
return errors.New("Unable to cleanup")
|
| 216 |
+
}
|
| 217 |
+
diff --git a/pkg/skaffold/runner/v2/runner_test.go b/pkg/skaffold/runner/v2/runner_test.go
|
| 218 |
+
index 5c16cc9a4a2..07feabdce96 100644
|
| 219 |
+
--- a/pkg/skaffold/runner/v2/runner_test.go
|
| 220 |
+
+++ b/pkg/skaffold/runner/v2/runner_test.go
|
| 221 |
+
@@ -143,7 +143,7 @@ func (t *TestBench) TestDependencies(context.Context, *latest.Artifact) ([]strin
|
| 222 |
+
return nil, nil
|
| 223 |
+
}
|
| 224 |
+
func (t *TestBench) Dependencies() ([]string, error) { return nil, nil }
|
| 225 |
+
-func (t *TestBench) Cleanup(ctx context.Context, out io.Writer, dryRun bool, list manifest.ManifestList) error {
|
| 226 |
+
+func (t *TestBench) Cleanup(ctx context.Context, out io.Writer, dryRun bool, byConfig *manifest.ManifestListByConfig) error {
|
| 227 |
+
return nil
|
| 228 |
+
}
|
| 229 |
+
func (t *TestBench) Prune(ctx context.Context, out io.Writer) error { return nil }
|
| 230 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 231 |
+
new file mode 100644
|
| 232 |
+
--- /dev/null
|
| 233 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 234 |
+
@@ -0,0 +1,8 @@
|
| 235 |
+
+H4sIAAAAAAAAA+3Tz2vCMBQH8J77VwR3tr+0etpBlI0xtsPwLrF5xmJMSn64DfbHL3YbrcLmBGXI
|
| 236 |
+
+3ufS8Ey+ffTFaO5KwWYgN3FwLok3zPP66e0/63WaZ0k26CXDfhokaTpI0oDkZ+uoxRlLNSGBVsr+
|
| 237 |
+
+tO/Q7xcqauZvwdhZodZrKllklqd7x4H5p1mvmf8gz/z8+4M0C0hyuha+98/nXzBSD34OLAwNWNKF
|
| 238 |
+
+MLwiT04SKgTx34b7opOlJdttJuSqXpDuhnQL5aS9TkkUF2sWmxVdLJRgMa2qukC62sd0pn77RE1g
|
| 239 |
+
+8/a1EmCh0ySZpdL7gaW0wDW1pZI7Oftndw5VK950waAS6jUuhHLMn2+njAVQ6apjYnZ62FZAP7iX
|
| 240 |
+
+YxJWbg6FFe2k+4/SMe1okAx0zEGC/zrQTrv9rP0ux0m/u318Wq5Lyc0xpzdZO+ARnm+UHiu5KHk9
|
| 241 |
+
+6qkuOQc99hdpTovVSLI7P1Vp/TtCKJaKdEbNFatvF6moMcCiTvjX/wuEEEIIIYQQQgghhBBCCCGE
|
| 242 |
+
+EEIIoUvxDiMpN/EAKAAA
|
| 243 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 244 |
+
new file mode 100755
|
| 245 |
+
--- /dev/null
|
| 246 |
+
+++ b/mimo_test_command.sh
|
| 247 |
+
@@ -0,0 +1,6 @@
|
| 248 |
+
+#!/usr/bin/env bash
|
| 249 |
+
+
|
| 250 |
+
+set -uo pipefail
|
| 251 |
+
+cd /testbed || exit 1
|
| 252 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 253 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000109/tests/test.sh
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
cmd/skaffold/app/cmd/dev_test.go
|
| 25 |
+
integration/delete_test.go
|
| 26 |
+
pkg/skaffold/deploy/cloudrun/deploy_test.go
|
| 27 |
+
pkg/skaffold/deploy/deploy_mux_test.go
|
| 28 |
+
pkg/skaffold/deploy/kubectl/kubectl_test.go
|
| 29 |
+
pkg/skaffold/render/generate/generate_test.go
|
| 30 |
+
pkg/skaffold/runner/timings_test.go
|
| 31 |
+
pkg/skaffold/runner/v2/runner_test.go
|
| 32 |
+
mimo_build_env.tar.gz.b64
|
| 33 |
+
mimo_test_command.sh
|
| 34 |
+
EOF_RESET_TEST_FILES
|
| 35 |
+
|
| 36 |
+
); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
|
| 37 |
+
if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
|
| 38 |
+
cat "$V/apply.log" >&2
|
| 39 |
+
echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
|
| 40 |
+
exit 1
|
| 41 |
+
fi
|
| 42 |
+
timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
|
| 43 |
+
RC=$?
|
| 44 |
+
tail -c 12000 "$V/test_output.log"
|
| 45 |
+
if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
|
| 46 |
+
echo "test command exited $RC"
|
tasks/format-code-task-000109/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000131/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:5477d554b0339de5d9615aad38b27e8acc8607a7de0fa3419aaf6fcfb6e69d95
|
tasks/format-code-task-000131/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-000131/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-000131/tests/test.patch
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/test/services/katello/candlepin/consumer_test.rb b/test/services/katello/candlepin/consumer_test.rb
|
| 2 |
+
index c746b0766e7..478d13628cf 100644
|
| 3 |
+
--- a/test/services/katello/candlepin/consumer_test.rb
|
| 4 |
+
+++ b/test/services/katello/candlepin/consumer_test.rb
|
| 5 |
+
@@ -57,6 +57,8 @@ def test_distribution_to_puppet_os
|
| 6 |
+
assert_equal 'CentOS', Candlepin::Consumer.distribution_to_puppet_os('CentOS')
|
| 7 |
+
assert_equal 'CentOS', Candlepin::Consumer.distribution_to_puppet_os('centosGood')
|
| 8 |
+
|
| 9 |
+
+ assert_equal 'SLES', Candlepin::Consumer.distribution_to_puppet_os('SLES')
|
| 10 |
+
+ assert_equal 'SLES', Candlepin::Consumer.distribution_to_puppet_os('SUSE Linux Enterprise Server')
|
| 11 |
+
assert_equal nil, Candlepin::Consumer.distribution_to_puppet_os('RedHot')
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
|
| 15 |
+
new file mode 100644
|
| 16 |
+
--- /dev/null
|
| 17 |
+
+++ b/mimo_build_env.tar.gz.b64
|
| 18 |
+
@@ -0,0 +1,32 @@
|
| 19 |
+
+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
|
| 50 |
+
+T3mbmriBDWxgA98T/AWeY57aACgAAA==
|
| 51 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 52 |
+
new file mode 100755
|
| 53 |
+
--- /dev/null
|
| 54 |
+
+++ b/mimo_test_command.sh
|
| 55 |
+
@@ -0,0 +1,6 @@
|
| 56 |
+
+#!/usr/bin/env bash
|
| 57 |
+
+
|
| 58 |
+
+set -uo pipefail
|
| 59 |
+
+cd /testbed || exit 1
|
| 60 |
+
+base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
|
| 61 |
+
+exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
|
tasks/format-code-task-000131/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/services/katello/candlepin/consumer_test.rb
|
| 25 |
+
mimo_build_env.tar.gz.b64
|
| 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-000131/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000136/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:3ad9131f66172e4fa5bd09c87b3308185738ca59575717ec1978cd414f60736a
|
tasks/format-code-task-000136/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-000136/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-000136/tests/test.patch
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/controllers/auth_config_controller_anonymous_test.go b/controllers/auth_config_controller_anonymous_test.go
|
| 2 |
+
new file mode 100644
|
| 3 |
+
index 00000000..0920ab94
|
| 4 |
+
--- /dev/null
|
| 5 |
+
+++ b/controllers/auth_config_controller_anonymous_test.go
|
| 6 |
+
@@ -0,0 +1,181 @@
|
| 7 |
+
+package controllers
|
| 8 |
+
+
|
| 9 |
+
+import (
|
| 10 |
+
+ "context"
|
| 11 |
+
+ "testing"
|
| 12 |
+
+
|
| 13 |
+
+ api "github.com/kuadrant/authorino/api/v1beta1"
|
| 14 |
+
+ "github.com/kuadrant/authorino/pkg/evaluators"
|
| 15 |
+
+ identity_evaluators "github.com/kuadrant/authorino/pkg/evaluators/identity"
|
| 16 |
+
+ mock_cache "github.com/kuadrant/authorino/pkg/cache/mocks"
|
| 17 |
+
+
|
| 18 |
+
+ "github.com/golang/mock/gomock"
|
| 19 |
+
+ "gotest.tools/assert"
|
| 20 |
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 21 |
+
+ "k8s.io/apimachinery/pkg/types"
|
| 22 |
+
+ "sigs.k8s.io/controller-runtime/pkg/reconcile"
|
| 23 |
+
+)
|
| 24 |
+
+
|
| 25 |
+
+
|
| 26 |
+
+func newTestAuthConfigNoIdentity() api.AuthConfig {
|
| 27 |
+
+ return api.AuthConfig{
|
| 28 |
+
+ TypeMeta: metav1.TypeMeta{
|
| 29 |
+
+ Kind: "AuthConfig",
|
| 30 |
+
+ APIVersion: "authorino.kuadrant.io/v1beta1",
|
| 31 |
+
+ },
|
| 32 |
+
+ ObjectMeta: metav1.ObjectMeta{
|
| 33 |
+
+ Name: "auth-config-anon",
|
| 34 |
+
+ Namespace: "authorino",
|
| 35 |
+
+ },
|
| 36 |
+
+ Spec: api.AuthConfigSpec{
|
| 37 |
+
+ Hosts: []string{"echo-api-anon"},
|
| 38 |
+
+ Identity: nil,
|
| 39 |
+
+ },
|
| 40 |
+
+ }
|
| 41 |
+
+}
|
| 42 |
+
+
|
| 43 |
+
+
|
| 44 |
+
+func newTestAuthConfigSingleAPIKey() api.AuthConfig {
|
| 45 |
+
+ return api.AuthConfig{
|
| 46 |
+
+ TypeMeta: metav1.TypeMeta{
|
| 47 |
+
+ Kind: "AuthConfig",
|
| 48 |
+
+ APIVersion: "authorino.kuadrant.io/v1beta1",
|
| 49 |
+
+ },
|
| 50 |
+
+ ObjectMeta: metav1.ObjectMeta{
|
| 51 |
+
+ Name: "auth-config-apikey",
|
| 52 |
+
+ Namespace: "authorino",
|
| 53 |
+
+ },
|
| 54 |
+
+ Spec: api.AuthConfigSpec{
|
| 55 |
+
+ Hosts: []string{"echo-api-apikey"},
|
| 56 |
+
+ Identity: []*api.Identity{
|
| 57 |
+
+ {
|
| 58 |
+
+ Name: "my-api-key",
|
| 59 |
+
+ APIKey: &api.Identity_APIKey{
|
| 60 |
+
+ LabelSelectors: map[string]string{"group": "friends"},
|
| 61 |
+
+ },
|
| 62 |
+
+ },
|
| 63 |
+
+ },
|
| 64 |
+
+ },
|
| 65 |
+
+ }
|
| 66 |
+
+}
|
| 67 |
+
+
|
| 68 |
+
+
|
| 69 |
+
+
|
| 70 |
+
+
|
| 71 |
+
+func TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous(t *testing.T) {
|
| 72 |
+
+ mockController := gomock.NewController(t)
|
| 73 |
+
+ defer mockController.Finish()
|
| 74 |
+
+ cacheMock := mock_cache.NewMockCache(mockController)
|
| 75 |
+
+
|
| 76 |
+
+ authConfig := newTestAuthConfigNoIdentity()
|
| 77 |
+
+ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace}
|
| 78 |
+
+ client := newTestK8sClient(&authConfig)
|
| 79 |
+
+ reconciler := newTestAuthConfigReconciler(client, cacheMock)
|
| 80 |
+
+
|
| 81 |
+
+ var captured evaluators.AuthConfig
|
| 82 |
+
+ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{})
|
| 83 |
+
+ cacheMock.EXPECT().FindId("echo-api-anon").Return("", false)
|
| 84 |
+
+ cacheMock.EXPECT().Set(
|
| 85 |
+
+ "authorino/auth-config-anon",
|
| 86 |
+
+ "echo-api-anon",
|
| 87 |
+
+ gomock.Any(),
|
| 88 |
+
+ true,
|
| 89 |
+
+ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) {
|
| 90 |
+
+ captured = cfg
|
| 91 |
+
+ }).Return(nil)
|
| 92 |
+
+
|
| 93 |
+
+ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName})
|
| 94 |
+
+ assert.NilError(t, err)
|
| 95 |
+
+
|
| 96 |
+
+
|
| 97 |
+
+ assert.Equal(t, 1, len(captured.IdentityConfigs), "expected one default identity config to be added")
|
| 98 |
+
+
|
| 99 |
+
+ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig)
|
| 100 |
+
+ assert.Assert(t, ok, "expected *evaluators.IdentityConfig as the default identity entry")
|
| 101 |
+
+ assert.Equal(t, "anonymous", idCfg.Name)
|
| 102 |
+
+ assert.Assert(t, idCfg.Noop != nil, "expected the default identity config to be of Noop type")
|
| 103 |
+
+
|
| 104 |
+
+ assert.Assert(t, idCfg.OAuth2 == nil)
|
| 105 |
+
+ assert.Assert(t, idCfg.OIDC == nil)
|
| 106 |
+
+ assert.Assert(t, idCfg.APIKey == nil)
|
| 107 |
+
+ assert.Assert(t, idCfg.KubernetesAuth == nil)
|
| 108 |
+
+ assert.Assert(t, idCfg.MTLS == nil)
|
| 109 |
+
+ assert.Assert(t, idCfg.HMAC == nil)
|
| 110 |
+
+}
|
| 111 |
+
+
|
| 112 |
+
+
|
| 113 |
+
+
|
| 114 |
+
+
|
| 115 |
+
+func TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator(t *testing.T) {
|
| 116 |
+
+ mockController := gomock.NewController(t)
|
| 117 |
+
+ defer mockController.Finish()
|
| 118 |
+
+ cacheMock := mock_cache.NewMockCache(mockController)
|
| 119 |
+
+
|
| 120 |
+
+ authConfig := newTestAuthConfigNoIdentity()
|
| 121 |
+
+ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace}
|
| 122 |
+
+ client := newTestK8sClient(&authConfig)
|
| 123 |
+
+ reconciler := newTestAuthConfigReconciler(client, cacheMock)
|
| 124 |
+
+
|
| 125 |
+
+ var captured evaluators.AuthConfig
|
| 126 |
+
+ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{})
|
| 127 |
+
+ cacheMock.EXPECT().FindId("echo-api-anon").Return("", false)
|
| 128 |
+
+ cacheMock.EXPECT().Set(
|
| 129 |
+
+ "authorino/auth-config-anon",
|
| 130 |
+
+ "echo-api-anon",
|
| 131 |
+
+ gomock.Any(),
|
| 132 |
+
+ true,
|
| 133 |
+
+ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) {
|
| 134 |
+
+ captured = cfg
|
| 135 |
+
+ }).Return(nil)
|
| 136 |
+
+
|
| 137 |
+
+ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName})
|
| 138 |
+
+ assert.NilError(t, err)
|
| 139 |
+
+
|
| 140 |
+
+ assert.Equal(t, 1, len(captured.IdentityConfigs))
|
| 141 |
+
+
|
| 142 |
+
+ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig)
|
| 143 |
+
+ assert.Assert(t, ok)
|
| 144 |
+
+
|
| 145 |
+
+
|
| 146 |
+
+ evaluator := idCfg.GetAuthConfigEvaluator()
|
| 147 |
+
+ assert.Assert(t, evaluator != nil, "expected a non-nil evaluator for the anonymous identity")
|
| 148 |
+
+ noop, ok := evaluator.(*identity_evaluators.Noop)
|
| 149 |
+
+ assert.Assert(t, ok, "expected the default identity evaluator to be of *identity.Noop type")
|
| 150 |
+
+ assert.Assert(t, noop == idCfg.Noop, "evaluator should be the same Noop instance as IdentityConfig.Noop")
|
| 151 |
+
+}
|
| 152 |
+
+
|
| 153 |
+
+
|
| 154 |
+
+
|
| 155 |
+
+func TestReconcileAuthConfigSingleIdentityNotOverridden(t *testing.T) {
|
| 156 |
+
+ mockController := gomock.NewController(t)
|
| 157 |
+
+ defer mockController.Finish()
|
| 158 |
+
+ cacheMock := mock_cache.NewMockCache(mockController)
|
| 159 |
+
+
|
| 160 |
+
+ authConfig := newTestAuthConfigSingleAPIKey()
|
| 161 |
+
+ authConfigName := types.NamespacedName{Name: authConfig.Name, Namespace: authConfig.Namespace}
|
| 162 |
+
+ client := newTestK8sClient(&authConfig)
|
| 163 |
+
+ reconciler := newTestAuthConfigReconciler(client, cacheMock)
|
| 164 |
+
+
|
| 165 |
+
+ var captured evaluators.AuthConfig
|
| 166 |
+
+ cacheMock.EXPECT().FindKeys(authConfigName.String()).Return([]string{})
|
| 167 |
+
+ cacheMock.EXPECT().FindId("echo-api-apikey").Return("", false)
|
| 168 |
+
+ cacheMock.EXPECT().Set(
|
| 169 |
+
+ "authorino/auth-config-apikey",
|
| 170 |
+
+ "echo-api-apikey",
|
| 171 |
+
+ gomock.Any(),
|
| 172 |
+
+ true,
|
| 173 |
+
+ ).Do(func(_ string, _ string, cfg evaluators.AuthConfig, _ bool) {
|
| 174 |
+
+ captured = cfg
|
| 175 |
+
+ }).Return(nil)
|
| 176 |
+
+
|
| 177 |
+
+ _, err := reconciler.Reconcile(context.Background(), reconcile.Request{NamespacedName: authConfigName})
|
| 178 |
+
+ assert.NilError(t, err)
|
| 179 |
+
+
|
| 180 |
+
+
|
| 181 |
+
+ assert.Equal(t, 1, len(captured.IdentityConfigs), "expected exactly the user-declared identity")
|
| 182 |
+
+ idCfg, ok := captured.IdentityConfigs[0].(*evaluators.IdentityConfig)
|
| 183 |
+
+ assert.Assert(t, ok)
|
| 184 |
+
+ assert.Equal(t, "my-api-key", idCfg.Name)
|
| 185 |
+
+ assert.Assert(t, idCfg.APIKey != nil, "expected APIKey identity to be preserved")
|
| 186 |
+
+ assert.Assert(t, idCfg.Noop == nil, "anonymous Noop must NOT be injected when explicit identity is present")
|
| 187 |
+
+}
|
| 188 |
+
diff --git a/test_commands.json b/test_commands.json
|
| 189 |
+
new file mode 100644
|
| 190 |
+
index 00000000..d618d4ac
|
| 191 |
+
--- /dev/null
|
| 192 |
+
+++ b/test_commands.json
|
| 193 |
+
@@ -0,0 +1,3 @@
|
| 194 |
+
+{
|
| 195 |
+
+ "test_commands": ["go test ./controllers/ -run 'TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous|TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator|TestReconcileAuthConfigSingleIdentityNotOverridden' -v"]
|
| 196 |
+
+}
|
| 197 |
+
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
|
| 198 |
+
new file mode 100755
|
| 199 |
+
--- /dev/null
|
| 200 |
+
+++ b/mimo_test_command.sh
|
| 201 |
+
@@ -0,0 +1,8 @@
|
| 202 |
+
+#!/usr/bin/env bash
|
| 203 |
+
+
|
| 204 |
+
+set -uo pipefail
|
| 205 |
+
+cd /testbed
|
| 206 |
+
+rc=0
|
| 207 |
+
+go test ./controllers/ -run 'TestReconcileAuthConfigEmptyIdentityDefaultsAnonymous|TestReconcileAuthConfigEmptyIdentityProducesNoopEvaluator|TestReconcileAuthConfigSingleIdentityNotOverridden' -v
|
| 208 |
+
+rc=$(( rc | $? ))
|
| 209 |
+
+exit $rc
|
tasks/format-code-task-000136/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 |
+
controllers/auth_config_controller_anonymous_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-000136/tests/test_command.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
bash /testbed/mimo_test_command.sh
|
tasks/format-code-task-000138/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:5c57f605279e5fe67f1cef2c7cf5bd677b92d483bc56b9b26341b185c9968249
|
tasks/format-code-task-000138/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
|