wangbaoyi commited on
Commit
25c0381
·
verified ·
1 Parent(s): ebc3140

Copy WideSWE dataset from wwww369/WIDESWE

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. README.md +48 -0
  3. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/Dockerfile.case-base +537 -0
  4. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/repo_envs.tsv +2 -0
  5. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/run_profile_inside.sh +8 -0
  6. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-dify-pytest.sh +8 -0
  7. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-go-redis-test.sh +17 -0
  8. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-go-test.sh +11 -0
  9. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-ioredis-tsd.sh +9 -0
  10. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-jest.sh +14 -0
  11. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-maven-test.sh +25 -0
  12. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-node-redis-mocha.sh +17 -0
  13. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-phpunit.sh +16 -0
  14. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-redis-pytest.sh +15 -0
  15. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-redis-server-test.sh +7 -0
  16. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-webpack-jest.sh +13 -0
  17. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/deps_image_lock.yaml +12 -0
  18. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/paddle-paconvert-py312.Dockerfile +10 -0
  19. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/run_profile.sh +140 -0
  20. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/test_profiles.yaml +17 -0
  21. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/metadata.yaml +18 -0
  22. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/patches/PaConvert.patch +28 -0
  23. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/patches/Paddle.patch +208 -0
  24. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/harness.yaml +33 -0
  25. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/hidden/patches/PaConvert-hidden-tests.patch +120 -0
  26. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/hidden/patches/Paddle-hidden-tests.patch +234 -0
  27. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/oracles/hidden_test_oracle.json +409 -0
  28. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/oracles/scoring_manifest.json +247 -0
  29. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/prompt.md +7 -0
  30. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/repos.yaml +36 -0
  31. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/task.yaml +41 -0
  32. cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/validation.yaml +25 -0
  33. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/ansible-aap-cost-py.Dockerfile +11 -0
  34. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/Dockerfile.case-base +539 -0
  35. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/repo_envs.tsv +2 -0
  36. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/run_profile_inside.sh +8 -0
  37. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-dify-pytest.sh +8 -0
  38. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-go-redis-test.sh +17 -0
  39. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-go-test.sh +11 -0
  40. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-ioredis-tsd.sh +9 -0
  41. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-jest.sh +14 -0
  42. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-maven-test.sh +25 -0
  43. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-node-redis-mocha.sh +17 -0
  44. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-phpunit.sh +16 -0
  45. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-redis-pytest.sh +15 -0
  46. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-redis-server-test.sh +7 -0
  47. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-webpack-jest.sh +13 -0
  48. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/deps_image_lock.yaml +12 -0
  49. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/docker-compose.yml +19 -0
  50. cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/run_profile.sh +175 -0
.gitattributes CHANGED
@@ -58,3 +58,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ cases/docker/docker_actions_toolkit_bake_action_build_push_action_b58918c90001/gold/patches/bake-action.patch filter=lfs diff=lfs merge=lfs -text
62
+ cases/docker/docker_actions_toolkit_bake_action_build_push_action_b58918c90001/gold/patches/build-push-action.patch filter=lfs diff=lfs merge=lfs -text
63
+ cases/docker/docker_actions_toolkit_metadata_action_8c65d8d37a2e/gold/patches/metadata-action.patch filter=lfs diff=lfs merge=lfs -text
64
+ cases/elastic/elastic_kibana_package_spec_264fe9f9020d/gold/patches/kibana.patch filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: WIDESWE Release120
3
+ language:
4
+ - en
5
+ license: other
6
+ task_categories:
7
+ - text-generation
8
+ tags:
9
+ - software-engineering
10
+ - code-agents
11
+ - multi-repository
12
+ - benchmark
13
+ ---
14
+
15
+ # WIDESWE Release120
16
+
17
+ WIDESWE Release120 is a benchmark of 120 software-engineering tasks whose
18
+ solutions may span multiple repositories. Each task pins the participating
19
+ repositories and revisions, provides one shared issue-style prompt, and ships
20
+ the environment and evaluation definitions needed by the benchmark harness.
21
+
22
+ ## Contents
23
+
24
+ `release120.tsv` is the canonical task index. Each task is stored at
25
+ `cases/<ecosystem>/<case_id>/` and contains:
26
+
27
+ - `prompt.md`: the task prompt shown to the agent.
28
+ - `repos.yaml`: participating repositories and pinned revisions.
29
+ - `task.yaml`, `harness.yaml`, and `validation.yaml`: task and evaluation
30
+ configuration.
31
+ - `environment/`: Dockerfiles, dependency locks, test profiles, and runtime
32
+ helpers.
33
+ - `gold/metadata.yaml` and `gold/patches/`: reference implementation metadata
34
+ and per-repository patches.
35
+ - `hidden/patches/`: evaluator tests applied during scoring.
36
+ - `oracles/`: hidden-test expectations and scoring manifests.
37
+
38
+ Repository source trees, container images, dependency caches, agent
39
+ trajectories, and experimental outputs are intentionally not included. The
40
+ source trees can be reconstructed from the remotes and revisions in each
41
+ `repos.yaml` file.
42
+
43
+ ## Licensing
44
+
45
+ Repository-derived patches and tests remain subject to the licenses of their
46
+ respective upstream repositories. Benchmark metadata and harness code may have
47
+ separate licensing terms in the accompanying code release. Users are
48
+ responsible for complying with all applicable upstream licenses.
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/Dockerfile.case-base ADDED
@@ -0,0 +1,537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends git libnss-wrapper python3 python3-venv python3-yaml \
5
+ && rm -rf /var/lib/apt/lists/*
6
+ ENV PATH=/usr/local/cargo/bin:/usr/local/go/bin:/opt/java/openjdk/bin:/opt/maven/bin:/usr/share/maven/bin:/opt/gradle/bin:/usr/share/gradle/bin:${PATH}
7
+ RUN cat > /etc/profile.d/ecosync-tools.sh <<'SH'
8
+ _ecosync_setup_user_env() {
9
+ if getent passwd "$(id -u)" >/dev/null 2>&1; then
10
+ return 0
11
+ fi
12
+ local nss_wrapper candidate
13
+ nss_wrapper=
14
+ for candidate in /usr/lib/*/libnss_wrapper.so /usr/lib/libnss_wrapper.so; do
15
+ if [ -f "$candidate" ]; then nss_wrapper="$candidate"; break; fi
16
+ done
17
+ [ -n "$nss_wrapper" ] || return 0
18
+ export NSS_WRAPPER_PASSWD="${NSS_WRAPPER_PASSWD:-/tmp/ecosync-passwd-$(id -u)}"
19
+ export NSS_WRAPPER_GROUP="${NSS_WRAPPER_GROUP:-/tmp/ecosync-group-$(id -g)}"
20
+ if [ ! -f "$NSS_WRAPPER_PASSWD" ]; then
21
+ printf 'ecosync:x:%s:%s:EcoSync user:%s:/bin/bash\n' "$(id -u)" "$(id -g)" "${HOME:-/tmp/ecosync-home}" > "$NSS_WRAPPER_PASSWD" 2>/dev/null || return 0
22
+ fi
23
+ if [ ! -f "$NSS_WRAPPER_GROUP" ]; then
24
+ printf 'ecosync:x:%s:\n' "$(id -g)" > "$NSS_WRAPPER_GROUP" 2>/dev/null || return 0
25
+ fi
26
+ case ":${LD_PRELOAD:-}:" in
27
+ *":$nss_wrapper:"*) ;;
28
+ *) export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}$nss_wrapper" ;;
29
+ esac
30
+ }
31
+ case "${HOME:-}" in
32
+ ''|/|/root|/root/*) export HOME="${ECOSYNC_HOME:-${ECOSYNC_WORKSPACE:-/tmp/ecosync-workspace}/.ecosyncbench/home}" ;;
33
+ esac
34
+ mkdir -p "$HOME" 2>/dev/null || true
35
+ chmod 0777 "$HOME" 2>/dev/null || true
36
+ _ecosync_setup_user_env
37
+ _ecosync_prepend_path() {
38
+ case ":$PATH:" in
39
+ *":$1:"*) ;;
40
+ *) [ -d "$1" ] && PATH="$1:$PATH" ;;
41
+ esac
42
+ return 0
43
+ }
44
+ _ecosync_append_path() {
45
+ case ":$PATH:" in
46
+ *":$1:"*) ;;
47
+ *) [ -d "$1" ] && PATH="$PATH:$1" ;;
48
+ esac
49
+ return 0
50
+ }
51
+ _ecosync_prepend_path /usr/local/go/bin
52
+ _ecosync_prepend_path /usr/local/cargo/bin
53
+ _ecosync_prepend_path /opt/java/openjdk/bin
54
+ _ecosync_prepend_path /opt/maven/bin
55
+ _ecosync_prepend_path /usr/share/maven/bin
56
+ _ecosync_prepend_path /opt/gradle/bin
57
+ _ecosync_prepend_path /usr/share/gradle/bin
58
+ _ecosync_prepend_path /opt/ecosync/agents/swe-python/bin
59
+ _ecosync_prepend_path /opt/SWE-agent/.venv/bin
60
+ _ecosync_prepend_path /opt/ecosync/shims
61
+ export PATH
62
+ export CARGO_HOME="${CARGO_HOME:-/usr/local/cargo}"
63
+ export RUSTUP_HOME="${RUSTUP_HOME:-/usr/local/rustup}"
64
+ if [ -z "${JAVA_HOME:-}" ] && [ -d /opt/java/openjdk ]; then export JAVA_HOME=/opt/java/openjdk; fi
65
+ if [ -z "${JAVA_HOME:-}" ] && [ -d /usr/lib/jvm ]; then
66
+ _ecosync_java_home="$(find /usr/lib/jvm -maxdepth 2 -type f -path '*/bin/java' -print -quit 2>/dev/null || true)"
67
+ [ -z "$_ecosync_java_home" ] || export JAVA_HOME="$(dirname "$(dirname "$_ecosync_java_home")")"
68
+ fi
69
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-${ECOSYNC_WORKSPACE:-/tmp/ecosync-workspace}/.ecosyncbench/cache}"
70
+ export CI="${CI:-true}"
71
+ export COREPACK_ENABLE_DOWNLOAD_PROMPT="${COREPACK_ENABLE_DOWNLOAD_PROMPT:-0}"
72
+ export npm_config_yes="${npm_config_yes:-true}"
73
+ case "${DOTNET_CLI_HOME:-}" in
74
+ ''|/root|/root/*|/opt/ecosync/*) export DOTNET_CLI_HOME="$ECOSYNC_CACHE_ROOT/dotnet-home" ;;
75
+ esac
76
+ case "${NUGET_PACKAGES:-}" in
77
+ ''|/root|/root/*|/opt/ecosync/*) export NUGET_PACKAGES="$ECOSYNC_CACHE_ROOT/nuget/" ;;
78
+ esac
79
+ case "$NUGET_PACKAGES" in
80
+ */) ;;
81
+ *) export NUGET_PACKAGES="$NUGET_PACKAGES/" ;;
82
+ esac
83
+ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE="${DOTNET_SKIP_FIRST_TIME_EXPERIENCE:-1}"
84
+ export DOTNET_CLI_TELEMETRY_OPTOUT="${DOTNET_CLI_TELEMETRY_OPTOUT:-1}"
85
+ mkdir -p "$DOTNET_CLI_HOME" "$NUGET_PACKAGES" 2>/dev/null || true
86
+ chmod 0777 "$DOTNET_CLI_HOME" "$NUGET_PACKAGES" 2>/dev/null || true
87
+ mkdir -p "$ECOSYNC_CACHE_ROOT/go/pkg/mod" "$ECOSYNC_CACHE_ROOT/go/path" /tmp/ecosync-gocache 2>/dev/null || true
88
+ chmod 0777 "$ECOSYNC_CACHE_ROOT/go/pkg/mod" "$ECOSYNC_CACHE_ROOT/go/path" /tmp/ecosync-gocache 2>/dev/null || true
89
+ export GOMODCACHE="${GOMODCACHE:-$ECOSYNC_CACHE_ROOT/go/pkg/mod}"
90
+ export GOPATH="${GOPATH:-$ECOSYNC_CACHE_ROOT/go/path}"
91
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
92
+ case "${GRADLE_USER_HOME:-}" in
93
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
94
+ esac
95
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
96
+ if [ -d /ecosync-scratch ]; then
97
+ export COMPOSER_HOME="${ECOSYNC_COMPOSER_HOME:-/ecosync-scratch/cache/composer}"
98
+ elif [ -z "${COMPOSER_HOME:-}" ] || [ "${COMPOSER_HOME:-}" = /tmp/composer ]; then
99
+ export COMPOSER_HOME=/tmp/ecosync-composer-home
100
+ fi
101
+ mkdir -p "$(dirname "$COMPOSER_HOME")" "$COMPOSER_HOME" 2>/dev/null || true
102
+ chmod 0777 "$(dirname "$COMPOSER_HOME")" "$COMPOSER_HOME" 2>/dev/null || true
103
+ export MAVEN_OPTS="-Dmaven.repo.local=/opt/ecosync/m2 ${MAVEN_OPTS:-}"
104
+ _ecosync_select_deps_root_for_cwd() {
105
+ local workspace repo_envs cwd rel root repo_abs
106
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
107
+ repo_envs="${ECOSYNC_REPO_ENVS:-/opt/ecosync/repo-envs.tsv}"
108
+ cwd="${PWD:-$(pwd -L)}"
109
+ [ -r "$repo_envs" ] || return 1
110
+ while IFS=$'\t' read -r rel root; do
111
+ [ -n "${rel:-}" ] && [ -n "${root:-}" ] || continue
112
+ repo_abs="$workspace/$rel"
113
+ case "$cwd" in
114
+ "$repo_abs"|"$repo_abs"/*) printf '%s\n' "$root"; return 0 ;;
115
+ esac
116
+ done < "$repo_envs"
117
+ return 1
118
+ }
119
+ _ecosync_setup_repo_env() {
120
+ local root="$1" workspace
121
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
122
+ [ -d "$root" ] || return 0
123
+ export ECOSYNC_DEPS_ROOT="$root"
124
+ if [ -d "$root/gomodcache" ] && [ -w "$root/gomodcache" ]; then export GOMODCACHE="$root/gomodcache"; else export GOMODCACHE="$ECOSYNC_CACHE_ROOT/go/pkg/mod"; fi
125
+ if [ -d "$root/gopath" ] && [ -w "$root/gopath" ]; then export GOPATH="$root/gopath"; else export GOPATH="$ECOSYNC_CACHE_ROOT/go/path"; fi
126
+ mkdir -p "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
127
+ chmod 0777 "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
128
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
129
+ export MAVEN_OPTS="-Dmaven.repo.local=$root/m2 ${MAVEN_OPTS:-}"
130
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-$workspace/.ecosyncbench/cache}"
131
+ case "${GRADLE_USER_HOME:-}" in
132
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
133
+ esac
134
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
135
+ if [ -d "$root/composer/home" ]; then export COMPOSER_HOME="$root/composer/home"; else export COMPOSER_HOME="${COMPOSER_HOME:-$root/composer-home}"; fi
136
+ if [ -d "$root/composer/cache" ]; then export COMPOSER_CACHE_DIR="$root/composer/cache"; fi
137
+ if [ -d "$root/usr-local-bin" ]; then _ecosync_append_path "$root/usr-local-bin"; fi
138
+ if [ -d "$root/usr-local-lib" ]; then export LD_LIBRARY_PATH="$root/usr-local-lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
139
+ if [ -d "$root/usr-local-cargo/bin" ]; then _ecosync_prepend_path "$root/usr-local-cargo/bin"; export CARGO_HOME="$root/usr-local-cargo"; fi
140
+ if [ -d "$root/usr-local-rustup" ]; then export RUSTUP_HOME="$root/usr-local-rustup"; fi
141
+ if [ -n "${RUSTUP_HOME:-}" ] && [ -d "$RUSTUP_HOME/toolchains" ]; then
142
+ if [ -n "${RUSTUP_TOOLCHAIN:-}" ] && [ ! -d "$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN" ]; then unset RUSTUP_TOOLCHAIN; fi
143
+ if [ -z "${RUSTUP_TOOLCHAIN:-}" ]; then installed_toolchain="$(find "$RUSTUP_HOME/toolchains" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null | sort -Vr | head -1 || true)"; [ -z "$installed_toolchain" ] || export RUSTUP_TOOLCHAIN="$installed_toolchain"; fi
144
+ if [ -n "${RUSTUP_TOOLCHAIN:-}" ]; then export ECOSYNC_RUST_TOOLCHAIN_DIR="$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN"; fi
145
+ fi
146
+ if [ -d "$root/php-libs" ]; then export LD_LIBRARY_PATH="$root/php-libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
147
+ if [ -d "$root/usr-local-etc/php" ]; then export PHPRC="$root/usr-local-etc/php"; export PHP_INI_SCAN_DIR="$root/usr-local-etc/php/conf.d${PHP_INI_SCAN_DIR:+:$PHP_INI_SCAN_DIR}"; fi
148
+ unset PYTHONHOME
149
+ if [ -d "$root/usr-local/lib" ] && [ -x "$root/usr-local-bin/python" ]; then export PYTHONHOME="$root/usr-local"; fi
150
+ if [ -d "$root/usr-local-bundle" ]; then export GEM_HOME="$root/usr-local-bundle"; export BUNDLE_PATH="$root/usr-local-bundle"; export BUNDLE_APP_CONFIG="$root/usr-local-bundle"; fi
151
+ if [ -d "$root/node-runtime/bin" ]; then _ecosync_append_path "$root/node-runtime/bin"; export ECOSYNC_NODE_RUNTIME_ROOT="$root/node-runtime"; fi
152
+ if [ -d "$root/node-runtime/lib/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/node-runtime/lib/node_modules"; fi
153
+ if [ -d "$PWD/node_modules/.bin" ]; then _ecosync_prepend_path "$PWD/node_modules/.bin"; fi
154
+ if [ -d "$root/pnpm" ]; then _ecosync_prepend_path "$root/pnpm"; export PNPM_HOME="${PNPM_HOME:-$root/pnpm}"; fi
155
+ if [ -d "$root/pnpm-store" ]; then export PNPM_STORE_DIR="${PNPM_STORE_DIR:-$root/pnpm-store}"; export pnpm_config_store_dir="${pnpm_config_store_dir:-$root/pnpm-store}"; export npm_config_store_dir="${npm_config_store_dir:-$root/pnpm-store}"; export NPM_CONFIG_STORE_DIR="${NPM_CONFIG_STORE_DIR:-$root/pnpm-store}"; fi
156
+ if [ -d "$root/corepack" ]; then export COREPACK_HOME="${COREPACK_HOME:-$root/corepack}"; fi
157
+ if [ -d "$root/xdg" ]; then export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$root/xdg}"; export XDG_DATA_HOME="${XDG_DATA_HOME:-$root/xdg}"; fi
158
+ if [ -d "$root/global" ]; then export YARN_ENABLE_GLOBAL_CACHE="${YARN_ENABLE_GLOBAL_CACHE:-true}"; export YARN_GLOBAL_FOLDER="${YARN_GLOBAL_FOLDER:-$root/global}"; fi
159
+ if [ -d "$root/cache" ]; then export YARN_CACHE_FOLDER="${YARN_CACHE_FOLDER:-$root/cache}"; fi
160
+ if [ -d "$root/deps/node_modules/.bin" ]; then _ecosync_prepend_path "$root/deps/node_modules/.bin"; fi
161
+ if [ -d "$root/deps/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/deps/node_modules"; fi
162
+ if [ -d "$root/repo/node_modules/.bin" ]; then _ecosync_prepend_path "$root/repo/node_modules/.bin"; fi
163
+ if [ -d "$root/repo/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/repo/node_modules"; fi
164
+ if [ -d "$root/deps/vendor/bin" ]; then _ecosync_prepend_path "$root/deps/vendor/bin"; fi
165
+ if [ -d "$root/venv/bin" ]; then _ecosync_prepend_path "$root/venv/bin"; fi
166
+ if [ -d "$PWD/src" ]; then export PYTHONPATH="$PWD/src:$PWD${PYTHONPATH:+:$PYTHONPATH}"; else export PYTHONPATH="$PWD${PYTHONPATH:+:$PYTHONPATH}"; fi
167
+ export PATH
168
+ }
169
+ _ecosync_activate_repo_env() {
170
+ local root
171
+ if root="$(_ecosync_select_deps_root_for_cwd 2>/dev/null)"; then
172
+ _ecosync_setup_repo_env "$root"
173
+ fi
174
+ return 0
175
+ }
176
+ cd() {
177
+ if builtin cd "$@"; then
178
+ _ecosync_activate_repo_env >/dev/null 2>&1 || true
179
+ return 0
180
+ fi
181
+ return $?
182
+ }
183
+ _ecosync_activate_repo_env >/dev/null 2>&1 || true
184
+ SH
185
+ RUN mkdir -p /opt/ecosync/shims \
186
+ && cat > /opt/ecosync/shims/ecosync-tool-shim <<'SH'
187
+ #!/usr/bin/env bash
188
+ set -euo pipefail
189
+ tool="$(basename "$0")"
190
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
191
+ repo_envs="${ECOSYNC_REPO_ENVS:-/opt/ecosync/repo-envs.tsv}"
192
+ cwd="${PWD:-$(pwd -L)}"
193
+ fallback_command() {
194
+ case "$tool" in
195
+ python) [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 "$@" ;;
196
+ python3) [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python "$@" ;;
197
+ pytest) [[ -x /usr/local/bin/pytest ]] && exec /usr/local/bin/pytest "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pytest "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python -m pytest "$@" ;;
198
+ pip) [[ -x /usr/local/bin/pip ]] && exec /usr/local/bin/pip "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pip "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python -m pip "$@" ;;
199
+ pip3) [[ -x /usr/local/bin/pip3 ]] && exec /usr/local/bin/pip3 "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pip "$@" ;;
200
+ uv) [[ -x /usr/local/bin/uv ]] && exec /usr/local/bin/uv "$@" ;;
201
+ node) [[ -x /usr/local/bin/node ]] && exec /usr/local/bin/node "$@" ;;
202
+ npm) [[ -x /usr/local/bin/node && -f /usr/local/lib/node_modules/npm/bin/npm-cli.js ]] && exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js "$@"; [[ -x /usr/local/bin/npm ]] && exec /usr/local/bin/npm "$@" ;;
203
+ npx) [[ -x /usr/local/bin/node && -f /usr/local/lib/node_modules/npm/bin/npx-cli.js ]] && exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npx-cli.js "$@"; [[ -x /usr/local/bin/npx ]] && exec /usr/local/bin/npx "$@" ;;
204
+ corepack) [[ -x /usr/local/bin/corepack ]] && exec /usr/local/bin/corepack "$@" ;;
205
+ yarn) [[ -x /usr/local/bin/yarn ]] && exec /usr/local/bin/yarn "$@" ;;
206
+ pnpm) [[ -x /usr/local/bin/pnpm ]] && exec /usr/local/bin/pnpm "$@"; command -v corepack >/dev/null 2>&1 && exec corepack pnpm "$@" ;;
207
+ bun) [[ -x /usr/local/bin/bun ]] && exec /usr/local/bin/bun "$@" ;;
208
+ jest) [[ -x ./node_modules/.bin/jest ]] && exec ./node_modules/.bin/jest "$@" ;;
209
+ mocha) [[ -x ./node_modules/.bin/mocha ]] && exec ./node_modules/.bin/mocha "$@" ;;
210
+ tsd) [[ -x ./node_modules/.bin/tsd ]] && exec ./node_modules/.bin/tsd "$@" ;;
211
+ go) [[ -x /usr/local/go/bin/go ]] && exec /usr/local/go/bin/go "$@" ;;
212
+ cargo) [[ -x /usr/local/cargo/bin/cargo ]] && exec /usr/local/cargo/bin/cargo "$@" ;;
213
+ rustc) [[ -x /usr/local/cargo/bin/rustc ]] && exec /usr/local/cargo/bin/rustc "$@" ;;
214
+ rustup) [[ -x /usr/local/cargo/bin/rustup ]] && exec /usr/local/cargo/bin/rustup "$@" ;;
215
+ dart) [[ -x /usr/local/bin/dart ]] && exec /usr/local/bin/dart "$@" ;;
216
+ flutter) [[ -x /usr/local/bin/flutter ]] && exec /usr/local/bin/flutter "$@" ;;
217
+ php) [[ -x /usr/local/bin/php ]] && exec /usr/local/bin/php "$@"; [[ -x /usr/bin/php ]] && exec /usr/bin/php "$@" ;;
218
+ composer) command -v /usr/local/bin/composer >/dev/null 2>&1 && exec /usr/local/bin/composer "$@" ;;
219
+ phpunit) [[ -x ./vendor/bin/phpunit ]] && exec ./vendor/bin/phpunit "$@" ;;
220
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@" ;;
221
+ ruby) [[ -x /usr/local/bin/ruby ]] && exec /usr/local/bin/ruby "$@" ;;
222
+ gem) [[ -x /usr/local/bin/gem ]] && exec /usr/local/bin/gem "$@" ;;
223
+ bundle|bundler) [[ -x /usr/local/bin/bundle ]] && exec /usr/local/bin/bundle "$@"; [[ -x /usr/local/bin/bundler ]] && exec /usr/local/bin/bundler "$@" ;;
224
+ rake) [[ -x /usr/local/bin/rake ]] && exec /usr/local/bin/rake "$@" ;;
225
+ rspec) [[ -x /usr/local/bin/rspec ]] && exec /usr/local/bin/rspec "$@" ;;
226
+ mvn) [[ -x /opt/maven/bin/mvn ]] && exec /opt/maven/bin/mvn "$@"; [[ -x /usr/share/maven/bin/mvn ]] && exec /usr/share/maven/bin/mvn "$@" ;;
227
+ gradle) [[ -x /opt/gradle/bin/gradle ]] && exec /opt/gradle/bin/gradle "$@" ;;
228
+ cmake) [[ -x /usr/local/bin/cmake ]] && exec /usr/local/bin/cmake "$@"; [[ -x /usr/bin/cmake ]] && exec /usr/bin/cmake "$@" ;;
229
+ ctest) [[ -x /usr/local/bin/ctest ]] && exec /usr/local/bin/ctest "$@"; [[ -x /usr/bin/ctest ]] && exec /usr/bin/ctest "$@" ;;
230
+ scons) [[ -x /usr/local/bin/scons ]] && exec /usr/local/bin/scons "$@"; [[ -x /usr/bin/scons ]] && exec /usr/bin/scons "$@" ;;
231
+ godot) [[ -x /usr/local/bin/godot ]] && exec /usr/local/bin/godot "$@"; [[ -x /usr/bin/godot ]] && exec /usr/bin/godot "$@" ;;
232
+ esac
233
+ case "$tool" in
234
+ python) [[ -x /usr/bin/python ]] && exec /usr/bin/python "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 "$@" ;;
235
+ python3) [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python "$@" ;;
236
+ pytest) [[ -x /usr/bin/pytest ]] && exec /usr/bin/pytest "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pytest "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python -m pytest "$@" ;;
237
+ pip) [[ -x /usr/bin/pip ]] && exec /usr/bin/pip "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pip "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python -m pip "$@" ;;
238
+ pip3) [[ -x /usr/bin/pip3 ]] && exec /usr/bin/pip3 "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pip "$@" ;;
239
+ node) [[ -x /usr/bin/node ]] && exec /usr/bin/node "$@" ;;
240
+ npm) [[ -x /usr/bin/npm ]] && exec /usr/bin/npm "$@" ;;
241
+ npx) [[ -x /usr/bin/npx ]] && exec /usr/bin/npx "$@" ;;
242
+ corepack) [[ -x /usr/bin/corepack ]] && exec /usr/bin/corepack "$@" ;;
243
+ yarn) [[ -x /usr/bin/yarn ]] && exec /usr/bin/yarn "$@" ;;
244
+ pnpm) command -v corepack >/dev/null 2>&1 && exec corepack pnpm "$@"; exec /usr/bin/pnpm "$@" ;;
245
+ bun) [[ -x /usr/bin/bun ]] && exec /usr/bin/bun "$@" ;;
246
+ go) exec /usr/bin/go "$@" ;;
247
+ cargo) exec /usr/bin/cargo "$@" ;;
248
+ rustc) exec /usr/bin/rustc "$@" ;;
249
+ rustup) exec /usr/bin/rustup "$@" ;;
250
+ dart) exec /usr/bin/dart "$@" ;;
251
+ flutter) exec /usr/bin/flutter "$@" ;;
252
+ php) [[ -x /usr/local/bin/php ]] && exec /usr/local/bin/php "$@"; exec /usr/bin/php "$@" ;;
253
+ composer) exec /usr/bin/composer "$@" ;;
254
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@" ;;
255
+ ruby) exec /usr/bin/ruby "$@" ;;
256
+ gem) exec /usr/bin/gem "$@" ;;
257
+ bundle|bundler) exec /usr/bin/bundle "$@" ;;
258
+ rake) exec /usr/bin/rake "$@" ;;
259
+ rspec) exec /usr/bin/rspec "$@" ;;
260
+ mvn) exec /usr/bin/mvn "$@" ;;
261
+ gradle) exec /usr/bin/gradle "$@" ;;
262
+ cmake) exec /usr/bin/cmake "$@" ;;
263
+ ctest) exec /usr/bin/ctest "$@" ;;
264
+ scons) exec /usr/bin/scons "$@" ;;
265
+ godot) exec /usr/bin/godot "$@" ;;
266
+ esac
267
+ echo "ecosync shim could not find executable for $tool" >&2
268
+ exit 127
269
+ }
270
+ select_deps_root() {
271
+ [[ -r "$repo_envs" ]] || return 1
272
+ local rel root repo_abs
273
+ while IFS=$'\t' read -r rel root; do
274
+ [[ -n "${rel:-}" && -n "${root:-}" ]] || continue
275
+ repo_abs="$workspace/$rel"
276
+ case "$cwd" in
277
+ "$repo_abs"|"$repo_abs"/*)
278
+ printf '%s\n' "$root"
279
+ return 0
280
+ ;;
281
+ esac
282
+ done < "$repo_envs"
283
+ if [[ -n "${ECOSYNC_DEPS_ROOT:-}" && -d "$ECOSYNC_DEPS_ROOT" ]]; then
284
+ printf '%s\n' "$ECOSYNC_DEPS_ROOT"
285
+ return 0
286
+ fi
287
+ return 1
288
+ }
289
+ setup_repo_env() {
290
+ local root="$1"
291
+ [[ -d "$root" ]] || return 0
292
+ export ECOSYNC_DEPS_ROOT="$root"
293
+ if [[ -d "$root/gomodcache" && -w "$root/gomodcache" ]]; then export GOMODCACHE="$root/gomodcache"; else export GOMODCACHE="$ECOSYNC_CACHE_ROOT/go/pkg/mod"; fi
294
+ if [[ -d "$root/gopath" && -w "$root/gopath" ]]; then export GOPATH="$root/gopath"; else export GOPATH="$ECOSYNC_CACHE_ROOT/go/path"; fi
295
+ mkdir -p "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
296
+ chmod 0777 "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
297
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
298
+ export MAVEN_OPTS="-Dmaven.repo.local=$root/m2 ${MAVEN_OPTS:-}"
299
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-$workspace/.ecosyncbench/cache}"
300
+ case "${GRADLE_USER_HOME:-}" in
301
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
302
+ esac
303
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
304
+ if [[ -d "$root/composer/home" ]]; then export COMPOSER_HOME="$root/composer/home"; else export COMPOSER_HOME="${COMPOSER_HOME:-$root/composer-home}"; fi
305
+ if [[ -d "$root/composer/cache" ]]; then export COMPOSER_CACHE_DIR="$root/composer/cache"; fi
306
+ if [[ -d "$root/usr-local-bin" ]]; then PATH="$PATH:$root/usr-local-bin"; fi
307
+ if [[ -d "$root/usr-local-lib" ]]; then export LD_LIBRARY_PATH="$root/usr-local-lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
308
+ if [[ -d "$root/usr-local-cargo/bin" ]]; then PATH="$root/usr-local-cargo/bin:$PATH"; export CARGO_HOME="$root/usr-local-cargo"; fi
309
+ if [[ -d "$root/usr-local-rustup" ]]; then export RUSTUP_HOME="$root/usr-local-rustup"; fi
310
+ if [[ -n "${RUSTUP_HOME:-}" && -d "$RUSTUP_HOME/toolchains" ]]; then
311
+ if [[ -n "${RUSTUP_TOOLCHAIN:-}" && ! -d "$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN" ]]; then unset RUSTUP_TOOLCHAIN; fi
312
+ if [[ -z "${RUSTUP_TOOLCHAIN:-}" ]]; then installed_toolchain="$(find "$RUSTUP_HOME/toolchains" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null | sort -Vr | head -1 || true)"; [[ -z "$installed_toolchain" ]] || export RUSTUP_TOOLCHAIN="$installed_toolchain"; fi
313
+ if [[ -n "${RUSTUP_TOOLCHAIN:-}" ]]; then export ECOSYNC_RUST_TOOLCHAIN_DIR="$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN"; fi
314
+ fi
315
+ if [[ -d "$root/php-libs" ]]; then export LD_LIBRARY_PATH="$root/php-libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
316
+ if [[ -d "$root/usr-local-etc/php" ]]; then export PHPRC="$root/usr-local-etc/php"; export PHP_INI_SCAN_DIR="$root/usr-local-etc/php/conf.d${PHP_INI_SCAN_DIR:+:$PHP_INI_SCAN_DIR}"; fi
317
+ unset PYTHONHOME
318
+ if [[ -d "$root/usr-local/lib" && -x "$root/usr-local-bin/python" ]]; then export PYTHONHOME="$root/usr-local"; fi
319
+ if [[ -d "$root/usr-local-bundle" ]]; then export GEM_HOME="$root/usr-local-bundle"; export BUNDLE_PATH="$root/usr-local-bundle"; export BUNDLE_APP_CONFIG="$root/usr-local-bundle"; fi
320
+ if [[ -d "$root/node-runtime/bin" ]]; then PATH="$PATH:$root/node-runtime/bin"; export ECOSYNC_NODE_RUNTIME_ROOT="$root/node-runtime"; fi
321
+ if [[ -d "$root/node-runtime/lib/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/node-runtime/lib/node_modules"; fi
322
+ if [[ -d ./node_modules/.bin ]]; then PATH="$PWD/node_modules/.bin:$PATH"; fi
323
+ if [[ -d "$root/pnpm" ]]; then PATH="$root/pnpm:$PATH"; export PNPM_HOME="${PNPM_HOME:-$root/pnpm}"; fi
324
+ if [[ -d "$root/pnpm-store" ]]; then export PNPM_STORE_DIR="${PNPM_STORE_DIR:-$root/pnpm-store}"; export pnpm_config_store_dir="${pnpm_config_store_dir:-$root/pnpm-store}"; export npm_config_store_dir="${npm_config_store_dir:-$root/pnpm-store}"; export NPM_CONFIG_STORE_DIR="${NPM_CONFIG_STORE_DIR:-$root/pnpm-store}"; fi
325
+ if [[ -d "$root/corepack" ]]; then export COREPACK_HOME="${COREPACK_HOME:-$root/corepack}"; fi
326
+ if [[ -d "$root/xdg" ]]; then export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$root/xdg}"; export XDG_DATA_HOME="${XDG_DATA_HOME:-$root/xdg}"; fi
327
+ if [[ -d "$root/global" ]]; then export YARN_ENABLE_GLOBAL_CACHE="${YARN_ENABLE_GLOBAL_CACHE:-true}"; export YARN_GLOBAL_FOLDER="${YARN_GLOBAL_FOLDER:-$root/global}"; fi
328
+ if [[ -d "$root/cache" ]]; then export YARN_CACHE_FOLDER="${YARN_CACHE_FOLDER:-$root/cache}"; fi
329
+ if [[ -d "$root/deps/node_modules/.bin" ]]; then PATH="$root/deps/node_modules/.bin:$PATH"; fi
330
+ if [[ -d "$root/deps/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/deps/node_modules"; fi
331
+ if [[ -d "$root/repo/node_modules/.bin" ]]; then PATH="$root/repo/node_modules/.bin:$PATH"; fi
332
+ if [[ -d "$root/repo/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/repo/node_modules"; fi
333
+ if [[ -d "$root/deps/vendor/bin" ]]; then PATH="$root/deps/vendor/bin:$PATH"; fi
334
+ if [[ -d "$root/venv/bin" ]]; then PATH="$root/venv/bin:$PATH"; fi
335
+ if [[ -d "$PWD/src" ]]; then export PYTHONPATH="$PWD/src:$PWD${PYTHONPATH:+:$PYTHONPATH}"; else export PYTHONPATH="$PWD${PYTHONPATH:+:$PYTHONPATH}"; fi
336
+ export PATH
337
+ }
338
+ if deps_root="$(select_deps_root)"; then
339
+ setup_repo_env "$deps_root"
340
+ case "$tool" in
341
+ python|python3) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" "$@" ;;
342
+ pytest) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" -m pytest "$@"; [[ -x "$deps_root/usr-local-bin/pytest" ]] && exec "$deps_root/usr-local-bin/pytest" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" -m pytest "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" -m pytest "$@" ;;
343
+ pip|pip3) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" -m pip "$@"; [[ -x "$deps_root/usr-local-bin/pip" ]] && exec "$deps_root/usr-local-bin/pip" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" -m pip "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" -m pip "$@" ;;
344
+ node) [[ -x "$deps_root/node-runtime/bin/node" ]] && exec "$deps_root/node-runtime/bin/node" "$@" ;;
345
+ npm) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/npm/bin/npm-cli.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/npm/bin/npm-cli.js" "$@" ;;
346
+ npx) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/npm/bin/npx-cli.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/npm/bin/npx-cli.js" "$@" ;;
347
+ corepack) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" "$@" ;;
348
+ yarn) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" yarn "$@" ;;
349
+ pnpm) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" pnpm "$@" ;;
350
+ bun) [[ -x "$deps_root/usr-local-bin/bun" ]] && exec "$deps_root/usr-local-bin/bun" "$@"; [[ -x "$deps_root/node-runtime/bin/bun" ]] && exec "$deps_root/node-runtime/bin/bun" "$@" ;;
351
+ uv) [[ -x "$deps_root/usr-local-bin/uv" ]] && exec "$deps_root/usr-local-bin/uv" "$@" ;;
352
+ dart) [[ -x "$deps_root/usr-local-bin/dart" ]] && exec "$deps_root/usr-local-bin/dart" "$@"; [[ -x /workspace/repos/flutter/flutter/bin/dart ]] && exec /workspace/repos/flutter/flutter/bin/dart "$@" ;;
353
+ flutter) [[ -x "$deps_root/usr-local-bin/flutter" ]] && exec "$deps_root/usr-local-bin/flutter" "$@"; [[ -x /workspace/repos/flutter/flutter/bin/flutter ]] && exec /workspace/repos/flutter/flutter/bin/flutter "$@" ;;
354
+ jest) [[ -x ./node_modules/.bin/jest ]] && exec ./node_modules/.bin/jest "$@"; [[ -x "$deps_root/deps/node_modules/.bin/jest" ]] && exec "$deps_root/deps/node_modules/.bin/jest" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/jest" ]] && exec "$deps_root/repo/node_modules/.bin/jest" "$@" ;;
355
+ mocha) [[ -x ./node_modules/.bin/mocha ]] && exec ./node_modules/.bin/mocha "$@"; [[ -x "$deps_root/deps/node_modules/.bin/mocha" ]] && exec "$deps_root/deps/node_modules/.bin/mocha" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/mocha" ]] && exec "$deps_root/repo/node_modules/.bin/mocha" "$@" ;;
356
+ tsd) [[ -x ./node_modules/.bin/tsd ]] && exec ./node_modules/.bin/tsd "$@"; [[ -x "$deps_root/deps/node_modules/.bin/tsd" ]] && exec "$deps_root/deps/node_modules/.bin/tsd" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/tsd" ]] && exec "$deps_root/repo/node_modules/.bin/tsd" "$@" ;;
357
+ phpunit) [[ -x ./vendor/bin/phpunit ]] && exec ./vendor/bin/phpunit "$@"; [[ -x "$deps_root/deps/vendor/bin/phpunit" ]] && exec "$deps_root/deps/vendor/bin/phpunit" "$@" ;;
358
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@"; [[ -x "$deps_root/deps/vendor/bin/pest" ]] && exec "$deps_root/deps/vendor/bin/pest" "$@" ;;
359
+ composer) command -v /usr/local/bin/composer >/dev/null 2>&1 && exec /usr/local/bin/composer "$@" ;;
360
+ ruby) [[ -x "$deps_root/usr-local-bin/ruby" ]] && exec "$deps_root/usr-local-bin/ruby" "$@" ;;
361
+ gem) [[ -x "$deps_root/usr-local-bin/gem" ]] && exec "$deps_root/usr-local-bin/gem" "$@" ;;
362
+ bundle|bundler) [[ -x "$deps_root/usr-local-bin/bundle" ]] && exec "$deps_root/usr-local-bin/bundle" "$@"; [[ -x "$deps_root/usr-local-bin/bundler" ]] && exec "$deps_root/usr-local-bin/bundler" "$@" ;;
363
+ rake) [[ -x "$deps_root/usr-local-bin/rake" ]] && exec "$deps_root/usr-local-bin/rake" "$@" ;;
364
+ rspec) [[ -x "$deps_root/usr-local-bin/rspec" ]] && exec "$deps_root/usr-local-bin/rspec" "$@" ;;
365
+ go) [[ -x /usr/local/go/bin/go ]] && exec /usr/local/go/bin/go "$@" ;;
366
+ cargo) [[ -x "$deps_root/usr-local-cargo/bin/cargo" ]] && exec "$deps_root/usr-local-cargo/bin/cargo" "$@"; [[ -x /usr/local/cargo/bin/cargo ]] && exec /usr/local/cargo/bin/cargo "$@" ;;
367
+ rustc) [[ -x "$deps_root/usr-local-cargo/bin/rustc" ]] && exec "$deps_root/usr-local-cargo/bin/rustc" "$@"; [[ -x /usr/local/cargo/bin/rustc ]] && exec /usr/local/cargo/bin/rustc "$@" ;;
368
+ rustup) [[ -x "$deps_root/usr-local-cargo/bin/rustup" ]] && exec "$deps_root/usr-local-cargo/bin/rustup" "$@"; [[ -x /usr/local/cargo/bin/rustup ]] && exec /usr/local/cargo/bin/rustup "$@" ;;
369
+ mvn) [[ -x /opt/maven/bin/mvn ]] && exec /opt/maven/bin/mvn "$@"; [[ -x /usr/share/maven/bin/mvn ]] && exec /usr/share/maven/bin/mvn "$@" ;;
370
+ gradle) [[ -x /opt/gradle/bin/gradle ]] && exec /opt/gradle/bin/gradle "$@" ;;
371
+ cmake) [[ -x "$deps_root/usr-local-bin/cmake" ]] && exec "$deps_root/usr-local-bin/cmake" "$@"; [[ -x /usr/local/bin/cmake ]] && exec /usr/local/bin/cmake "$@"; [[ -x /usr/bin/cmake ]] && exec /usr/bin/cmake "$@" ;;
372
+ ctest) [[ -x "$deps_root/usr-local-bin/ctest" ]] && exec "$deps_root/usr-local-bin/ctest" "$@"; [[ -x /usr/local/bin/ctest ]] && exec /usr/local/bin/ctest "$@"; [[ -x /usr/bin/ctest ]] && exec /usr/bin/ctest "$@" ;;
373
+ scons) [[ -x "$deps_root/usr-local-bin/scons" ]] && exec "$deps_root/usr-local-bin/scons" "$@"; [[ -x /usr/local/bin/scons ]] && exec /usr/local/bin/scons "$@"; [[ -x /usr/bin/scons ]] && exec /usr/bin/scons "$@" ;;
374
+ godot) [[ -x "$deps_root/usr-local-bin/godot" ]] && exec "$deps_root/usr-local-bin/godot" "$@"; [[ -x /usr/local/bin/godot ]] && exec /usr/local/bin/godot "$@"; [[ -x /usr/bin/godot ]] && exec /usr/bin/godot "$@" ;;
375
+ esac
376
+ fi
377
+ fallback_command "$@"
378
+ SH
379
+ RUN chmod +x /opt/ecosync/shims/ecosync-tool-shim \
380
+ && for tool in python python3 pytest pip pip3 uv node npm npx corepack yarn pnpm bun jest mocha tsd go cargo rustc rustup dart flutter php composer phpunit pest ruby gem bundle bundler rake rspec mvn gradle cmake ctest scons godot; do ln -sf ecosync-tool-shim "/opt/ecosync/shims/$tool"; done
381
+ RUN if [ -x /usr/local/bin/node ] && [ -f /usr/local/lib/node_modules/npm/bin/npm-cli.js ]; then rm -f /usr/local/bin/npm && printf '%s\n' '#!/usr/bin/env sh' 'exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js "$@"' > /usr/local/bin/npm && chmod +x /usr/local/bin/npm; fi \
382
+ && if [ -x /usr/local/bin/node ] && [ -f /usr/local/lib/node_modules/npm/bin/npx-cli.js ]; then rm -f /usr/local/bin/npx && printf '%s\n' '#!/usr/bin/env sh' 'exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npx-cli.js "$@"' > /usr/local/bin/npx && chmod +x /usr/local/bin/npx; fi
383
+ RUN mkdir -p /opt/ecosync/gradle-home /opt/ecosync/gomodcache /opt/ecosync/gopath /tmp/ecosync-gocache \
384
+ && chmod 0777 /opt/ecosync/gradle-home /opt/ecosync/gomodcache /opt/ecosync/gopath /tmp/ecosync-gocache
385
+ RUN cat > /usr/local/bin/ecosync-case-prepare-workspace <<'SH'
386
+ #!/usr/bin/env bash
387
+ set -uo pipefail
388
+ workspace="${1:-${ECOSYNC_WORKSPACE:-/workspace}}"
389
+ if [[ -r /etc/profile.d/ecosync-tools.sh ]]; then
390
+ # shellcheck disable=SC1091
391
+ source /etc/profile.d/ecosync-tools.sh
392
+ fi
393
+ copy_or_link() {
394
+ local src="$1"
395
+ local dst="$2"
396
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
397
+ ln -s "$src" "$dst" 2>/dev/null || cp -a "$src" "$dst"
398
+ }
399
+ copy_tree() {
400
+ local src="$1"
401
+ local dst="$2"
402
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
403
+ cp -a "$src" "$dst"
404
+ }
405
+ copy_writable_tree() {
406
+ local src="$1"
407
+ local dst="$2"
408
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
409
+ cp -a "$src" "$dst"
410
+ chmod -R u+rwX "$dst" 2>/dev/null || true
411
+ }
412
+ prepare_gradle_home() {
413
+ local dst="${GRADLE_USER_HOME:-$workspace/.ecosyncbench/cache/gradle}"
414
+ mkdir -p "$dst" 2>/dev/null || return 0
415
+ if [[ -d /opt/ecosync/gradle-home && ! -e "$dst/.ecosync-preseeded" ]]; then
416
+ cp -R /opt/ecosync/gradle-home/. "$dst"/ 2>/dev/null || true
417
+ chmod -R u+rwX "$dst" 2>/dev/null || true
418
+ touch "$dst/.ecosync-preseeded" 2>/dev/null || true
419
+ fi
420
+ }
421
+ deps_roots_for_repo() {
422
+ local repo="$1"
423
+ local name
424
+ name="$(basename "$repo")"
425
+ local root
426
+ for root in /opt/ecosync/image-deps/*; do
427
+ [[ -d "$root/deps" || -d "$root/repo/node_modules" || -d "$root/pnpm-store" || -d "$root/venv" ]] || continue
428
+ [[ "$(basename "$root")" == *"$name"* ]] && printf '%s\n' "$root"
429
+ done
430
+ [[ -d /opt/ecosync/deps || -d /opt/ecosync/repo/node_modules || -d /opt/ecosync/pnpm-store || -d /opt/ecosync/venv ]] && printf '%s\n' /opt/ecosync
431
+ for root in /opt/ecosync/image-deps/*; do
432
+ [[ -d "$root/deps" || -d "$root/repo/node_modules" || -d "$root/pnpm-store" || -d "$root/venv" ]] && printf '%s\n' "$root"
433
+ done
434
+ return 0
435
+ }
436
+ prepare_repo() {
437
+ local repo="$1"
438
+ [[ -d "$repo" ]] || return 0
439
+ local root
440
+ while IFS= read -r root; do
441
+ [[ -n "$root" ]] || continue
442
+ [[ -f "$repo/composer.json" ]] && copy_tree "$root/deps/vendor" "$repo/vendor"
443
+ [[ -f "$repo/package.json" ]] && copy_tree "$root/deps/node_modules" "$repo/node_modules"
444
+ [[ -f "$repo/package.json" ]] && copy_tree "$root/repo/node_modules" "$repo/node_modules"
445
+ [[ -f "$repo/pyproject.toml" || -f "$repo/setup.py" ]] && copy_or_link "$root/venv" "$repo/.venv"
446
+ done < <(deps_roots_for_repo "$repo")
447
+ if [[ -f "$repo/tests/Java.Interop-Tests/Java.Interop-Tests.csproj" ]]; then
448
+ mkdir -p "$repo/external" "$repo/bin/BuildDebug"
449
+ local xat
450
+ for xat in /opt/ecosync/xamarin-android-tools-* /opt/ecosync/image-deps/*/xamarin-android-tools-*; do
451
+ [[ -d "$xat" ]] || continue
452
+ if [[ -L "$repo/external/xamarin-android-tools" || ! -f "$repo/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj" || ! -w "$repo/external/xamarin-android-tools" ]]; then
453
+ rm -rf "$repo/external/xamarin-android-tools" 2>/dev/null || true
454
+ fi
455
+ copy_writable_tree "$xat" "$repo/external/xamarin-android-tools"
456
+ break
457
+ done
458
+ if [[ ! -f "$repo/bin/BuildDebug/JdkInfo.props" ]]; then
459
+ cat > "$repo/bin/BuildDebug/JdkInfo.props" <<'XML'
460
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
461
+ <Choose>
462
+ <When Condition=" '$(JdkJvmPath)' == '' ">
463
+ <PropertyGroup>
464
+ <JdkJvmPath>/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so</JdkJvmPath>
465
+ </PropertyGroup>
466
+ <ItemGroup>
467
+ <JdkIncludePath Include="/usr/lib/jvm/java-17-openjdk-amd64/include" />
468
+ <JdkIncludePath Include="/usr/lib/jvm/java-17-openjdk-amd64/include/linux" />
469
+ </ItemGroup>
470
+ </When>
471
+ </Choose>
472
+ <PropertyGroup>
473
+ <JavaApiDefineConstants Condition=" '$(JavaApiDefineConstants)' == '' ">JAVA_API_11;JAVA_API_12;JAVA_API_13;JAVA_API_14;JAVA_API_15;JAVA_API_16;JAVA_API_17</JavaApiDefineConstants>
474
+ <JavaMajorVersion Condition=" '$(JavaMajorVersion)' == '' ">17</JavaMajorVersion>
475
+ <JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64</JavaSdkDirectory>
476
+ <JavaPath Condition=" '$(JavaPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/java</JavaPath>
477
+ <JavaCPath Condition=" '$(JavaCPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/javac</JavaCPath>
478
+ <JarPath Condition=" '$(JarPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/jar</JarPath>
479
+ <DotnetToolPath Condition=" '$(DotnetToolPath)' == '' ">dotnet</DotnetToolPath>
480
+ </PropertyGroup>
481
+ </Project>
482
+ XML
483
+ fi
484
+ if [[ ! -f "$repo/bin/BuildDebug/JdkInfo.mk" ]]; then
485
+ cat > "$repo/bin/BuildDebug/JdkInfo.mk" <<'MK'
486
+ export JI_JAR_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/jar
487
+ export JI_JAVA_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/java
488
+ export JI_JAVAC_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
489
+ export JI_JDK_INCLUDE_PATHS := /usr/lib/jvm/java-17-openjdk-amd64/include /usr/lib/jvm/java-17-openjdk-amd64/include/linux
490
+ export JI_JVM_PATH := /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
491
+ MK
492
+ fi
493
+ fi
494
+ return 0
495
+ }
496
+ if [[ -d "$workspace/repos" ]]; then
497
+ prepare_gradle_home
498
+ while IFS= read -r -d '' repo; do
499
+ prepare_repo "$repo"
500
+ done < <(find "$workspace/repos" -mindepth 2 -maxdepth 2 -type d -print0)
501
+ fi
502
+ exit 0
503
+ SH
504
+ RUN chmod +x /usr/local/bin/ecosync-case-prepare-workspace \
505
+ && printf '\n[ -r /etc/profile.d/ecosync-tools.sh ] && . /etc/profile.d/ecosync-tools.sh\n' >> /etc/bash.bashrc
506
+ RUN set -eux; \
507
+ for cfg in /opt/ecosync/venv/pyvenv.cfg /opt/ecosync/image-deps/*/venv/pyvenv.cfg; do \
508
+ [ -f "$cfg" ] || continue; \
509
+ venv="$(dirname "$cfg")"; \
510
+ minor="$(sed -n 's/^version = \([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' "$cfg" | head -1)"; \
511
+ [ -n "$minor" ] || continue; \
512
+ if [ -x "/usr/local/bin/python$minor" ]; then \
513
+ ln -sf "/usr/local/bin/python$minor" "$venv/bin/python"; \
514
+ ln -sf python "$venv/bin/python3"; \
515
+ sed -i "s#^home = .*#home = /usr/local/bin#; s#^executable = .*#executable = /usr/local/bin/python$minor#" "$cfg"; \
516
+ for script in "$venv"/bin/*; do \
517
+ [ -f "$script" ] || continue; \
518
+ first="$(head -c 64 "$script" 2>/dev/null || true)"; \
519
+ case "$first" in '#!'*'/opt/ecosync/venv/bin/python'*) sed -i "1s|^#!.*python.*$|#!$venv/bin/python|" "$script" ;; esac; \
520
+ done; \
521
+ fi; \
522
+ done
523
+ RUN if [ -f /usr/local/lib/node_modules/corepack/dist/corepack.js ]; then \
524
+ ln -sf ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
525
+ fi
526
+ ARG ECOSYNC_TASK_ID=paddlepaddle_paconvert_paddle_d3f5712cbcf6
527
+ LABEL org.ecosyncbench.layer=case-base \
528
+ org.ecosyncbench.agent_environment=case-env \
529
+ org.ecosyncbench.task=paddlepaddle_paconvert_paddle_d3f5712cbcf6
530
+ COPY --from=task_ctx /repo_envs.tsv /opt/ecosync/repo-envs.tsv
531
+ COPY --from=task_ctx /runners/ /opt/ecosync/
532
+ RUN chmod a+r /opt/ecosync/repo-envs.tsv \
533
+ && chmod +x /opt/ecosync/run-*.sh \
534
+ && git --version \
535
+ && python3 --version
536
+ WORKDIR /workspace
537
+ CMD ["bash"]
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/repo_envs.tsv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ repos/PaddlePaddle/PaConvert /opt/ecosync
2
+ repos/PaddlePaddle/Paddle /opt/ecosync
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/run_profile_inside.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ cat >&2 <<'EOF'
4
+ ecosync-case-run-profile is disabled in agent case-env images.
5
+ Formal benchmark tests are evaluator-only and are injected after agent work.
6
+ Use the repository's normal visible test commands for debugging.
7
+ EOF
8
+ exit 2
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-dify-pytest.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export PYTHONDONTWRITEBYTECODE=1
8
+ "$deps_root/venv/bin/python" -m pytest -q --no-cov --junitxml="/workspace/.ecosyncbench/test-reports/${profile}.xml" "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-go-redis-test.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ focus="${2:?ginkgo focus required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export GOMODCACHE="${GOMODCACHE:-$deps_root/gomodcache}"
8
+ export GOPATH="${GOPATH:-$deps_root/gopath}"
9
+ export PATH="/usr/local/go/bin:$PATH"
10
+ redis_dir=/workspace/repos/redis/redis
11
+ if [[ ! -x "$redis_dir/src/redis-server" ]]; then
12
+ make -C "$redis_dir" -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
13
+ fi
14
+ "$redis_dir/src/redis-server" --port 6379 --save "" --appendonly no --daemonize yes
15
+ trap '"$redis_dir/src/redis-cli" -p 6379 shutdown nosave >/dev/null 2>&1 || true' EXIT
16
+ for _ in $(seq 1 50); do "$redis_dir/src/redis-cli" -p 6379 ping >/dev/null 2>&1 && break; sleep 0.1; done
17
+ REDIS_VERSION=8.8 RE_CLUSTER=true REDIS_PORT=6379 go test -count=1 -run TestGinkgoSuite -ginkgo.focus "$focus" . | tee "/workspace/.ecosyncbench/test-reports/${profile}.log"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-go-test.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export GOMODCACHE="${GOMODCACHE:-$deps_root/gomodcache}"
8
+ export GOPATH="${GOPATH:-$deps_root/gopath}"
9
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
10
+ export PATH="/usr/local/go/bin:$PATH"
11
+ go test -count=1 -json "$@" | tee "/workspace/.ecosyncbench/test-reports/${profile}.json"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-ioredis-tsd.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then cp -a "$deps_root/deps/node_modules" node_modules; fi
8
+ npm run build
9
+ ./node_modules/.bin/tsd --files "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-jest.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export NODE_ENV=test
8
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then
9
+ cp -a "$deps_root/deps/node_modules" node_modules
10
+ fi
11
+ if [[ -f package.json ]] && node -e "const p=require('./package.json'); process.exit(p.scripts&&p.scripts.version?0:1)" >/dev/null 2>&1; then
12
+ npm run version >/tmp/ecosync-version.log 2>&1 || true
13
+ fi
14
+ ./node_modules/.bin/jest --ci --colors=false --json --outputFile="/workspace/.ecosyncbench/test-reports/${profile}.json" "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-maven-test.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ test_selector="${2:?maven test selector required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export MAVEN_OPTS="-Dmaven.repo.local=$deps_root/m2 ${MAVEN_OPTS:-}"
8
+ export GIT_CONFIG_GLOBAL="${GIT_CONFIG_GLOBAL:-/tmp/ecosyncbench-gitconfig}"
9
+ touch "$GIT_CONFIG_GLOBAL"
10
+ if [[ -f .git ]]; then
11
+ gitdir="$(sed -n 's/^gitdir: //p' .git | head -1)"
12
+ if [[ -n "$gitdir" && ! -d "$gitdir" ]]; then
13
+ rm -f .git
14
+ fi
15
+ fi
16
+ if [[ ! -d .git ]]; then
17
+ git -c safe.directory="$PWD" init -q
18
+ fi
19
+ git -c safe.directory="$PWD" config user.email ecosyncbench@example.invalid
20
+ git -c safe.directory="$PWD" config user.name EcoSyncBench
21
+ if ! git -c safe.directory="$PWD" rev-parse --verify HEAD >/dev/null 2>&1; then
22
+ git -c safe.directory="$PWD" commit --allow-empty -qm ecosyncbench-maven-metadata
23
+ fi
24
+ mvn -B -Dgit.commit.id.skip=true -Dformatter.skip=true -DskipITs=true -DskipIntegrationTests=true -DskipScenarioTests=true -Dtest="$test_selector" test
25
+ find target/surefire-reports -maxdepth 1 -name '*.xml' -type f -exec cp {} /workspace/.ecosyncbench/test-reports/ \; 2>/dev/null || true
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-node-redis-mocha.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ -d "$deps_root/deps/node_modules" && ! -d node_modules ]]; then cp -a "$deps_root/deps/node_modules" node_modules; fi
8
+ if [[ -d "$deps_root/deps/packages" && ! -d packages/node_modules ]]; then
9
+ for pkg_modules in "$deps_root"/deps/packages/*/node_modules; do
10
+ [[ -d "$pkg_modules" ]] || continue
11
+ pkg_name="$(basename "$(dirname "$pkg_modules")")"
12
+ mkdir -p "packages/$pkg_name"
13
+ cp -a "$pkg_modules" "packages/$pkg_name/node_modules"
14
+ done
15
+ fi
16
+ npm run build
17
+ ./node_modules/.bin/mocha -r tsx --reporter mocha-junit-reporter --reporter-options "mochaFile=/workspace/.ecosyncbench/test-reports/${profile}.xml,toConsole=false" --exit "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-phpunit.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ ! -d vendor && -d "$deps_root/deps/vendor" ]]; then
8
+ cp -a "$deps_root/deps/vendor" vendor
9
+ fi
10
+ composer dump-autoload --no-interaction --no-scripts >/tmp/ecosync-composer-dump.log
11
+ phpunit_args=(--colors=never)
12
+ if ./vendor/bin/phpunit --help 2>/dev/null | grep -q -- "--fail-on-risky"; then
13
+ phpunit_args+=(--fail-on-risky)
14
+ fi
15
+ phpunit_args+=(--log-junit "/workspace/.ecosyncbench/test-reports/${profile}.xml")
16
+ ./vendor/bin/phpunit "${phpunit_args[@]}" "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-redis-pytest.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ "$deps_root/venv/bin/python" -m pip install -e . --no-deps >/dev/null
8
+ redis_dir=/workspace/repos/redis/redis
9
+ if [[ ! -x "$redis_dir/src/redis-server" ]]; then
10
+ make -C "$redis_dir" -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
11
+ fi
12
+ "$redis_dir/src/redis-server" --port 6379 --save "" --appendonly no --daemonize yes
13
+ trap '"$redis_dir/src/redis-cli" -p 6379 shutdown nosave >/dev/null 2>&1 || true' EXIT
14
+ for _ in $(seq 1 50); do "$redis_dir/src/redis-cli" -p 6379 ping >/dev/null 2>&1 && break; sleep 0.1; done
15
+ "$deps_root/venv/bin/python" -m pytest -q --redis-url redis://127.0.0.1:6379/0 --junitxml="/workspace/.ecosyncbench/test-reports/${profile}.xml" "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-redis-server-test.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ single="${2:?single redis test required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ make -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
7
+ ./runtest --single "$single" --timeout "${ECOSYNC_REDIS_TEST_TIMEOUT:-120}"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/case_env/runners/run-webpack-jest.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export NODE_ENV=test
8
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then
9
+ cp -a "$deps_root/deps/node_modules" node_modules
10
+ fi
11
+ node --expose-gc --max-old-space-size=4096 --experimental-vm-modules \
12
+ ./node_modules/jest-cli/bin/jest \
13
+ --ci --colors=false --json --outputFile="/workspace/.ecosyncbench/test-reports/${profile}.json" "$@"
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/deps_image_lock.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ case_base_image:
2
+ agent_environment: case-env
3
+ local_tag: ecosyncbench/cases/paddlepaddle_paconvert_paddle_d3f5712cbcf6/case-base:deps-env
4
+ base_case_image: ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6
5
+ dependency_images_referenced_by_task:
6
+ - ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6
7
+ release_status: published
8
+ release_tag: ghcr.io/code-tmp/wideswe/cases/paddlepaddle_paconvert_paddle_d3f5712cbcf6/case-base:deps-env
9
+ local_image_id: sha256:c7bf76dd6efbe932f14ca6512946c8c6c0ab46b975e4b0e54236f990f7c783a3
10
+ size_bytes: 3172429835
11
+ release_digest: sha256:a4ff96fbfb91b685962657f736bbc5e37d74b33c548705f536cb02534720c100
12
+ generated_at_unix: 1789847920
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/paddle-paconvert-py312.Dockerfile ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ecosyncbench/deps/pytorch-python:3.12
2
+
3
+ RUN python -m pip install --no-cache-dir --upgrade pip \
4
+ && python -m pip install --no-cache-dir \
5
+ paddlepaddle==3.2.2 \
6
+ pytest \
7
+ numpy \
8
+ astor \
9
+ black==22.8.0 \
10
+ isort==5.11.5
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/run_profile.sh ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+
5
+ task_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6
+ workspace="$(cd "${ECOSYNC_WORKSPACE:-$task_dir}" && pwd)"
7
+ image="ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6"
8
+ cache_root="${ECOSYNC_CACHE_ROOT:-/tmp/ecosyncbench-release120-runtime/cache/legacy/tmp/cache/paddlepaddle-paconvert-paddle-d3f5712cbcf6}"
9
+ paddle_compat_source="$workspace/repos/PaddlePaddle/Paddle/python/paddle/compat.py"
10
+ paddle_compat_target="/usr/local/lib/python3.12/site-packages/paddle/compat.py"
11
+ paddle_tensor_compat_source="$workspace/repos/PaddlePaddle/Paddle/python/paddle/tensor/compat.py"
12
+ paddle_tensor_compat_target="/usr/local/lib/python3.12/site-packages/paddle/tensor/compat.py"
13
+ uid="${ECOSYNC_UID:-$(id -u)}"
14
+ gid="${ECOSYNC_GID:-$(id -g)}"
15
+
16
+ mkdir -p "$cache_root/pip" "$cache_root/home" "$workspace/.ecosyncbench/test-reports"
17
+
18
+ ensure_image() {
19
+ if [[ "${ECOSYNC_DOCKER_BUILD:-0}" == "1" ]] || ! docker image inspect "$image" >/dev/null 2>&1; then
20
+ docker build -t "$image" -f "$task_dir/environment/paddle-paconvert-py312.Dockerfile" "$task_dir/environment"
21
+ fi
22
+ }
23
+
24
+ run_python() {
25
+ local workdir="$1"
26
+ local script="$2"
27
+ ensure_image
28
+ for source in "$paddle_compat_source" "$paddle_tensor_compat_source"; do
29
+ if [[ ! -f "$source" ]]; then
30
+ echo "Missing Paddle overlay source: $source" >&2
31
+ exit 2
32
+ fi
33
+ done
34
+ timeout "${ECOSYNC_PROFILE_TIMEOUT_SECONDS:-2400}" docker run --rm \
35
+ --network host \
36
+ --name "ecosync_${profile}_$$_${RANDOM}" \
37
+ -u "$uid:$gid" \
38
+ -e HOME=/cache/home \
39
+ -e CI=1 \
40
+ -e FORCE_COLOR=0 \
41
+ -e PIP_CACHE_DIR=/cache/pip \
42
+ -e PYTHONNOUSERSITE=1 \
43
+ -v "$workspace:/workspace" \
44
+ -v "$cache_root:/cache" \
45
+ -v "$paddle_compat_source:$paddle_compat_target:ro" \
46
+ -v "$paddle_tensor_compat_source:$paddle_tensor_compat_target:ro" \
47
+ -w "/workspace/$workdir" \
48
+ "$image" \
49
+ bash -lc "$script"
50
+ }
51
+
52
+ run_paconvert() {
53
+ run_python "repos/PaddlePaddle/PaConvert" "
54
+ set -euo pipefail
55
+ mkdir -p /cache/home /workspace/.ecosyncbench/test-reports
56
+ export PYTHONPATH=\"\$PWD:\$PWD/tests:\${PYTHONPATH:-}\"
57
+ python -m pytest -q \
58
+ tests/test_nn_functional_pad.py \
59
+ --junitxml=/workspace/.ecosyncbench/test-reports/paconvert-hidden.xml
60
+ "
61
+ }
62
+
63
+ run_paddle() {
64
+ local tests=(
65
+ test_basic_pad
66
+ test_constant_fast_pass
67
+ test_dyn_graph_reflect
68
+ test_error_handling
69
+ test_no_pad
70
+ test_single_dim
71
+ test_special_cases
72
+ test_static_graph_circular
73
+ )
74
+ local status=0
75
+ local index=0
76
+ local test_name report
77
+
78
+ rm -f "$workspace/.ecosyncbench/test-reports"/paddle-hidden*.xml
79
+ for test_name in "${tests[@]}"; do
80
+ index=$((index + 1))
81
+ report=$(printf '/workspace/.ecosyncbench/test-reports/paddle-hidden-%02d.xml' "$index")
82
+ if ! run_python "repos/PaddlePaddle/Paddle" "
83
+ set -euo pipefail
84
+ mkdir -p /cache/home /workspace/.ecosyncbench/test-reports
85
+ export PYTHONPATH=\"/workspace/repos/PaddlePaddle/Paddle/test/legacy_test:\${PYTHONPATH:-}\"
86
+ python -m pytest -q \
87
+ \"test/legacy_test/test_compat_pad.py::TestCompatPad::$test_name\" \
88
+ --junitxml=\"$report\"
89
+ "; then
90
+ status=1
91
+ fi
92
+ done
93
+
94
+ python3 - "$workspace/.ecosyncbench/test-reports" <<'PY'
95
+ from pathlib import Path
96
+ import sys
97
+ import xml.etree.ElementTree as ET
98
+
99
+ report_dir = Path(sys.argv[1])
100
+ combined = ET.Element("testsuites")
101
+ totals = {"tests": 0, "failures": 0, "errors": 0, "skipped": 0, "time": 0.0}
102
+
103
+ for report in sorted(report_dir.glob("paddle-hidden-[0-9][0-9].xml")):
104
+ root = ET.parse(report).getroot()
105
+ suites = [root] if root.tag == "testsuite" else list(root.findall("testsuite"))
106
+ for suite in suites:
107
+ combined.append(suite)
108
+ for key in ("tests", "failures", "errors", "skipped"):
109
+ totals[key] += int(suite.get(key, "0"))
110
+ totals["time"] += float(suite.get("time", "0"))
111
+
112
+ for key, value in totals.items():
113
+ combined.set(key, str(value))
114
+ ET.ElementTree(combined).write(
115
+ report_dir / "paddle-hidden.xml",
116
+ encoding="utf-8",
117
+ xml_declaration=True,
118
+ )
119
+ PY
120
+ return "$status"
121
+ }
122
+
123
+ if [[ "${ECOSYNC_DOCKER_PREBUILD_ONLY:-0}" == "1" || "${ECOSYNC_DOCKER_WARMUP_ONLY:-0}" == "1" ]]; then
124
+ ensure_image
125
+ docker run --rm "$image" bash -lc 'python -c "import paddle, pytest, torch, numpy" >/dev/null'
126
+ exit 0
127
+ fi
128
+
129
+ case "$profile" in
130
+ paconvert-hidden)
131
+ run_paconvert
132
+ ;;
133
+ paddle-hidden)
134
+ run_paddle
135
+ ;;
136
+ *)
137
+ echo "Unknown profile for paddlepaddle_paconvert_paddle_d3f5712cbcf6: $profile" >&2
138
+ exit 2
139
+ ;;
140
+ esac
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/environment/test_profiles.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ profiles:
2
+ paconvert-hidden:
3
+ repo: PaConvert
4
+ workdir: repos/PaddlePaddle/PaConvert
5
+ command: environment/run_profile.sh paconvert-hidden
6
+ status: implemented
7
+ dependency_image: ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6
8
+ test_files:
9
+ - tests/test_nn_functional_pad.py
10
+ paddle-hidden:
11
+ repo: Paddle
12
+ workdir: repos/PaddlePaddle/Paddle
13
+ command: environment/run_profile.sh paddle-hidden
14
+ status: implemented
15
+ dependency_image: ecosyncbench/deps/paddle-paconvert-py312:d3f5712cbcf6
16
+ test_files:
17
+ - test/legacy_test/test_compat_pad.py
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/metadata.yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ source: upstream_pr_merge_commits
2
+ patches:
3
+ PaConvert:
4
+ base_commit: 226220825c49c0f0638afdba9bf6988d8524e591
5
+ gold_commit: 0311bd2b3992e5b340f38d202868048c7f77e1e2
6
+ merge_commit: 7a613474eb37279115bce4234d79b1280108f4dd
7
+ patch_source: concatenated_upstream_pr_diffs
8
+ upstream_prs:
9
+ - 697
10
+ Paddle:
11
+ base_commit: daa3639a7da1b5c5aed3a253bd41f082123ae9f2
12
+ gold_commit: 28b749632f2dc015ba35387b24cca228f4ade998
13
+ merge_commit: cd2ef1c572ecf2ab2fb22a16c9cfdb7b6192b060
14
+ patch_source: concatenated_upstream_pr_diffs
15
+ upstream_prs:
16
+ - 75200
17
+ hidden_tests:
18
+ policy: upstream test-file diffs only
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/patches/PaConvert.patch ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/paconvert/api_mapping.json b/paconvert/api_mapping.json
2
+ index 9355ded..629c45c 100644
3
+ --- a/paconvert/api_mapping.json
4
+ +++ b/paconvert/api_mapping.json
5
+ @@ -14302,21 +14302,8 @@
6
+ }
7
+ },
8
+ "torch.nn.functional.pad": {
9
+ - "Matcher": "GenericMatcher",
10
+ - "paddle_api": "paddle.nn.functional.pad",
11
+ - "min_input_args": 2,
12
+ - "args_list": [
13
+ - "input",
14
+ - "pad",
15
+ - "mode",
16
+ - "value"
17
+ - ],
18
+ - "kwargs_change": {
19
+ - "input": "x"
20
+ - },
21
+ - "paddle_default_kwargs": {
22
+ - "pad_from_left_axis": "False"
23
+ - }
24
+ + "Matcher": "ChangeAPIMatcher",
25
+ + "paddle_api": "paddle.compat.pad"
26
+ },
27
+ "torch.nn.functional.pairwise_distance": {
28
+ "Matcher": "GenericMatcher",
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/gold/patches/Paddle.patch ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/python/paddle/compat.py b/python/paddle/compat.py
2
+ index 8194fb6316..74d76e2d38 100644
3
+ --- a/python/paddle/compat.py
4
+ +++ b/python/paddle/compat.py
5
+ @@ -26,6 +26,7 @@ from .tensor.compat import (
6
+ median,
7
+ min,
8
+ nanmedian,
9
+ + pad,
10
+ slogdet,
11
+ sort,
12
+ split,
13
+ @@ -42,6 +43,7 @@ __all__ = [
14
+ 'max',
15
+ 'median',
16
+ 'nanmedian',
17
+ + 'pad',
18
+ ]
19
+
20
+
21
+ diff --git a/python/paddle/tensor/compat.py b/python/paddle/tensor/compat.py
22
+ index 295381fcab..bb055c4b76 100644
23
+ --- a/python/paddle/tensor/compat.py
24
+ +++ b/python/paddle/tensor/compat.py
25
+ @@ -14,7 +14,7 @@
26
+
27
+ from __future__ import annotations
28
+
29
+ -from typing import TYPE_CHECKING, Any, NamedTuple
30
+ +from typing import TYPE_CHECKING, Any, Literal, NamedTuple
31
+
32
+ import paddle
33
+ from paddle import _C_ops
34
+ @@ -27,11 +27,18 @@ from ..framework import (
35
+ if TYPE_CHECKING:
36
+ from collections.abc import Sequence
37
+
38
+ + from typing_extensions import TypeAlias
39
+ +
40
+ from paddle import Tensor
41
+ from paddle._typing import (
42
+ + ShapeLike,
43
+ Size2,
44
+ )
45
+
46
+ + _PaddingTensorMode: TypeAlias = Literal[
47
+ + "zeros", "constant", "reflect", "replicate", "circular"
48
+ + ]
49
+ +
50
+ from paddle import nn
51
+ from paddle.utils.decorator_utils import ForbidKeywordsDecorator
52
+
53
+ @@ -1032,3 +1039,155 @@ def nanmedian(
54
+ paddle.assign(indices, out[1])
55
+ return MedianRetType(values=out[0], indices=out[1])
56
+ return MedianRetType(values=values, indices=indices)
57
+ +
58
+ +
59
+ +def _check_valid_pad_len(pad_len, x_dim, is_constant):
60
+ + if pad_len > 6 or pad_len < 0:
61
+ + raise ValueError(f"Expect len(pad) <= 6 and not -1, got: {pad_len}")
62
+ + max_dim = 2 * x_dim - (0 if is_constant else 2)
63
+ + if pad_len > max_dim:
64
+ + raise ValueError(
65
+ + f"len(pad) is bounded by input.ndim: expect len(pad) <= {max_dim}, got: {pad_len}"
66
+ + )
67
+ +
68
+ +
69
+ +@ForbidKeywordsDecorator(
70
+ + illegal_keys={"x", "name", "data_format", "pad_from_left_axis"},
71
+ + func_name="paddle.compat.pad",
72
+ + correct_name="paddle.nn.functional.pad",
73
+ +)
74
+ +def pad(
75
+ + input: Tensor,
76
+ + pad: ShapeLike,
77
+ + mode: _PaddingTensorMode = 'constant',
78
+ + value: float = 0.0,
79
+ +) -> Tensor:
80
+ + """
81
+ +
82
+ + PyTorch compatible version of :ref:`api_paddle_nn_functional_pad`. For the original API, see :ref:`api_paddle_nn_functional_pad` for more details.
83
+ +
84
+ + Pad tensor according to ``'pad'`` and ``'mode'``. All the padding operations under the hood starts from the **right** (last dim) of the tensor.
85
+ +
86
+ + Args:
87
+ + input (Tensor): The input tensor with data type float32, float64, int32, int64, complex64 or complex128.
88
+ + pad (Tensor|list[int]|tuple[int]): The padding size with data type int. Refer to Note for details.
89
+ + mode (str, optional): Four modes: ``'constant'`` (default), ``'reflect'``, ``'replicate'``, ``'circular'``. Default is ``'constant'``.
90
+ +
91
+ + - 'constant' mode, uses a constant value to pad the input tensor.
92
+ + - 'reflect' mode, uses reflection of the input boundaries to pad the input tensor.
93
+ + - 'replicate' mode, uses input boundaries to pad the input tensor.
94
+ + - 'circular' mode, uses circular input to pad the input tensor.
95
+ +
96
+ + value (float, optional): The value to fill the padded areas in 'constant' mode . Default is :math:`0.0`.
97
+ +
98
+ + Note:
99
+ + For non ``'constant'`` mode, padding size can not be greater than ``min(2 * input.ndim - 2, 6)``.
100
+ + Only 2D, 3D, 4D and 5D tensors are supported with up to the last 3 dims (if ndim >= 3) can be padded.
101
+ +
102
+ + Returns:
103
+ + Tensor, a Tensor padded according to pad and mode and data type is same as input.
104
+ +
105
+ + Examples:
106
+ + .. code-block:: python
107
+ +
108
+ + >>> import paddle
109
+ +
110
+ + >>> input_shape = (1, 1, 3)
111
+ + >>> input_ = paddle.arange(paddle.prod(paddle.to_tensor(input_shape)), dtype="float32").reshape(input_shape) + 1
112
+ + >>> y = paddle.compat.pad(input_, [1, 0, 0, 1], value=0, mode='constant')
113
+ + >>> print(y)
114
+ + Tensor(shape=[1, 2, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
115
+ + [[[0., 1., 2., 3.],
116
+ + [0., 0., 0., 0.]]])
117
+ +
118
+ + >>> # reflect 2D padding
119
+ + >>> input_ = paddle.arange(6).reshape([2, 3])
120
+ + >>> y = paddle.compat.pad(input=input_, pad=(1, 1), mode='reflect')
121
+ + >>> print(y)
122
+ + Tensor(shape=[2, 5], dtype=int64, place=Place(cpu), stop_gradient=True,
123
+ + [[1, 0, 1, 2, 1],
124
+ + [4, 3, 4, 5, 4]])
125
+ + """
126
+ +
127
+ + assert mode in [
128
+ + 'reflect',
129
+ + 'replicate',
130
+ + 'constant',
131
+ + 'circular',
132
+ + ], (
133
+ + f"mode should be one of constant, reflect, replicate, circular, but got {mode}."
134
+ + )
135
+ +
136
+ + x_dim = len(input.shape)
137
+ + if in_dynamic_mode():
138
+ + if isinstance(pad, (Variable, paddle.Tensor)) and pad.size == 0:
139
+ + return input.clone()
140
+ +
141
+ + if (
142
+ + mode == "constant"
143
+ + and isinstance(pad, (list, tuple))
144
+ + and len(pad) != (x_dim - 2) * 2
145
+ + ):
146
+ + paddings = pad
147
+ + pad_value = value
148
+ +
149
+ + padding_len = len(paddings)
150
+ + # pad the length of paddings to 2*x_dim
151
+ + if padding_len < 2 * x_dim:
152
+ + pad_len_for_paddings = 2 * x_dim - padding_len
153
+ + paddings = paddings + ([0] if isinstance(pad, list) else (0,)) * (
154
+ + pad_len_for_paddings
155
+ + )
156
+ +
157
+ + # since the kernel pad from left axis, if we want to pad from right axis, we need to reverse the paddings
158
+ + paddings = [
159
+ + paddings[i - 1] if i % 2 == 1 else paddings[i + 1]
160
+ + for i in range(2 * x_dim - 1, -1, -1)
161
+ + ]
162
+ + pad_val = (
163
+ + pad_value
164
+ + if isinstance(pad_value, paddle.pir.Value)
165
+ + else float(pad_value)
166
+ + )
167
+ + return _C_ops.pad(input, paddings, pad_val)
168
+ +
169
+ + assert x_dim >= 1 and x_dim <= 5, (
170
+ + f"Input tensor dimension must be in [1-5] but got {x_dim}"
171
+ + )
172
+ +
173
+ + is_constant_mode = mode == 'constant'
174
+ + if (not is_constant_mode) and x_dim < 2:
175
+ + raise ValueError(
176
+ + f"Only 2D, 3D, 4D, 5D padding with non-constant padding are supported for now, got ndim: {x_dim}"
177
+ + )
178
+ +
179
+ + # pad the `pad` to be length = 6 (right padding), for example [1, 2] -> [1, 2, 0, 0, 0, 0]
180
+ + if isinstance(pad, (Variable, paddle.pir.Value)):
181
+ + pad_len = pad.shape[0]
182
+ + _check_valid_pad_len(pad_len, x_dim, is_constant_mode)
183
+ + pad = paddle.concat(
184
+ + [
185
+ + pad,
186
+ + paddle.zeros((6 - pad_len,), dtype="int32"),
187
+ + ],
188
+ + axis=0,
189
+ + )
190
+ + else:
191
+ + pad = list(pad)
192
+ + pad_len = len(pad)
193
+ + _check_valid_pad_len(pad_len, x_dim, is_constant_mode)
194
+ + pad.extend([0] * (6 - pad_len))
195
+ +
196
+ + ndim_to_unsqueeze = list(range(5 - x_dim))
197
+ + input = input.unsqueeze(axis=ndim_to_unsqueeze)
198
+ +
199
+ + out = _C_ops.pad3d(
200
+ + input,
201
+ + pad.tolist() if isinstance(pad, Variable) else pad,
202
+ + mode,
203
+ + value,
204
+ + "NCDHW",
205
+ + )
206
+ + if ndim_to_unsqueeze:
207
+ + return out.squeeze(axis=ndim_to_unsqueeze)
208
+ + return out
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/harness.yaml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task_id: paddlepaddle_paconvert_paddle_d3f5712cbcf6
2
+ hidden_test_patches:
3
+ - repo: PaConvert
4
+ patch: hidden/patches/PaConvert-hidden-tests.patch
5
+ test_profile: paconvert-hidden
6
+ origin: upstream_test_diff
7
+ source_file: &id001
8
+ - tests/test_nn_functional_pad.py
9
+ hidden_file: *id001
10
+ semantic_changes: none
11
+ source: upstream test changes from PaddlePaddle/PaConvert PR(s) 697
12
+ - repo: Paddle
13
+ patch: hidden/patches/Paddle-hidden-tests.patch
14
+ test_profile: paddle-hidden
15
+ origin: upstream_test_diff
16
+ source_file: &id002
17
+ - test/legacy_test/test_compat_pad.py
18
+ hidden_file: *id002
19
+ semantic_changes: Normalize padding examples to explicit PyTorch-style left/right
20
+ pairs; require invalid calls to be rejected without fixing exception classes or
21
+ messages; omit the prompt-absent constant-mode 6D rejection requirement.
22
+ source: upstream test changes from PaddlePaddle/Paddle PR(s) 75200
23
+ profile_sets:
24
+ linux-docker:
25
+ description: Candidate profiles generated from upstream test-file diffs; commands
26
+ require manual completion.
27
+ hidden_tests:
28
+ - paconvert-hidden
29
+ - paddle-hidden
30
+ cross_repo_contract: []
31
+ matrix_expectations:
32
+ base_hidden: fail
33
+ gold_hidden: pass
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/hidden/patches/PaConvert-hidden-tests.patch ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/test_nn_functional_pad.py b/tests/test_nn_functional_pad.py
2
+ index 2a4b976..f393a1f 100644
3
+ --- a/tests/test_nn_functional_pad.py
4
+ +++ b/tests/test_nn_functional_pad.py
5
+ @@ -283,3 +283,115 @@ def test_case_20():
6
+ """
7
+ )
8
+ obj.run(pytorch_code, ["result1", "result2", "result3"])
9
+ +
10
+ +
11
+ +def test_case_21():
12
+ + "Test single dim with backward"
13
+ + pytorch_code = textwrap.dedent(
14
+ + """
15
+ + import torch
16
+ + import torch.nn.functional as F
17
+ + x_shape = (3)
18
+ + x = torch.arange(3, dtype=torch.float32) + 1
19
+ + x.requires_grad = True
20
+ + result = F.pad(x, (2, 0), mode='constant')
21
+ + result.sum().backward()
22
+ + x_grad = x.grad
23
+ + x_grad.requires_grad = False
24
+ + """
25
+ + )
26
+ + obj.run(pytorch_code, ["result", "x_grad"])
27
+ +
28
+ +
29
+ +def test_case_22():
30
+ + "Test 3D & reflect with backward"
31
+ + pytorch_code = textwrap.dedent(
32
+ + """
33
+ + import torch
34
+ + import torch.nn.functional as F
35
+ + x_shape = (3, 4, 2)
36
+ + x = torch.arange(24, dtype=torch.float32).reshape(x_shape) + 1
37
+ + x.requires_grad = True
38
+ + y = x * x + x
39
+ + result = F.pad(y, (1, 0, 1, 2), mode='reflect')
40
+ + result.sum().backward()
41
+ + x_grad = x.grad
42
+ + x_grad.requires_grad = False
43
+ + """
44
+ + )
45
+ + obj.run(pytorch_code, ["result", "x_grad"])
46
+ +
47
+ +
48
+ +def test_case_23():
49
+ + "Test 2D with backward"
50
+ + pytorch_code = textwrap.dedent(
51
+ + """
52
+ + import torch
53
+ + import torch.nn.functional as F
54
+ + x_shape = (3, 2)
55
+ + x = torch.arange(6, dtype=torch.float64).reshape(x_shape) + 1
56
+ + x.requires_grad = True
57
+ + y = 2 * x
58
+ + result = F.pad(y, (0, 1), mode='circular')
59
+ + result.sum().backward()
60
+ + x_grad = x.grad
61
+ + x_grad.requires_grad = False
62
+ + """
63
+ + )
64
+ + obj.run(pytorch_code, ["result", "x_grad"])
65
+ +
66
+ +
67
+ +def test_case_24():
68
+ + "Test constant multi-dim case 1"
69
+ + pytorch_code = textwrap.dedent(
70
+ + """
71
+ + import torch
72
+ + import torch.nn.functional as F
73
+ + x_shape = (1, 2, 3, 4, 5, 1)
74
+ + x = torch.arange(120, dtype=torch.int32).reshape(x_shape) + 1
75
+ + result = F.pad(x, (1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0), mode='constant', value=-99)
76
+ + """
77
+ + )
78
+ + obj.run(pytorch_code, ["result"])
79
+ +
80
+ +
81
+ +def test_case_25():
82
+ + "Test constant multi-dim case 2"
83
+ + pytorch_code = textwrap.dedent(
84
+ + """
85
+ + import torch
86
+ + import torch.nn.functional as F
87
+ + x_shape = (1, 2, 3, 4, 5, 1)
88
+ + x = torch.arange(120, dtype=torch.int32).reshape(x_shape) + 1
89
+ + result = F.pad(x, (1, 1, 0, 0, 1, 1, 0, 0, 1, 1), mode='constant', value=-99)
90
+ + """
91
+ + )
92
+ + obj.run(pytorch_code, ["result"])
93
+ +
94
+ +
95
+ +def test_case_26():
96
+ + "Test constant multi-dim case 3"
97
+ + pytorch_code = textwrap.dedent(
98
+ + """
99
+ + import torch
100
+ + import torch.nn.functional as F
101
+ + x_shape = (1, 2, 3, 4, 5, 1)
102
+ + x = torch.arange(120, dtype=torch.int32).reshape(x_shape) + 1
103
+ + result = F.pad(x, (1, 1), mode='constant', value=-99)
104
+ + """
105
+ + )
106
+ + obj.run(pytorch_code, ["result"])
107
+ +
108
+ +
109
+ +def test_case_27():
110
+ + "Test replicate"
111
+ + pytorch_code = textwrap.dedent(
112
+ + """
113
+ + import torch
114
+ + import torch.nn.functional as F
115
+ + x_shape = (1, 2, 3, 4, 5)
116
+ + x = torch.arange(120, dtype=torch.int32).reshape(x_shape) + 1
117
+ + result = F.pad(x, (1, 1, 0, 2, 4, 2), mode='replicate')
118
+ + """
119
+ + )
120
+ + obj.run(pytorch_code, ["result"])
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/hidden/patches/Paddle-hidden-tests.patch ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/legacy_test/test_compat_pad.py b/test/legacy_test/test_compat_pad.py
2
+ new file mode 100644
3
+ index 0000000000..d437b9ad34
4
+ --- /dev/null
5
+ +++ b/test/legacy_test/test_compat_pad.py
6
+ @@ -0,0 +1,228 @@
7
+ +# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
8
+ +#
9
+ +# Licensed under the Apache License, Version 2.0 (the "License");
10
+ +# you may not use this file except in compliance with the License.
11
+ +# You may obtain a copy of the License at
12
+ +#
13
+ +# http://www.apache.org/licenses/LICENSE-2.0
14
+ +#
15
+ +# Unless required by applicable law or agreed to in writing, software
16
+ +# distributed under the License is distributed on an "AS IS" BASIS,
17
+ +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ +# See the License for the specific language governing permissions and
19
+ +# limitations under the License.
20
+ +
21
+ +import unittest
22
+ +
23
+ +import numpy as np
24
+ +
25
+ +import paddle
26
+ +import paddle.compat as F
27
+ +
28
+ +
29
+ +class TestCompatPad(unittest.TestCase):
30
+ + def test_basic_pad(self):
31
+ + """Test basic splitting with integer size"""
32
+ + gt = np.array(
33
+ + [
34
+ + [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]],
35
+ + [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]],
36
+ + [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [0.0, 0.0]],
37
+ + [[7.0, 8.0], [9.0, 10.0], [11.0, 12.0], [0.0, 0.0]],
38
+ + [[13.0, 14.0], [15.0, 16.0], [17.0, 18.0], [0.0, 0.0]],
39
+ + [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]],
40
+ + [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]],
41
+ + [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]],
42
+ + ],
43
+ + dtype=np.float32,
44
+ + )
45
+ + x_shape = (3, 3, 2)
46
+ + x = (
47
+ + paddle.arange(
48
+ + paddle.prod(paddle.Tensor(x_shape)), dtype=paddle.float32
49
+ + ).reshape(x_shape)
50
+ + + 1
51
+ + )
52
+ + result = F.pad(
53
+ + input=x, pad=[0, 0, 0, 1, 2, 3], mode='constant', value=0
54
+ + )
55
+ +
56
+ + np.testing.assert_allclose(result.numpy(), gt)
57
+ +
58
+ + def test_constant_fast_pass(self):
59
+ + gt_res = np.array(
60
+ + [
61
+ + [[-1, -1, -1, -1, -1], [-1, 0, 1, -1, -1], [-1, 2, 3, -1, -1]],
62
+ + [[-1, -1, -1, -1, -1], [-1, 4, 5, -1, -1], [-1, 6, 7, -1, -1]],
63
+ + [
64
+ + [-1, -1, -1, -1, -1],
65
+ + [-1, 8, 9, -1, -1],
66
+ + [-1, 10, 11, -1, -1],
67
+ + ],
68
+ + ],
69
+ + dtype=np.int64,
70
+ + )
71
+ +
72
+ + def const_pad_dy(x, pad_shape):
73
+ + return F.pad(input=x, pad=pad_shape, mode='constant', value=-1)
74
+ +
75
+ + @paddle.jit.to_static(full_graph=True)
76
+ + def const_pad_st(x, pad_shape):
77
+ + return F.pad(
78
+ + input=x,
79
+ + pad=pad_shape,
80
+ + mode='constant',
81
+ + value=paddle.to_tensor(-1),
82
+ + )
83
+ +
84
+ + x = paddle.arange(12).reshape(3, 2, 2)
85
+ + res_dy = const_pad_dy(x, [1, 2, 1, 0])
86
+ + res_st = const_pad_st(x, [1, 2, 1, 0])
87
+ +
88
+ + np.testing.assert_array_equal(res_dy.numpy(), gt_res)
89
+ + np.testing.assert_array_equal(res_st.numpy(), gt_res)
90
+ +
91
+ + def test_single_dim(self):
92
+ + gt = np.array([0, 0, 1, 2], dtype=np.float64)
93
+ + x_shape = 2
94
+ + x = paddle.arange(2, dtype=paddle.float64) + 1
95
+ + result = F.pad(x, mode='constant', pad=[2, 0])
96
+ + np.testing.assert_allclose(result.numpy(), gt)
97
+ +
98
+ + def test_no_pad(self):
99
+ + gt = np.array(
100
+ + [
101
+ + [
102
+ + [
103
+ + [[0.0, 0.0, 1.0], [2.0, 2.0, 3.0], [2.0, 2.0, 3.0]],
104
+ + [[4.0, 4.0, 5.0], [6.0, 6.0, 7.0], [6.0, 6.0, 7.0]],
105
+ + ],
106
+ + [
107
+ + [
108
+ + [8.0, 8.0, 9.0],
109
+ + [10.0, 10.0, 11.0],
110
+ + [10.0, 10.0, 11.0],
111
+ + ],
112
+ + [
113
+ + [12.0, 12.0, 13.0],
114
+ + [14.0, 14.0, 15.0],
115
+ + [14.0, 14.0, 15.0],
116
+ + ],
117
+ + ],
118
+ + ],
119
+ + [
120
+ + [
121
+ + [
122
+ + [16.0, 16.0, 17.0],
123
+ + [18.0, 18.0, 19.0],
124
+ + [18.0, 18.0, 19.0],
125
+ + ],
126
+ + [
127
+ + [20.0, 20.0, 21.0],
128
+ + [22.0, 22.0, 23.0],
129
+ + [22.0, 22.0, 23.0],
130
+ + ],
131
+ + ],
132
+ + [
133
+ + [
134
+ + [24.0, 24.0, 25.0],
135
+ + [26.0, 26.0, 27.0],
136
+ + [26.0, 26.0, 27.0],
137
+ + ],
138
+ + [
139
+ + [28.0, 28.0, 29.0],
140
+ + [30.0, 30.0, 31.0],
141
+ + [30.0, 30.0, 31.0],
142
+ + ],
143
+ + ],
144
+ + ],
145
+ + ],
146
+ + dtype=np.float64,
147
+ + )
148
+ + x = paddle.arange(32, dtype=paddle.float64).reshape([2] * 5)
149
+ + result = F.pad(x, mode='replicate', pad=[1, 0, 0, 1, 0, 0])
150
+ + np.testing.assert_allclose(result.numpy(), gt)
151
+ +
152
+ + def test_static_graph_circular(self):
153
+ + cir_gt = np.array(
154
+ + [
155
+ + [
156
+ + [10.0, 11.0, 8.0, 9.0, 10.0, 11.0, 8.0],
157
+ + [2.0, 3.0, 0.0, 1.0, 2.0, 3.0, 0.0],
158
+ + [6.0, 7.0, 4.0, 5.0, 6.0, 7.0, 4.0],
159
+ + [10.0, 11.0, 8.0, 9.0, 10.0, 11.0, 8.0],
160
+ + ],
161
+ + [
162
+ + [22.0, 23.0, 20.0, 21.0, 22.0, 23.0, 20.0],
163
+ + [14.0, 15.0, 12.0, 13.0, 14.0, 15.0, 12.0],
164
+ + [18.0, 19.0, 16.0, 17.0, 18.0, 19.0, 16.0],
165
+ + [22.0, 23.0, 20.0, 21.0, 22.0, 23.0, 20.0],
166
+ + ],
167
+ + ],
168
+ + dtype=np.float32,
169
+ + )
170
+ + paddle.enable_static()
171
+ + with paddle.static.program_guard(paddle.static.Program()):
172
+ + input_tensor = paddle.arange(24, dtype=paddle.float32).reshape(
173
+ + [2, 3, 4]
174
+ + )
175
+ +
176
+ + pad = paddle.to_tensor([2, 1, 1, 0], dtype="int32")
177
+ + result = F.pad(input_tensor, pad=pad, mode='circular')
178
+ +
179
+ + place = (
180
+ + paddle.CUDAPlace(0)
181
+ + if paddle.base.is_compiled_with_cuda()
182
+ + else paddle.CPUPlace()
183
+ + )
184
+ + exe = paddle.static.Executor(place)
185
+ + cir_res = exe.run(fetch_list=[result])
186
+ + np.testing.assert_allclose(cir_res[0], cir_gt)
187
+ + paddle.disable_static()
188
+ +
189
+ + def test_dyn_graph_reflect(self):
190
+ + x = paddle.full([10, 10], 2, dtype=paddle.float64)
191
+ + result = F.pad(x, mode='reflect', pad=(1, 0))
192
+ + np.testing.assert_allclose(
193
+ + result.numpy(), np.full([10, 11], 2, dtype=np.float64)
194
+ + )
195
+ +
196
+ + def test_special_cases(self):
197
+ + # empty padding tensor
198
+ + x = paddle.randn([10, 7], dtype=paddle.float64)
199
+ + result = F.pad(x, mode='replicate', pad=paddle.tensor([]))
200
+ + np.testing.assert_allclose(result.numpy(), x.numpy())
201
+ +
202
+ + def test_error_handling(self):
203
+ + dummy_x = paddle.arange(3)
204
+ + rejection_errors = (TypeError, ValueError, AssertionError, RuntimeError)
205
+ +
206
+ + with self.assertRaises(rejection_errors):
207
+ + F.pad(
208
+ + x=dummy_x,
209
+ + mode='constant',
210
+ + pad=paddle.to_tensor(2),
211
+ + name='pad_layer',
212
+ + )
213
+ +
214
+ + with self.assertRaises(rejection_errors):
215
+ + F.pad(paddle.arange(2), mode='circular', pad=[0, 1])
216
+ +
217
+ + with self.assertRaises(rejection_errors):
218
+ + F.pad(paddle.arange(2), mode='mirror', pad=[0, 1])
219
+ +
220
+ + with self.assertRaises(rejection_errors):
221
+ + F.pad(
222
+ + paddle.ones([2, 3, 4]),
223
+ + mode='replicate',
224
+ + pad=[0, 1, 1, 1, 1, 1, 1, 1],
225
+ + )
226
+ +
227
+ + with self.assertRaises(rejection_errors):
228
+ + F.pad(
229
+ + paddle.ones([2, 3]), mode='replicate', pad=[0, 1, 1, 1]
230
+ + )
231
+ +
232
+ +
233
+ +if __name__ == '__main__':
234
+ + unittest.main()
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/oracles/hidden_test_oracle.json ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 2,
3
+ "task_id": "paddlepaddle_paconvert_paddle_d3f5712cbcf6",
4
+ "profile_set": "linux-docker",
5
+ "oracle_type": "swe-bench-style-hidden-tests",
6
+ "description": "Derived by comparing base+hidden-test-patch with gold+hidden-test-patch.",
7
+ "totals": {
8
+ "fail_to_pass": 10,
9
+ "pass_to_pass": 25,
10
+ "fail_to_fail": 0,
11
+ "pass_to_fail": 0,
12
+ "skipped": 0,
13
+ "missing_in_base": 0,
14
+ "missing_in_gold": 0
15
+ },
16
+ "scoring_policy": {
17
+ "fail_to_pass": "native_fail_to_pass + missing_to_pass(gold_status=passed)",
18
+ "pass_to_pass": "all fixed pass_to_pass rows; an empty set passes vacuously"
19
+ },
20
+ "scoring_totals": {
21
+ "native_fail_to_pass": 10,
22
+ "missing_to_pass": 0,
23
+ "fail_to_pass": 10,
24
+ "pass_to_pass": 25
25
+ },
26
+ "profiles": [
27
+ {
28
+ "profile": "paconvert-hidden",
29
+ "case_level": true,
30
+ "base_exit_code": 1,
31
+ "gold_exit_code": 0,
32
+ "base_passed": false,
33
+ "gold_passed": true,
34
+ "counts": {
35
+ "fail_to_pass": 2,
36
+ "pass_to_pass": 25,
37
+ "fail_to_fail": 0,
38
+ "pass_to_fail": 0,
39
+ "skipped": 0,
40
+ "missing_in_base": 0,
41
+ "missing_in_gold": 0
42
+ },
43
+ "fail_to_pass": [
44
+ {
45
+ "id": "test_nn_functional_pad::test_case_22",
46
+ "name": "test_case_22",
47
+ "classname": "test_nn_functional_pad",
48
+ "file": null,
49
+ "base_status": "failed",
50
+ "gold_status": "passed",
51
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
52
+ },
53
+ {
54
+ "id": "test_nn_functional_pad::test_case_23",
55
+ "name": "test_case_23",
56
+ "classname": "test_nn_functional_pad",
57
+ "file": null,
58
+ "base_status": "failed",
59
+ "gold_status": "passed",
60
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
61
+ }
62
+ ],
63
+ "pass_to_pass": [
64
+ {
65
+ "id": "test_nn_functional_pad::test_case_1",
66
+ "name": "test_case_1",
67
+ "classname": "test_nn_functional_pad",
68
+ "file": null,
69
+ "base_status": "passed",
70
+ "gold_status": "passed",
71
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
72
+ },
73
+ {
74
+ "id": "test_nn_functional_pad::test_case_10",
75
+ "name": "test_case_10",
76
+ "classname": "test_nn_functional_pad",
77
+ "file": null,
78
+ "base_status": "passed",
79
+ "gold_status": "passed",
80
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
81
+ },
82
+ {
83
+ "id": "test_nn_functional_pad::test_case_11",
84
+ "name": "test_case_11",
85
+ "classname": "test_nn_functional_pad",
86
+ "file": null,
87
+ "base_status": "passed",
88
+ "gold_status": "passed",
89
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
90
+ },
91
+ {
92
+ "id": "test_nn_functional_pad::test_case_12",
93
+ "name": "test_case_12",
94
+ "classname": "test_nn_functional_pad",
95
+ "file": null,
96
+ "base_status": "passed",
97
+ "gold_status": "passed",
98
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
99
+ },
100
+ {
101
+ "id": "test_nn_functional_pad::test_case_13",
102
+ "name": "test_case_13",
103
+ "classname": "test_nn_functional_pad",
104
+ "file": null,
105
+ "base_status": "passed",
106
+ "gold_status": "passed",
107
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
108
+ },
109
+ {
110
+ "id": "test_nn_functional_pad::test_case_14",
111
+ "name": "test_case_14",
112
+ "classname": "test_nn_functional_pad",
113
+ "file": null,
114
+ "base_status": "passed",
115
+ "gold_status": "passed",
116
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
117
+ },
118
+ {
119
+ "id": "test_nn_functional_pad::test_case_15",
120
+ "name": "test_case_15",
121
+ "classname": "test_nn_functional_pad",
122
+ "file": null,
123
+ "base_status": "passed",
124
+ "gold_status": "passed",
125
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
126
+ },
127
+ {
128
+ "id": "test_nn_functional_pad::test_case_16",
129
+ "name": "test_case_16",
130
+ "classname": "test_nn_functional_pad",
131
+ "file": null,
132
+ "base_status": "passed",
133
+ "gold_status": "passed",
134
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
135
+ },
136
+ {
137
+ "id": "test_nn_functional_pad::test_case_17",
138
+ "name": "test_case_17",
139
+ "classname": "test_nn_functional_pad",
140
+ "file": null,
141
+ "base_status": "passed",
142
+ "gold_status": "passed",
143
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
144
+ },
145
+ {
146
+ "id": "test_nn_functional_pad::test_case_18",
147
+ "name": "test_case_18",
148
+ "classname": "test_nn_functional_pad",
149
+ "file": null,
150
+ "base_status": "passed",
151
+ "gold_status": "passed",
152
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
153
+ },
154
+ {
155
+ "id": "test_nn_functional_pad::test_case_19",
156
+ "name": "test_case_19",
157
+ "classname": "test_nn_functional_pad",
158
+ "file": null,
159
+ "base_status": "passed",
160
+ "gold_status": "passed",
161
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
162
+ },
163
+ {
164
+ "id": "test_nn_functional_pad::test_case_2",
165
+ "name": "test_case_2",
166
+ "classname": "test_nn_functional_pad",
167
+ "file": null,
168
+ "base_status": "passed",
169
+ "gold_status": "passed",
170
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
171
+ },
172
+ {
173
+ "id": "test_nn_functional_pad::test_case_20",
174
+ "name": "test_case_20",
175
+ "classname": "test_nn_functional_pad",
176
+ "file": null,
177
+ "base_status": "passed",
178
+ "gold_status": "passed",
179
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
180
+ },
181
+ {
182
+ "id": "test_nn_functional_pad::test_case_21",
183
+ "name": "test_case_21",
184
+ "classname": "test_nn_functional_pad",
185
+ "file": null,
186
+ "base_status": "passed",
187
+ "gold_status": "passed",
188
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
189
+ },
190
+ {
191
+ "id": "test_nn_functional_pad::test_case_24",
192
+ "name": "test_case_24",
193
+ "classname": "test_nn_functional_pad",
194
+ "file": null,
195
+ "base_status": "passed",
196
+ "gold_status": "passed",
197
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
198
+ },
199
+ {
200
+ "id": "test_nn_functional_pad::test_case_25",
201
+ "name": "test_case_25",
202
+ "classname": "test_nn_functional_pad",
203
+ "file": null,
204
+ "base_status": "passed",
205
+ "gold_status": "passed",
206
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
207
+ },
208
+ {
209
+ "id": "test_nn_functional_pad::test_case_26",
210
+ "name": "test_case_26",
211
+ "classname": "test_nn_functional_pad",
212
+ "file": null,
213
+ "base_status": "passed",
214
+ "gold_status": "passed",
215
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
216
+ },
217
+ {
218
+ "id": "test_nn_functional_pad::test_case_27",
219
+ "name": "test_case_27",
220
+ "classname": "test_nn_functional_pad",
221
+ "file": null,
222
+ "base_status": "passed",
223
+ "gold_status": "passed",
224
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
225
+ },
226
+ {
227
+ "id": "test_nn_functional_pad::test_case_3",
228
+ "name": "test_case_3",
229
+ "classname": "test_nn_functional_pad",
230
+ "file": null,
231
+ "base_status": "passed",
232
+ "gold_status": "passed",
233
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
234
+ },
235
+ {
236
+ "id": "test_nn_functional_pad::test_case_4",
237
+ "name": "test_case_4",
238
+ "classname": "test_nn_functional_pad",
239
+ "file": null,
240
+ "base_status": "passed",
241
+ "gold_status": "passed",
242
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
243
+ },
244
+ {
245
+ "id": "test_nn_functional_pad::test_case_5",
246
+ "name": "test_case_5",
247
+ "classname": "test_nn_functional_pad",
248
+ "file": null,
249
+ "base_status": "passed",
250
+ "gold_status": "passed",
251
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
252
+ },
253
+ {
254
+ "id": "test_nn_functional_pad::test_case_6",
255
+ "name": "test_case_6",
256
+ "classname": "test_nn_functional_pad",
257
+ "file": null,
258
+ "base_status": "passed",
259
+ "gold_status": "passed",
260
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
261
+ },
262
+ {
263
+ "id": "test_nn_functional_pad::test_case_7",
264
+ "name": "test_case_7",
265
+ "classname": "test_nn_functional_pad",
266
+ "file": null,
267
+ "base_status": "passed",
268
+ "gold_status": "passed",
269
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
270
+ },
271
+ {
272
+ "id": "test_nn_functional_pad::test_case_8",
273
+ "name": "test_case_8",
274
+ "classname": "test_nn_functional_pad",
275
+ "file": null,
276
+ "base_status": "passed",
277
+ "gold_status": "passed",
278
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
279
+ },
280
+ {
281
+ "id": "test_nn_functional_pad::test_case_9",
282
+ "name": "test_case_9",
283
+ "classname": "test_nn_functional_pad",
284
+ "file": null,
285
+ "base_status": "passed",
286
+ "gold_status": "passed",
287
+ "source_report": ".ecosyncbench/test-reports/paconvert-hidden.xml"
288
+ }
289
+ ],
290
+ "fail_to_fail": [],
291
+ "pass_to_fail": [],
292
+ "skipped": [],
293
+ "missing_in_base": [],
294
+ "missing_in_gold": [],
295
+ "repo": "PaConvert",
296
+ "scoring_counts": {
297
+ "native_fail_to_pass": 2,
298
+ "missing_to_pass": 0,
299
+ "fail_to_pass": 2,
300
+ "pass_to_pass": 25
301
+ }
302
+ },
303
+ {
304
+ "profile": "paddle-hidden",
305
+ "case_level": true,
306
+ "base_exit_code": 1,
307
+ "gold_exit_code": 0,
308
+ "base_passed": false,
309
+ "gold_passed": true,
310
+ "counts": {
311
+ "fail_to_pass": 8,
312
+ "pass_to_pass": 0,
313
+ "fail_to_fail": 0,
314
+ "pass_to_fail": 0,
315
+ "skipped": 0,
316
+ "missing_in_base": 0,
317
+ "missing_in_gold": 0
318
+ },
319
+ "fail_to_pass": [
320
+ {
321
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_basic_pad",
322
+ "name": "test_basic_pad",
323
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
324
+ "file": null,
325
+ "base_status": "failed",
326
+ "gold_status": "passed",
327
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
328
+ },
329
+ {
330
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_constant_fast_pass",
331
+ "name": "test_constant_fast_pass",
332
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
333
+ "file": null,
334
+ "base_status": "failed",
335
+ "gold_status": "passed",
336
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
337
+ },
338
+ {
339
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_dyn_graph_reflect",
340
+ "name": "test_dyn_graph_reflect",
341
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
342
+ "file": null,
343
+ "base_status": "failed",
344
+ "gold_status": "passed",
345
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
346
+ },
347
+ {
348
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_error_handling",
349
+ "name": "test_error_handling",
350
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
351
+ "file": null,
352
+ "base_status": "failed",
353
+ "gold_status": "passed",
354
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
355
+ },
356
+ {
357
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_no_pad",
358
+ "name": "test_no_pad",
359
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
360
+ "file": null,
361
+ "base_status": "failed",
362
+ "gold_status": "passed",
363
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
364
+ },
365
+ {
366
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_single_dim",
367
+ "name": "test_single_dim",
368
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
369
+ "file": null,
370
+ "base_status": "failed",
371
+ "gold_status": "passed",
372
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
373
+ },
374
+ {
375
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_special_cases",
376
+ "name": "test_special_cases",
377
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
378
+ "file": null,
379
+ "base_status": "failed",
380
+ "gold_status": "passed",
381
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
382
+ },
383
+ {
384
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_static_graph_circular",
385
+ "name": "test_static_graph_circular",
386
+ "classname": "test.legacy_test.test_compat_pad.TestCompatPad",
387
+ "file": null,
388
+ "base_status": "failed",
389
+ "gold_status": "passed",
390
+ "source_report": ".ecosyncbench/test-reports/paddle-hidden.xml"
391
+ }
392
+ ],
393
+ "pass_to_pass": [],
394
+ "fail_to_fail": [],
395
+ "pass_to_fail": [],
396
+ "skipped": [],
397
+ "missing_in_base": [],
398
+ "missing_in_gold": [],
399
+ "repo": "Paddle",
400
+ "scoring_counts": {
401
+ "native_fail_to_pass": 8,
402
+ "missing_to_pass": 0,
403
+ "fail_to_pass": 8,
404
+ "pass_to_pass": 0
405
+ }
406
+ }
407
+ ],
408
+ "ok": true
409
+ }
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/oracles/scoring_manifest.json ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "ecosyncbench.scoring_manifest.v2",
3
+ "task_id": "paddlepaddle_paconvert_paddle_d3f5712cbcf6",
4
+ "oracle": {
5
+ "path": "oracles/hidden_test_oracle.json",
6
+ "sha256": "1ffc8b7b2d327d5b900cec6c880142e203c69d6f673d792f8422f2aea76e76ab",
7
+ "profile_set": "linux-docker"
8
+ },
9
+ "scoring_policy": {
10
+ "fail_to_pass": "native_fail_to_pass + missing_to_pass(gold_status=passed)",
11
+ "pass_to_pass": "all fixed pass_to_pass rows; an empty set passes vacuously",
12
+ "test_ids": "frozen by the referenced hidden_test_oracle.json SHA-256"
13
+ },
14
+ "totals": {
15
+ "native_fail_to_pass": 10,
16
+ "missing_to_pass": 0,
17
+ "fail_to_pass": 10,
18
+ "pass_to_pass": 25
19
+ },
20
+ "rq2_totals": {
21
+ "native_fail_to_pass": 10,
22
+ "missing_to_pass": 0,
23
+ "fail_to_pass": 10,
24
+ "pass_to_pass": 25
25
+ },
26
+ "repos": [
27
+ {
28
+ "repo": "PaConvert",
29
+ "profiles": [
30
+ "paconvert-hidden"
31
+ ],
32
+ "native_fail_to_pass": 2,
33
+ "missing_to_pass": 0,
34
+ "fail_to_pass": 2,
35
+ "pass_to_pass": 25,
36
+ "test_ids": {
37
+ "native_fail_to_pass": [
38
+ {
39
+ "profile": "paconvert-hidden",
40
+ "id": "test_nn_functional_pad::test_case_22"
41
+ },
42
+ {
43
+ "profile": "paconvert-hidden",
44
+ "id": "test_nn_functional_pad::test_case_23"
45
+ }
46
+ ],
47
+ "missing_to_pass": [],
48
+ "fail_to_pass": [
49
+ {
50
+ "profile": "paconvert-hidden",
51
+ "id": "test_nn_functional_pad::test_case_22"
52
+ },
53
+ {
54
+ "profile": "paconvert-hidden",
55
+ "id": "test_nn_functional_pad::test_case_23"
56
+ }
57
+ ],
58
+ "pass_to_pass": [
59
+ {
60
+ "profile": "paconvert-hidden",
61
+ "id": "test_nn_functional_pad::test_case_1"
62
+ },
63
+ {
64
+ "profile": "paconvert-hidden",
65
+ "id": "test_nn_functional_pad::test_case_10"
66
+ },
67
+ {
68
+ "profile": "paconvert-hidden",
69
+ "id": "test_nn_functional_pad::test_case_11"
70
+ },
71
+ {
72
+ "profile": "paconvert-hidden",
73
+ "id": "test_nn_functional_pad::test_case_12"
74
+ },
75
+ {
76
+ "profile": "paconvert-hidden",
77
+ "id": "test_nn_functional_pad::test_case_13"
78
+ },
79
+ {
80
+ "profile": "paconvert-hidden",
81
+ "id": "test_nn_functional_pad::test_case_14"
82
+ },
83
+ {
84
+ "profile": "paconvert-hidden",
85
+ "id": "test_nn_functional_pad::test_case_15"
86
+ },
87
+ {
88
+ "profile": "paconvert-hidden",
89
+ "id": "test_nn_functional_pad::test_case_16"
90
+ },
91
+ {
92
+ "profile": "paconvert-hidden",
93
+ "id": "test_nn_functional_pad::test_case_17"
94
+ },
95
+ {
96
+ "profile": "paconvert-hidden",
97
+ "id": "test_nn_functional_pad::test_case_18"
98
+ },
99
+ {
100
+ "profile": "paconvert-hidden",
101
+ "id": "test_nn_functional_pad::test_case_19"
102
+ },
103
+ {
104
+ "profile": "paconvert-hidden",
105
+ "id": "test_nn_functional_pad::test_case_2"
106
+ },
107
+ {
108
+ "profile": "paconvert-hidden",
109
+ "id": "test_nn_functional_pad::test_case_20"
110
+ },
111
+ {
112
+ "profile": "paconvert-hidden",
113
+ "id": "test_nn_functional_pad::test_case_21"
114
+ },
115
+ {
116
+ "profile": "paconvert-hidden",
117
+ "id": "test_nn_functional_pad::test_case_24"
118
+ },
119
+ {
120
+ "profile": "paconvert-hidden",
121
+ "id": "test_nn_functional_pad::test_case_25"
122
+ },
123
+ {
124
+ "profile": "paconvert-hidden",
125
+ "id": "test_nn_functional_pad::test_case_26"
126
+ },
127
+ {
128
+ "profile": "paconvert-hidden",
129
+ "id": "test_nn_functional_pad::test_case_27"
130
+ },
131
+ {
132
+ "profile": "paconvert-hidden",
133
+ "id": "test_nn_functional_pad::test_case_3"
134
+ },
135
+ {
136
+ "profile": "paconvert-hidden",
137
+ "id": "test_nn_functional_pad::test_case_4"
138
+ },
139
+ {
140
+ "profile": "paconvert-hidden",
141
+ "id": "test_nn_functional_pad::test_case_5"
142
+ },
143
+ {
144
+ "profile": "paconvert-hidden",
145
+ "id": "test_nn_functional_pad::test_case_6"
146
+ },
147
+ {
148
+ "profile": "paconvert-hidden",
149
+ "id": "test_nn_functional_pad::test_case_7"
150
+ },
151
+ {
152
+ "profile": "paconvert-hidden",
153
+ "id": "test_nn_functional_pad::test_case_8"
154
+ },
155
+ {
156
+ "profile": "paconvert-hidden",
157
+ "id": "test_nn_functional_pad::test_case_9"
158
+ }
159
+ ]
160
+ }
161
+ },
162
+ {
163
+ "repo": "Paddle",
164
+ "profiles": [
165
+ "paddle-hidden"
166
+ ],
167
+ "native_fail_to_pass": 8,
168
+ "missing_to_pass": 0,
169
+ "fail_to_pass": 8,
170
+ "pass_to_pass": 0,
171
+ "test_ids": {
172
+ "native_fail_to_pass": [
173
+ {
174
+ "profile": "paddle-hidden",
175
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_basic_pad"
176
+ },
177
+ {
178
+ "profile": "paddle-hidden",
179
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_constant_fast_pass"
180
+ },
181
+ {
182
+ "profile": "paddle-hidden",
183
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_dyn_graph_reflect"
184
+ },
185
+ {
186
+ "profile": "paddle-hidden",
187
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_error_handling"
188
+ },
189
+ {
190
+ "profile": "paddle-hidden",
191
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_no_pad"
192
+ },
193
+ {
194
+ "profile": "paddle-hidden",
195
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_single_dim"
196
+ },
197
+ {
198
+ "profile": "paddle-hidden",
199
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_special_cases"
200
+ },
201
+ {
202
+ "profile": "paddle-hidden",
203
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_static_graph_circular"
204
+ }
205
+ ],
206
+ "missing_to_pass": [],
207
+ "fail_to_pass": [
208
+ {
209
+ "profile": "paddle-hidden",
210
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_basic_pad"
211
+ },
212
+ {
213
+ "profile": "paddle-hidden",
214
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_constant_fast_pass"
215
+ },
216
+ {
217
+ "profile": "paddle-hidden",
218
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_dyn_graph_reflect"
219
+ },
220
+ {
221
+ "profile": "paddle-hidden",
222
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_error_handling"
223
+ },
224
+ {
225
+ "profile": "paddle-hidden",
226
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_no_pad"
227
+ },
228
+ {
229
+ "profile": "paddle-hidden",
230
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_single_dim"
231
+ },
232
+ {
233
+ "profile": "paddle-hidden",
234
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_special_cases"
235
+ },
236
+ {
237
+ "profile": "paddle-hidden",
238
+ "id": "test.legacy_test.test_compat_pad.TestCompatPad::test_static_graph_circular"
239
+ }
240
+ ],
241
+ "pass_to_pass": []
242
+ }
243
+ }
244
+ ],
245
+ "valid": true,
246
+ "errors": []
247
+ }
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/prompt.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Add `paddle.compat.pad` with behavior compatible with `torch.nn.functional.pad`, and add the matching PaConvert conversion support.
2
+
3
+ Support the PyTorch-style signature `input`, `pad`, `mode`, and `value`, including `constant`, `reflect`, `replicate`, and `circular` padding behavior. Padding should start from the last dimension; `pad` may be a Tensor, list, or tuple, and an empty padding specification should leave the input unchanged. Non-constant padding should support 2D through 5D inputs and at most the last three dimensions, while constant padding should support compatible one- and multi-dimensional padding. Preserve behavior in dynamic and static execution and through gradient computation.
4
+
5
+ Keep `paddle.compat.pad` strict to the compatible signature and reject Paddle-only keywords such as `x`, `name`, `data_format`, and `pad_from_left_axis`. Add unit tests for the compatible Paddle API.
6
+
7
+ Update PaConvert conversion rules and tests for `torch.nn.functional.pad` so converted code uses the compatible Paddle API.
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/repos.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ecosystem: PaddlePaddle
2
+ snapshot_date: '2026-07-09'
3
+ repos:
4
+ PaConvert:
5
+ url: https://github.com/PaddlePaddle/PaConvert.git
6
+ local_path: repos/PaddlePaddle/PaConvert
7
+ role: source
8
+ included_in_task: true
9
+ agent_editable: true
10
+ snapshot_commit: 226220825c49c0f0638afdba9bf6988d8524e591
11
+ base_commit: 226220825c49c0f0638afdba9bf6988d8524e591
12
+ gold_commit: 0311bd2b3992e5b340f38d202868048c7f77e1e2
13
+ merge_commit: 7a613474eb37279115bce4234d79b1280108f4dd
14
+ upstream_pr: 697
15
+ upstream_prs:
16
+ - 697
17
+ Paddle:
18
+ url: https://github.com/PaddlePaddle/Paddle.git
19
+ local_path: repos/PaddlePaddle/Paddle
20
+ role: linked
21
+ included_in_task: true
22
+ agent_editable: true
23
+ snapshot_commit: daa3639a7da1b5c5aed3a253bd41f082123ae9f2
24
+ base_commit: daa3639a7da1b5c5aed3a253bd41f082123ae9f2
25
+ gold_commit: 28b749632f2dc015ba35387b24cca228f4ade998
26
+ merge_commit: cd2ef1c572ecf2ab2fb22a16c9cfdb7b6192b060
27
+ upstream_pr: 75200
28
+ upstream_prs:
29
+ - 75200
30
+ workspace_policy:
31
+ rq1_scope: all repositories appearing in the selected benchmark ecosystem
32
+ rq2_scope: selected scored repository only
33
+ extra_repo_scoring: not scored unless included_in_task is true
34
+ extra_repo_edit_policy: editable and collected, but not expected to change
35
+ snapshot_cutoff: earliest involved base commit time
36
+ cutoff_time: '2025-09-09T12:18:50+00:00'
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/task.yaml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ id: paddlepaddle_paconvert_paddle_d3f5712cbcf6
2
+ benchmark: EcoSyncBench
3
+ status: candidate_pending_environment
4
+ ecosystem: PaddlePaddle
5
+ task_type: producer_consumer_or_runtime_contract
6
+ repositories:
7
+ - name: PaConvert
8
+ path: repos/PaddlePaddle/PaConvert
9
+ role: source
10
+ base_commit: 226220825c49c0f0638afdba9bf6988d8524e591
11
+ gold_commit: 0311bd2b3992e5b340f38d202868048c7f77e1e2
12
+ merge_commit: 7a613474eb37279115bce4234d79b1280108f4dd
13
+ gold_patch: gold/patches/PaConvert.patch
14
+ - name: Paddle
15
+ path: repos/PaddlePaddle/Paddle
16
+ role: linked
17
+ base_commit: daa3639a7da1b5c5aed3a253bd41f082123ae9f2
18
+ gold_commit: 28b749632f2dc015ba35387b24cca228f4ade998
19
+ merge_commit: cd2ef1c572ecf2ab2fb22a16c9cfdb7b6192b060
20
+ gold_patch: gold/patches/Paddle.patch
21
+ source_prs:
22
+ - repo: PaddlePaddle/PaConvert
23
+ pr: 697
24
+ title: '[API-Compat] paddle.compat.pad conversion rules and tests'
25
+ url: https://github.com/PaddlePaddle/PaConvert/pull/697
26
+ merged_at: '2025-09-12T08:52:13Z'
27
+ - repo: PaddlePaddle/Paddle
28
+ pr: 75200
29
+ title: '[API-Compat] Added paddle.compat.pad and unittests'
30
+ url: https://github.com/PaddlePaddle/Paddle/pull/75200
31
+ merged_at: '2025-09-11T02:26:38Z'
32
+ source_unit: pr_bundle
33
+ source_provenance:
34
+ construction_method: upstream_pr_merge_commits
35
+ data_collection_basis: manual_audit_since20250601 + pr_mining_all_repos_since2024
36
+ manual_audit_id: d3f5712cbcf6
37
+ evaluation:
38
+ harness: harness.yaml
39
+ gold: gold/patches/
40
+ hidden_tests: hidden/patches/
41
+ environment: environment/
cases/PaddlePaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/validation.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ status: matrix_passed
2
+ matrix:
3
+ linux-docker:
4
+ status: matrix_passed
5
+ result_file: data_mining/data/cases/final_matrix_staging/paddlepaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/linux-docker/result.json
6
+ oracle_file: data_mining/data/cases/final_matrix_staging/paddlepaddle/paddlepaddle_paconvert_paddle_d3f5712cbcf6/oracles/hidden_test_oracle.json
7
+ oracle_totals:
8
+ fail_to_pass: 10
9
+ pass_to_pass: 25
10
+ fail_to_fail: 0
11
+ pass_to_fail: 0
12
+ missing_in_base: 0
13
+ missing_in_gold: 0
14
+ skipped: 0
15
+ release_gate:
16
+ matrix_passed: true
17
+ has_fail_to_pass: true
18
+ has_pass_to_pass: true
19
+ no_regressions: true
20
+ no_missing_gold_tests: true
21
+ no_missing_tests: true
22
+ missing_in_base_allowed: true
23
+ publishable_after_human_review: false
24
+ failure_reason: ''
25
+ last_synced_at: '2026-07-14T15:40:35.630982+00:00'
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/ansible-aap-cost-py.Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ecosyncbench/base/ansible-django-py:3.12
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends \
5
+ libcairo2 \
6
+ libgdk-pixbuf-2.0-0 \
7
+ libglib2.0-0 \
8
+ libpango-1.0-0 \
9
+ libpangoft2-1.0-0 \
10
+ shared-mime-info \
11
+ && rm -rf /var/lib/apt/lists/*
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/Dockerfile.case-base ADDED
@@ -0,0 +1,539 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y --no-install-recommends git libnss-wrapper python3 python3-venv python3-yaml \
5
+ && rm -rf /var/lib/apt/lists/*
6
+ ENV PATH=/usr/local/cargo/bin:/usr/local/go/bin:/opt/java/openjdk/bin:/opt/maven/bin:/usr/share/maven/bin:/opt/gradle/bin:/usr/share/gradle/bin:${PATH}
7
+ RUN cat > /etc/profile.d/ecosync-tools.sh <<'SH'
8
+ _ecosync_setup_user_env() {
9
+ if getent passwd "$(id -u)" >/dev/null 2>&1; then
10
+ return 0
11
+ fi
12
+ local nss_wrapper candidate
13
+ nss_wrapper=
14
+ for candidate in /usr/lib/*/libnss_wrapper.so /usr/lib/libnss_wrapper.so; do
15
+ if [ -f "$candidate" ]; then nss_wrapper="$candidate"; break; fi
16
+ done
17
+ [ -n "$nss_wrapper" ] || return 0
18
+ export NSS_WRAPPER_PASSWD="${NSS_WRAPPER_PASSWD:-/tmp/ecosync-passwd-$(id -u)}"
19
+ export NSS_WRAPPER_GROUP="${NSS_WRAPPER_GROUP:-/tmp/ecosync-group-$(id -g)}"
20
+ if [ ! -f "$NSS_WRAPPER_PASSWD" ]; then
21
+ printf 'ecosync:x:%s:%s:EcoSync user:%s:/bin/bash\n' "$(id -u)" "$(id -g)" "${HOME:-/tmp/ecosync-home}" > "$NSS_WRAPPER_PASSWD" 2>/dev/null || return 0
22
+ fi
23
+ if [ ! -f "$NSS_WRAPPER_GROUP" ]; then
24
+ printf 'ecosync:x:%s:\n' "$(id -g)" > "$NSS_WRAPPER_GROUP" 2>/dev/null || return 0
25
+ fi
26
+ case ":${LD_PRELOAD:-}:" in
27
+ *":$nss_wrapper:"*) ;;
28
+ *) export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}$nss_wrapper" ;;
29
+ esac
30
+ }
31
+ case "${HOME:-}" in
32
+ ''|/|/root|/root/*) export HOME="${ECOSYNC_HOME:-${ECOSYNC_WORKSPACE:-/tmp/ecosync-workspace}/.ecosyncbench/home}" ;;
33
+ esac
34
+ mkdir -p "$HOME" 2>/dev/null || true
35
+ chmod 0777 "$HOME" 2>/dev/null || true
36
+ _ecosync_setup_user_env
37
+ _ecosync_prepend_path() {
38
+ case ":$PATH:" in
39
+ *":$1:"*) ;;
40
+ *) [ -d "$1" ] && PATH="$1:$PATH" ;;
41
+ esac
42
+ return 0
43
+ }
44
+ _ecosync_append_path() {
45
+ case ":$PATH:" in
46
+ *":$1:"*) ;;
47
+ *) [ -d "$1" ] && PATH="$PATH:$1" ;;
48
+ esac
49
+ return 0
50
+ }
51
+ _ecosync_prepend_path /usr/local/go/bin
52
+ _ecosync_prepend_path /usr/local/cargo/bin
53
+ _ecosync_prepend_path /opt/java/openjdk/bin
54
+ _ecosync_prepend_path /opt/maven/bin
55
+ _ecosync_prepend_path /usr/share/maven/bin
56
+ _ecosync_prepend_path /opt/gradle/bin
57
+ _ecosync_prepend_path /usr/share/gradle/bin
58
+ _ecosync_prepend_path /opt/ecosync/agents/swe-python/bin
59
+ _ecosync_prepend_path /opt/SWE-agent/.venv/bin
60
+ _ecosync_prepend_path /opt/ecosync/shims
61
+ export PATH
62
+ export CARGO_HOME="${CARGO_HOME:-/usr/local/cargo}"
63
+ export RUSTUP_HOME="${RUSTUP_HOME:-/usr/local/rustup}"
64
+ if [ -z "${JAVA_HOME:-}" ] && [ -d /opt/java/openjdk ]; then export JAVA_HOME=/opt/java/openjdk; fi
65
+ if [ -z "${JAVA_HOME:-}" ] && [ -d /usr/lib/jvm ]; then
66
+ _ecosync_java_home="$(find /usr/lib/jvm -maxdepth 2 -type f -path '*/bin/java' -print -quit 2>/dev/null || true)"
67
+ [ -z "$_ecosync_java_home" ] || export JAVA_HOME="$(dirname "$(dirname "$_ecosync_java_home")")"
68
+ fi
69
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-${ECOSYNC_WORKSPACE:-/tmp/ecosync-workspace}/.ecosyncbench/cache}"
70
+ export CI="${CI:-true}"
71
+ export COREPACK_ENABLE_DOWNLOAD_PROMPT="${COREPACK_ENABLE_DOWNLOAD_PROMPT:-0}"
72
+ export npm_config_yes="${npm_config_yes:-true}"
73
+ case "${DOTNET_CLI_HOME:-}" in
74
+ ''|/root|/root/*|/opt/ecosync/*) export DOTNET_CLI_HOME="$ECOSYNC_CACHE_ROOT/dotnet-home" ;;
75
+ esac
76
+ case "${NUGET_PACKAGES:-}" in
77
+ ''|/root|/root/*|/opt/ecosync/*) export NUGET_PACKAGES="$ECOSYNC_CACHE_ROOT/nuget/" ;;
78
+ esac
79
+ case "$NUGET_PACKAGES" in
80
+ */) ;;
81
+ *) export NUGET_PACKAGES="$NUGET_PACKAGES/" ;;
82
+ esac
83
+ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE="${DOTNET_SKIP_FIRST_TIME_EXPERIENCE:-1}"
84
+ export DOTNET_CLI_TELEMETRY_OPTOUT="${DOTNET_CLI_TELEMETRY_OPTOUT:-1}"
85
+ mkdir -p "$DOTNET_CLI_HOME" "$NUGET_PACKAGES" 2>/dev/null || true
86
+ chmod 0777 "$DOTNET_CLI_HOME" "$NUGET_PACKAGES" 2>/dev/null || true
87
+ mkdir -p "$ECOSYNC_CACHE_ROOT/go/pkg/mod" "$ECOSYNC_CACHE_ROOT/go/path" /tmp/ecosync-gocache 2>/dev/null || true
88
+ chmod 0777 "$ECOSYNC_CACHE_ROOT/go/pkg/mod" "$ECOSYNC_CACHE_ROOT/go/path" /tmp/ecosync-gocache 2>/dev/null || true
89
+ export GOMODCACHE="${GOMODCACHE:-$ECOSYNC_CACHE_ROOT/go/pkg/mod}"
90
+ export GOPATH="${GOPATH:-$ECOSYNC_CACHE_ROOT/go/path}"
91
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
92
+ case "${GRADLE_USER_HOME:-}" in
93
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
94
+ esac
95
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
96
+ if [ -d /ecosync-scratch ]; then
97
+ export COMPOSER_HOME="${ECOSYNC_COMPOSER_HOME:-/ecosync-scratch/cache/composer}"
98
+ elif [ -z "${COMPOSER_HOME:-}" ] || [ "${COMPOSER_HOME:-}" = /tmp/composer ]; then
99
+ export COMPOSER_HOME=/tmp/ecosync-composer-home
100
+ fi
101
+ mkdir -p "$(dirname "$COMPOSER_HOME")" "$COMPOSER_HOME" 2>/dev/null || true
102
+ chmod 0777 "$(dirname "$COMPOSER_HOME")" "$COMPOSER_HOME" 2>/dev/null || true
103
+ export MAVEN_OPTS="-Dmaven.repo.local=/opt/ecosync/m2 ${MAVEN_OPTS:-}"
104
+ _ecosync_select_deps_root_for_cwd() {
105
+ local workspace repo_envs cwd rel root repo_abs
106
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
107
+ repo_envs="${ECOSYNC_REPO_ENVS:-/opt/ecosync/repo-envs.tsv}"
108
+ cwd="$(pwd -P)"
109
+ [ -r "$repo_envs" ] || return 1
110
+ while IFS=$'\t' read -r rel root; do
111
+ [ -n "${rel:-}" ] && [ -n "${root:-}" ] || continue
112
+ repo_abs="$workspace/$rel"
113
+ case "$cwd" in
114
+ "$repo_abs"|"$repo_abs"/*) printf '%s\n' "$root"; return 0 ;;
115
+ esac
116
+ done < "$repo_envs"
117
+ return 1
118
+ }
119
+ _ecosync_setup_repo_env() {
120
+ local root="$1" workspace
121
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
122
+ [ -d "$root" ] || return 0
123
+ export ECOSYNC_DEPS_ROOT="$root"
124
+ if [ -d "$root/gomodcache" ] && [ -w "$root/gomodcache" ]; then export GOMODCACHE="$root/gomodcache"; else export GOMODCACHE="$ECOSYNC_CACHE_ROOT/go/pkg/mod"; fi
125
+ if [ -d "$root/gopath" ] && [ -w "$root/gopath" ]; then export GOPATH="$root/gopath"; else export GOPATH="$ECOSYNC_CACHE_ROOT/go/path"; fi
126
+ mkdir -p "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
127
+ chmod 0777 "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
128
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
129
+ export MAVEN_OPTS="-Dmaven.repo.local=$root/m2 ${MAVEN_OPTS:-}"
130
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-$workspace/.ecosyncbench/cache}"
131
+ case "${GRADLE_USER_HOME:-}" in
132
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
133
+ esac
134
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
135
+ if [ -d "$root/composer/home" ]; then export COMPOSER_HOME="$root/composer/home"; else export COMPOSER_HOME="${COMPOSER_HOME:-$root/composer-home}"; fi
136
+ if [ -d "$root/composer/cache" ]; then export COMPOSER_CACHE_DIR="$root/composer/cache"; fi
137
+ if [ -d "$root/usr-local-bin" ]; then _ecosync_append_path "$root/usr-local-bin"; fi
138
+ if [ -d "$root/usr-local-lib" ]; then export LD_LIBRARY_PATH="$root/usr-local-lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
139
+ if [ -d "$root/usr-local-cargo/bin" ]; then _ecosync_prepend_path "$root/usr-local-cargo/bin"; export CARGO_HOME="$root/usr-local-cargo"; fi
140
+ if [ -d "$root/usr-local-rustup" ]; then export RUSTUP_HOME="$root/usr-local-rustup"; fi
141
+ if [ -n "${RUSTUP_HOME:-}" ] && [ -d "$RUSTUP_HOME/toolchains" ]; then
142
+ if [ -n "${RUSTUP_TOOLCHAIN:-}" ] && [ ! -d "$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN" ]; then unset RUSTUP_TOOLCHAIN; fi
143
+ if [ -z "${RUSTUP_TOOLCHAIN:-}" ]; then installed_toolchain="$(find "$RUSTUP_HOME/toolchains" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null | sort -Vr | head -1 || true)"; [ -z "$installed_toolchain" ] || export RUSTUP_TOOLCHAIN="$installed_toolchain"; fi
144
+ if [ -n "${RUSTUP_TOOLCHAIN:-}" ]; then export ECOSYNC_RUST_TOOLCHAIN_DIR="$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN"; fi
145
+ fi
146
+ if [ -d "$root/php-libs" ]; then export LD_LIBRARY_PATH="$root/php-libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
147
+ if [ -d "$root/usr-local-etc/php" ]; then export PHPRC="$root/usr-local-etc/php"; export PHP_INI_SCAN_DIR="$root/usr-local-etc/php/conf.d${PHP_INI_SCAN_DIR:+:$PHP_INI_SCAN_DIR}"; fi
148
+ if [ -d "$root/usr-local/lib" ] && [ -x "$root/usr-local-bin/python" ]; then export PYTHONHOME="$root/usr-local"; fi
149
+ if [ -d "$root/usr-local-bundle" ]; then export GEM_HOME="$root/usr-local-bundle"; export BUNDLE_PATH="$root/usr-local-bundle"; export BUNDLE_APP_CONFIG="$root/usr-local-bundle"; fi
150
+ if [ -d "$root/node-runtime/bin" ]; then _ecosync_append_path "$root/node-runtime/bin"; export ECOSYNC_NODE_RUNTIME_ROOT="$root/node-runtime"; fi
151
+ if [ -d "$root/node-runtime/lib/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/node-runtime/lib/node_modules"; fi
152
+ if [ -d "$PWD/node_modules/.bin" ]; then _ecosync_prepend_path "$PWD/node_modules/.bin"; fi
153
+ if [ -d "$root/pnpm" ]; then _ecosync_prepend_path "$root/pnpm"; export PNPM_HOME="${PNPM_HOME:-$root/pnpm}"; fi
154
+ if [ -d "$root/pnpm-store" ]; then export PNPM_STORE_DIR="${PNPM_STORE_DIR:-$root/pnpm-store}"; export pnpm_config_store_dir="${pnpm_config_store_dir:-$root/pnpm-store}"; export npm_config_store_dir="${npm_config_store_dir:-$root/pnpm-store}"; export NPM_CONFIG_STORE_DIR="${NPM_CONFIG_STORE_DIR:-$root/pnpm-store}"; fi
155
+ if [ -d "$root/corepack" ]; then export COREPACK_HOME="${COREPACK_HOME:-$root/corepack}"; fi
156
+ if [ -d "$root/xdg" ]; then export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$root/xdg}"; export XDG_DATA_HOME="${XDG_DATA_HOME:-$root/xdg}"; fi
157
+ if [ -d "$root/global" ]; then export YARN_ENABLE_GLOBAL_CACHE="${YARN_ENABLE_GLOBAL_CACHE:-true}"; export YARN_GLOBAL_FOLDER="${YARN_GLOBAL_FOLDER:-$root/global}"; fi
158
+ if [ -d "$root/cache" ]; then export YARN_CACHE_FOLDER="${YARN_CACHE_FOLDER:-$root/cache}"; fi
159
+ if [ -d "$root/deps/node_modules/.bin" ]; then _ecosync_prepend_path "$root/deps/node_modules/.bin"; fi
160
+ if [ -d "$root/deps/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/deps/node_modules"; fi
161
+ if [ -d "$root/repo/node_modules/.bin" ]; then _ecosync_prepend_path "$root/repo/node_modules/.bin"; fi
162
+ if [ -d "$root/repo/node_modules" ]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/repo/node_modules"; fi
163
+ if [ -d "$root/deps/vendor/bin" ]; then _ecosync_prepend_path "$root/deps/vendor/bin"; fi
164
+ if [ -d "$root/venv/bin" ]; then _ecosync_prepend_path "$root/venv/bin"; fi
165
+ if [ -d "$PWD/src" ]; then export PYTHONPATH="$PWD/src:$PWD${PYTHONPATH:+:$PYTHONPATH}"; else export PYTHONPATH="$PWD${PYTHONPATH:+:$PYTHONPATH}"; fi
166
+ export PATH
167
+ }
168
+ _ecosync_activate_repo_env() {
169
+ local root
170
+ if root="$(_ecosync_select_deps_root_for_cwd 2>/dev/null)"; then
171
+ _ecosync_setup_repo_env "$root"
172
+ fi
173
+ return 0
174
+ }
175
+ cd() {
176
+ if builtin cd "$@"; then
177
+ _ecosync_activate_repo_env >/dev/null 2>&1 || true
178
+ return 0
179
+ fi
180
+ return $?
181
+ }
182
+ _ecosync_activate_repo_env >/dev/null 2>&1 || true
183
+ SH
184
+ RUN mkdir -p /opt/ecosync/shims \
185
+ && cat > /opt/ecosync/shims/ecosync-tool-shim <<'SH'
186
+ #!/usr/bin/env bash
187
+ set -euo pipefail
188
+ tool="$(basename "$0")"
189
+ workspace="${ECOSYNC_WORKSPACE:-/workspace}"
190
+ repo_envs="${ECOSYNC_REPO_ENVS:-/opt/ecosync/repo-envs.tsv}"
191
+ cwd="$(pwd -P)"
192
+ fallback_command() {
193
+ case "$tool" in
194
+ python) [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 "$@" ;;
195
+ python3) [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python "$@" ;;
196
+ pytest) [[ -x /usr/local/bin/pytest ]] && exec /usr/local/bin/pytest "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pytest "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python -m pytest "$@" ;;
197
+ pip) [[ -x /usr/local/bin/pip ]] && exec /usr/local/bin/pip "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pip "$@"; [[ -x /usr/local/bin/python ]] && exec /usr/local/bin/python -m pip "$@" ;;
198
+ pip3) [[ -x /usr/local/bin/pip3 ]] && exec /usr/local/bin/pip3 "$@"; [[ -x /usr/local/bin/python3 ]] && exec /usr/local/bin/python3 -m pip "$@" ;;
199
+ uv) [[ -x /usr/local/bin/uv ]] && exec /usr/local/bin/uv "$@" ;;
200
+ node) [[ -x /usr/local/bin/node ]] && exec /usr/local/bin/node "$@" ;;
201
+ npm) [[ -x /usr/local/bin/node && -f /usr/local/lib/node_modules/npm/bin/npm-cli.js ]] && exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js "$@"; [[ -x /usr/local/bin/npm ]] && exec /usr/local/bin/npm "$@" ;;
202
+ npx) [[ -x /usr/local/bin/node && -f /usr/local/lib/node_modules/npm/bin/npx-cli.js ]] && exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npx-cli.js "$@"; [[ -x /usr/local/bin/npx ]] && exec /usr/local/bin/npx "$@" ;;
203
+ corepack) [[ -x /usr/local/bin/corepack ]] && exec /usr/local/bin/corepack "$@" ;;
204
+ yarn) [[ -x /usr/local/bin/yarn ]] && exec /usr/local/bin/yarn "$@" ;;
205
+ pnpm) [[ -x /usr/local/bin/pnpm ]] && exec /usr/local/bin/pnpm "$@"; command -v corepack >/dev/null 2>&1 && exec corepack pnpm "$@" ;;
206
+ bun) [[ -x /usr/local/bin/bun ]] && exec /usr/local/bin/bun "$@" ;;
207
+ jest) [[ -x ./node_modules/.bin/jest ]] && exec ./node_modules/.bin/jest "$@" ;;
208
+ mocha) [[ -x ./node_modules/.bin/mocha ]] && exec ./node_modules/.bin/mocha "$@" ;;
209
+ tsd) [[ -x ./node_modules/.bin/tsd ]] && exec ./node_modules/.bin/tsd "$@" ;;
210
+ go) [[ -x /usr/local/go/bin/go ]] && exec /usr/local/go/bin/go "$@" ;;
211
+ cargo) [[ -x /usr/local/cargo/bin/cargo ]] && exec /usr/local/cargo/bin/cargo "$@" ;;
212
+ rustc) [[ -x /usr/local/cargo/bin/rustc ]] && exec /usr/local/cargo/bin/rustc "$@" ;;
213
+ rustup) [[ -x /usr/local/cargo/bin/rustup ]] && exec /usr/local/cargo/bin/rustup "$@" ;;
214
+ dart) [[ -x /usr/local/bin/dart ]] && exec /usr/local/bin/dart "$@" ;;
215
+ flutter) [[ -x /usr/local/bin/flutter ]] && exec /usr/local/bin/flutter "$@" ;;
216
+ php) [[ -x /usr/local/bin/php ]] && exec /usr/local/bin/php "$@"; [[ -x /usr/bin/php ]] && exec /usr/bin/php "$@" ;;
217
+ composer) command -v /usr/local/bin/composer >/dev/null 2>&1 && exec /usr/local/bin/composer "$@" ;;
218
+ phpunit) [[ -x ./vendor/bin/phpunit ]] && exec ./vendor/bin/phpunit "$@" ;;
219
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@" ;;
220
+ ruby) [[ -x /usr/local/bin/ruby ]] && exec /usr/local/bin/ruby "$@" ;;
221
+ gem) [[ -x /usr/local/bin/gem ]] && exec /usr/local/bin/gem "$@" ;;
222
+ bundle|bundler) [[ -x /usr/local/bin/bundle ]] && exec /usr/local/bin/bundle "$@"; [[ -x /usr/local/bin/bundler ]] && exec /usr/local/bin/bundler "$@" ;;
223
+ rake) [[ -x /usr/local/bin/rake ]] && exec /usr/local/bin/rake "$@" ;;
224
+ rspec) [[ -x /usr/local/bin/rspec ]] && exec /usr/local/bin/rspec "$@" ;;
225
+ mvn) [[ -x /opt/maven/bin/mvn ]] && exec /opt/maven/bin/mvn "$@"; [[ -x /usr/share/maven/bin/mvn ]] && exec /usr/share/maven/bin/mvn "$@" ;;
226
+ gradle) [[ -x /opt/gradle/bin/gradle ]] && exec /opt/gradle/bin/gradle "$@" ;;
227
+ cmake) [[ -x /usr/local/bin/cmake ]] && exec /usr/local/bin/cmake "$@"; [[ -x /usr/bin/cmake ]] && exec /usr/bin/cmake "$@" ;;
228
+ ctest) [[ -x /usr/local/bin/ctest ]] && exec /usr/local/bin/ctest "$@"; [[ -x /usr/bin/ctest ]] && exec /usr/bin/ctest "$@" ;;
229
+ scons) [[ -x /usr/local/bin/scons ]] && exec /usr/local/bin/scons "$@"; [[ -x /usr/bin/scons ]] && exec /usr/bin/scons "$@" ;;
230
+ godot) [[ -x /usr/local/bin/godot ]] && exec /usr/local/bin/godot "$@"; [[ -x /usr/bin/godot ]] && exec /usr/bin/godot "$@" ;;
231
+ esac
232
+ case "$tool" in
233
+ python) [[ -x /usr/bin/python ]] && exec /usr/bin/python "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 "$@" ;;
234
+ python3) [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python "$@" ;;
235
+ pytest) [[ -x /usr/bin/pytest ]] && exec /usr/bin/pytest "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pytest "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python -m pytest "$@" ;;
236
+ pip) [[ -x /usr/bin/pip ]] && exec /usr/bin/pip "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pip "$@"; [[ -x /usr/bin/python ]] && exec /usr/bin/python -m pip "$@" ;;
237
+ pip3) [[ -x /usr/bin/pip3 ]] && exec /usr/bin/pip3 "$@"; [[ -x /usr/bin/python3 ]] && exec /usr/bin/python3 -m pip "$@" ;;
238
+ node) [[ -x /usr/bin/node ]] && exec /usr/bin/node "$@" ;;
239
+ npm) [[ -x /usr/bin/npm ]] && exec /usr/bin/npm "$@" ;;
240
+ npx) [[ -x /usr/bin/npx ]] && exec /usr/bin/npx "$@" ;;
241
+ corepack) [[ -x /usr/bin/corepack ]] && exec /usr/bin/corepack "$@" ;;
242
+ yarn) [[ -x /usr/bin/yarn ]] && exec /usr/bin/yarn "$@" ;;
243
+ pnpm) command -v corepack >/dev/null 2>&1 && exec corepack pnpm "$@"; exec /usr/bin/pnpm "$@" ;;
244
+ bun) [[ -x /usr/bin/bun ]] && exec /usr/bin/bun "$@" ;;
245
+ go) exec /usr/bin/go "$@" ;;
246
+ cargo) exec /usr/bin/cargo "$@" ;;
247
+ rustc) exec /usr/bin/rustc "$@" ;;
248
+ rustup) exec /usr/bin/rustup "$@" ;;
249
+ dart) exec /usr/bin/dart "$@" ;;
250
+ flutter) exec /usr/bin/flutter "$@" ;;
251
+ php) [[ -x /usr/local/bin/php ]] && exec /usr/local/bin/php "$@"; exec /usr/bin/php "$@" ;;
252
+ composer) exec /usr/bin/composer "$@" ;;
253
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@" ;;
254
+ ruby) exec /usr/bin/ruby "$@" ;;
255
+ gem) exec /usr/bin/gem "$@" ;;
256
+ bundle|bundler) exec /usr/bin/bundle "$@" ;;
257
+ rake) exec /usr/bin/rake "$@" ;;
258
+ rspec) exec /usr/bin/rspec "$@" ;;
259
+ mvn) exec /usr/bin/mvn "$@" ;;
260
+ gradle) exec /usr/bin/gradle "$@" ;;
261
+ cmake) exec /usr/bin/cmake "$@" ;;
262
+ ctest) exec /usr/bin/ctest "$@" ;;
263
+ scons) exec /usr/bin/scons "$@" ;;
264
+ godot) exec /usr/bin/godot "$@" ;;
265
+ esac
266
+ echo "ecosync shim could not find executable for $tool" >&2
267
+ exit 127
268
+ }
269
+ select_deps_root() {
270
+ [[ -r "$repo_envs" ]] || return 1
271
+ local rel root repo_abs
272
+ while IFS=$'\t' read -r rel root; do
273
+ [[ -n "${rel:-}" && -n "${root:-}" ]] || continue
274
+ repo_abs="$workspace/$rel"
275
+ case "$cwd" in
276
+ "$repo_abs"|"$repo_abs"/*)
277
+ printf '%s\n' "$root"
278
+ return 0
279
+ ;;
280
+ esac
281
+ done < "$repo_envs"
282
+ return 1
283
+ }
284
+ setup_repo_env() {
285
+ local root="$1"
286
+ [[ -d "$root" ]] || return 0
287
+ export ECOSYNC_DEPS_ROOT="$root"
288
+ if [[ -d "$root/gomodcache" && -w "$root/gomodcache" ]]; then export GOMODCACHE="$root/gomodcache"; else export GOMODCACHE="$ECOSYNC_CACHE_ROOT/go/pkg/mod"; fi
289
+ if [[ -d "$root/gopath" && -w "$root/gopath" ]]; then export GOPATH="$root/gopath"; else export GOPATH="$ECOSYNC_CACHE_ROOT/go/path"; fi
290
+ mkdir -p "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
291
+ chmod 0777 "$GOMODCACHE" "$GOPATH" /tmp/ecosync-gocache 2>/dev/null || true
292
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
293
+ export MAVEN_OPTS="-Dmaven.repo.local=$root/m2 ${MAVEN_OPTS:-}"
294
+ export ECOSYNC_CACHE_ROOT="${ECOSYNC_CACHE_ROOT:-$workspace/.ecosyncbench/cache}"
295
+ case "${GRADLE_USER_HOME:-}" in
296
+ ''|/root|/root/*|/opt/ecosync/*) export GRADLE_USER_HOME="${ECOSYNC_GRADLE_USER_HOME:-$ECOSYNC_CACHE_ROOT/gradle}" ;;
297
+ esac
298
+ mkdir -p "$GRADLE_USER_HOME" 2>/dev/null || true
299
+ if [[ -d "$root/composer/home" ]]; then export COMPOSER_HOME="$root/composer/home"; else export COMPOSER_HOME="${COMPOSER_HOME:-$root/composer-home}"; fi
300
+ if [[ -d "$root/composer/cache" ]]; then export COMPOSER_CACHE_DIR="$root/composer/cache"; fi
301
+ if [[ -d "$root/usr-local-bin" ]]; then PATH="$PATH:$root/usr-local-bin"; fi
302
+ if [[ -d "$root/usr-local-lib" ]]; then export LD_LIBRARY_PATH="$root/usr-local-lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
303
+ if [[ -d "$root/usr-local-cargo/bin" ]]; then PATH="$root/usr-local-cargo/bin:$PATH"; export CARGO_HOME="$root/usr-local-cargo"; fi
304
+ if [[ -d "$root/usr-local-rustup" ]]; then export RUSTUP_HOME="$root/usr-local-rustup"; fi
305
+ if [[ -n "${RUSTUP_HOME:-}" && -d "$RUSTUP_HOME/toolchains" ]]; then
306
+ if [[ -n "${RUSTUP_TOOLCHAIN:-}" && ! -d "$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN" ]]; then unset RUSTUP_TOOLCHAIN; fi
307
+ if [[ -z "${RUSTUP_TOOLCHAIN:-}" ]]; then installed_toolchain="$(find "$RUSTUP_HOME/toolchains" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null | sort -Vr | head -1 || true)"; [[ -z "$installed_toolchain" ]] || export RUSTUP_TOOLCHAIN="$installed_toolchain"; fi
308
+ if [[ -n "${RUSTUP_TOOLCHAIN:-}" ]]; then export ECOSYNC_RUST_TOOLCHAIN_DIR="$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN"; fi
309
+ fi
310
+ if [[ -d "$root/php-libs" ]]; then export LD_LIBRARY_PATH="$root/php-libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"; fi
311
+ if [[ -d "$root/usr-local-etc/php" ]]; then export PHPRC="$root/usr-local-etc/php"; export PHP_INI_SCAN_DIR="$root/usr-local-etc/php/conf.d${PHP_INI_SCAN_DIR:+:$PHP_INI_SCAN_DIR}"; fi
312
+ if [[ -d "$root/usr-local/lib" && -x "$root/usr-local-bin/python" ]]; then export PYTHONHOME="$root/usr-local"; fi
313
+ if [[ -d "$root/usr-local-bundle" ]]; then export GEM_HOME="$root/usr-local-bundle"; export BUNDLE_PATH="$root/usr-local-bundle"; export BUNDLE_APP_CONFIG="$root/usr-local-bundle"; fi
314
+ if [[ -d "$root/node-runtime/bin" ]]; then PATH="$PATH:$root/node-runtime/bin"; export ECOSYNC_NODE_RUNTIME_ROOT="$root/node-runtime"; fi
315
+ if [[ -d "$root/node-runtime/lib/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/node-runtime/lib/node_modules"; fi
316
+ if [[ -d ./node_modules/.bin ]]; then PATH="$PWD/node_modules/.bin:$PATH"; fi
317
+ if [[ -d "$root/pnpm" ]]; then PATH="$root/pnpm:$PATH"; export PNPM_HOME="${PNPM_HOME:-$root/pnpm}"; fi
318
+ if [[ -d "$root/pnpm-store" ]]; then export PNPM_STORE_DIR="${PNPM_STORE_DIR:-$root/pnpm-store}"; export pnpm_config_store_dir="${pnpm_config_store_dir:-$root/pnpm-store}"; export npm_config_store_dir="${npm_config_store_dir:-$root/pnpm-store}"; export NPM_CONFIG_STORE_DIR="${NPM_CONFIG_STORE_DIR:-$root/pnpm-store}"; fi
319
+ if [[ -d "$root/corepack" ]]; then export COREPACK_HOME="${COREPACK_HOME:-$root/corepack}"; fi
320
+ if [[ -d "$root/xdg" ]]; then export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$root/xdg}"; export XDG_DATA_HOME="${XDG_DATA_HOME:-$root/xdg}"; fi
321
+ if [[ -d "$root/global" ]]; then export YARN_ENABLE_GLOBAL_CACHE="${YARN_ENABLE_GLOBAL_CACHE:-true}"; export YARN_GLOBAL_FOLDER="${YARN_GLOBAL_FOLDER:-$root/global}"; fi
322
+ if [[ -d "$root/cache" ]]; then export YARN_CACHE_FOLDER="${YARN_CACHE_FOLDER:-$root/cache}"; fi
323
+ if [[ -d "$root/deps/node_modules/.bin" ]]; then PATH="$root/deps/node_modules/.bin:$PATH"; fi
324
+ if [[ -d "$root/deps/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/deps/node_modules"; fi
325
+ if [[ -d "$root/repo/node_modules/.bin" ]]; then PATH="$root/repo/node_modules/.bin:$PATH"; fi
326
+ if [[ -d "$root/repo/node_modules" ]]; then export NODE_PATH="${NODE_PATH:+$NODE_PATH:}$root/repo/node_modules"; fi
327
+ if [[ -d "$root/deps/vendor/bin" ]]; then PATH="$root/deps/vendor/bin:$PATH"; fi
328
+ if [[ -d "$root/venv/bin" ]]; then PATH="$root/venv/bin:$PATH"; fi
329
+ if [[ -d "$PWD/src" ]]; then export PYTHONPATH="$PWD/src:$PWD${PYTHONPATH:+:$PYTHONPATH}"; else export PYTHONPATH="$PWD${PYTHONPATH:+:$PYTHONPATH}"; fi
330
+ export PATH
331
+ }
332
+ if deps_root="$(select_deps_root)"; then
333
+ setup_repo_env "$deps_root"
334
+ case "$tool" in
335
+ python|python3) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" "$@" ;;
336
+ pytest) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" -m pytest "$@"; [[ -x "$deps_root/usr-local-bin/pytest" ]] && exec "$deps_root/usr-local-bin/pytest" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" -m pytest "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" -m pytest "$@" ;;
337
+ pip|pip3) [[ -x "$deps_root/venv/bin/python" ]] && exec "$deps_root/venv/bin/python" -m pip "$@"; [[ -x "$deps_root/usr-local-bin/pip" ]] && exec "$deps_root/usr-local-bin/pip" "$@"; [[ -x "$deps_root/usr-local-bin/python" ]] && exec "$deps_root/usr-local-bin/python" -m pip "$@"; [[ -x "$deps_root/usr-local-bin/python3" ]] && exec "$deps_root/usr-local-bin/python3" -m pip "$@" ;;
338
+ node) [[ -x "$deps_root/node-runtime/bin/node" ]] && exec "$deps_root/node-runtime/bin/node" "$@" ;;
339
+ npm) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/npm/bin/npm-cli.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/npm/bin/npm-cli.js" "$@" ;;
340
+ npx) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/npm/bin/npx-cli.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/npm/bin/npx-cli.js" "$@" ;;
341
+ corepack) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" "$@" ;;
342
+ yarn) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" yarn "$@" ;;
343
+ pnpm) [[ -x "$deps_root/node-runtime/bin/node" && -f "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" ]] && exec "$deps_root/node-runtime/bin/node" "$deps_root/node-runtime/lib/node_modules/corepack/dist/corepack.js" pnpm "$@" ;;
344
+ bun) [[ -x "$deps_root/usr-local-bin/bun" ]] && exec "$deps_root/usr-local-bin/bun" "$@"; [[ -x "$deps_root/node-runtime/bin/bun" ]] && exec "$deps_root/node-runtime/bin/bun" "$@" ;;
345
+ uv) [[ -x "$deps_root/usr-local-bin/uv" ]] && exec "$deps_root/usr-local-bin/uv" "$@" ;;
346
+ dart) [[ -x "$deps_root/usr-local-bin/dart" ]] && exec "$deps_root/usr-local-bin/dart" "$@"; [[ -x /workspace/repos/flutter/flutter/bin/dart ]] && exec /workspace/repos/flutter/flutter/bin/dart "$@" ;;
347
+ flutter) [[ -x "$deps_root/usr-local-bin/flutter" ]] && exec "$deps_root/usr-local-bin/flutter" "$@"; [[ -x /workspace/repos/flutter/flutter/bin/flutter ]] && exec /workspace/repos/flutter/flutter/bin/flutter "$@" ;;
348
+ jest) [[ -x ./node_modules/.bin/jest ]] && exec ./node_modules/.bin/jest "$@"; [[ -x "$deps_root/deps/node_modules/.bin/jest" ]] && exec "$deps_root/deps/node_modules/.bin/jest" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/jest" ]] && exec "$deps_root/repo/node_modules/.bin/jest" "$@" ;;
349
+ mocha) [[ -x ./node_modules/.bin/mocha ]] && exec ./node_modules/.bin/mocha "$@"; [[ -x "$deps_root/deps/node_modules/.bin/mocha" ]] && exec "$deps_root/deps/node_modules/.bin/mocha" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/mocha" ]] && exec "$deps_root/repo/node_modules/.bin/mocha" "$@" ;;
350
+ tsd) [[ -x ./node_modules/.bin/tsd ]] && exec ./node_modules/.bin/tsd "$@"; [[ -x "$deps_root/deps/node_modules/.bin/tsd" ]] && exec "$deps_root/deps/node_modules/.bin/tsd" "$@"; [[ -x "$deps_root/repo/node_modules/.bin/tsd" ]] && exec "$deps_root/repo/node_modules/.bin/tsd" "$@" ;;
351
+ phpunit) [[ -x ./vendor/bin/phpunit ]] && exec ./vendor/bin/phpunit "$@"; [[ -x "$deps_root/deps/vendor/bin/phpunit" ]] && exec "$deps_root/deps/vendor/bin/phpunit" "$@" ;;
352
+ pest) [[ -x ./vendor/bin/pest ]] && exec ./vendor/bin/pest "$@"; [[ -x "$deps_root/deps/vendor/bin/pest" ]] && exec "$deps_root/deps/vendor/bin/pest" "$@" ;;
353
+ composer) command -v /usr/local/bin/composer >/dev/null 2>&1 && exec /usr/local/bin/composer "$@" ;;
354
+ ruby) [[ -x "$deps_root/usr-local-bin/ruby" ]] && exec "$deps_root/usr-local-bin/ruby" "$@" ;;
355
+ gem) [[ -x "$deps_root/usr-local-bin/gem" ]] && exec "$deps_root/usr-local-bin/gem" "$@" ;;
356
+ bundle|bundler) [[ -x "$deps_root/usr-local-bin/bundle" ]] && exec "$deps_root/usr-local-bin/bundle" "$@"; [[ -x "$deps_root/usr-local-bin/bundler" ]] && exec "$deps_root/usr-local-bin/bundler" "$@" ;;
357
+ rake) [[ -x "$deps_root/usr-local-bin/rake" ]] && exec "$deps_root/usr-local-bin/rake" "$@" ;;
358
+ rspec) [[ -x "$deps_root/usr-local-bin/rspec" ]] && exec "$deps_root/usr-local-bin/rspec" "$@" ;;
359
+ go) [[ -x /usr/local/go/bin/go ]] && exec /usr/local/go/bin/go "$@" ;;
360
+ cargo) [[ -x "$deps_root/usr-local-cargo/bin/cargo" ]] && exec "$deps_root/usr-local-cargo/bin/cargo" "$@"; [[ -x /usr/local/cargo/bin/cargo ]] && exec /usr/local/cargo/bin/cargo "$@" ;;
361
+ rustc) [[ -x "$deps_root/usr-local-cargo/bin/rustc" ]] && exec "$deps_root/usr-local-cargo/bin/rustc" "$@"; [[ -x /usr/local/cargo/bin/rustc ]] && exec /usr/local/cargo/bin/rustc "$@" ;;
362
+ rustup) [[ -x "$deps_root/usr-local-cargo/bin/rustup" ]] && exec "$deps_root/usr-local-cargo/bin/rustup" "$@"; [[ -x /usr/local/cargo/bin/rustup ]] && exec /usr/local/cargo/bin/rustup "$@" ;;
363
+ mvn) [[ -x /opt/maven/bin/mvn ]] && exec /opt/maven/bin/mvn "$@"; [[ -x /usr/share/maven/bin/mvn ]] && exec /usr/share/maven/bin/mvn "$@" ;;
364
+ gradle) [[ -x /opt/gradle/bin/gradle ]] && exec /opt/gradle/bin/gradle "$@" ;;
365
+ cmake) [[ -x "$deps_root/usr-local-bin/cmake" ]] && exec "$deps_root/usr-local-bin/cmake" "$@"; [[ -x /usr/local/bin/cmake ]] && exec /usr/local/bin/cmake "$@"; [[ -x /usr/bin/cmake ]] && exec /usr/bin/cmake "$@" ;;
366
+ ctest) [[ -x "$deps_root/usr-local-bin/ctest" ]] && exec "$deps_root/usr-local-bin/ctest" "$@"; [[ -x /usr/local/bin/ctest ]] && exec /usr/local/bin/ctest "$@"; [[ -x /usr/bin/ctest ]] && exec /usr/bin/ctest "$@" ;;
367
+ scons) [[ -x "$deps_root/usr-local-bin/scons" ]] && exec "$deps_root/usr-local-bin/scons" "$@"; [[ -x /usr/local/bin/scons ]] && exec /usr/local/bin/scons "$@"; [[ -x /usr/bin/scons ]] && exec /usr/bin/scons "$@" ;;
368
+ godot) [[ -x "$deps_root/usr-local-bin/godot" ]] && exec "$deps_root/usr-local-bin/godot" "$@"; [[ -x /usr/local/bin/godot ]] && exec /usr/local/bin/godot "$@"; [[ -x /usr/bin/godot ]] && exec /usr/bin/godot "$@" ;;
369
+ esac
370
+ fi
371
+ fallback_command "$@"
372
+ SH
373
+ RUN chmod +x /opt/ecosync/shims/ecosync-tool-shim \
374
+ && for tool in python python3 pytest pip pip3 uv node npm npx corepack yarn pnpm bun jest mocha tsd go cargo rustc rustup dart flutter php composer phpunit pest ruby gem bundle bundler rake rspec mvn gradle cmake ctest scons godot; do ln -sf ecosync-tool-shim "/opt/ecosync/shims/$tool"; done
375
+ RUN if [ -x /usr/local/bin/node ] && [ -f /usr/local/lib/node_modules/npm/bin/npm-cli.js ]; then printf '%s\n' '#!/usr/bin/env sh' 'exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js "$@"' > /usr/local/bin/npm && chmod +x /usr/local/bin/npm; fi \
376
+ && if [ -x /usr/local/bin/node ] && [ -f /usr/local/lib/node_modules/npm/bin/npx-cli.js ]; then printf '%s\n' '#!/usr/bin/env sh' 'exec /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npx-cli.js "$@"' > /usr/local/bin/npx && chmod +x /usr/local/bin/npx; fi
377
+ RUN mkdir -p /opt/ecosync/gradle-home /opt/ecosync/gomodcache /opt/ecosync/gopath /tmp/ecosync-gocache \
378
+ && if [ -d /root/.gradle ]; then cp -a /root/.gradle/. /opt/ecosync/gradle-home/; fi \
379
+ && chmod -R a+rwX /opt/ecosync/gradle-home /opt/ecosync/gomodcache /opt/ecosync/gopath /tmp/ecosync-gocache
380
+ RUN cat > /usr/local/bin/ecosync-case-prepare-workspace <<'SH'
381
+ #!/usr/bin/env bash
382
+ set -uo pipefail
383
+ workspace="${1:-${ECOSYNC_WORKSPACE:-/workspace}}"
384
+ if [[ -r /etc/profile.d/ecosync-tools.sh ]]; then
385
+ # shellcheck disable=SC1091
386
+ source /etc/profile.d/ecosync-tools.sh
387
+ fi
388
+ copy_or_link() {
389
+ local src="$1"
390
+ local dst="$2"
391
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
392
+ ln -s "$src" "$dst" 2>/dev/null || cp -a "$src" "$dst"
393
+ }
394
+ copy_tree() {
395
+ local src="$1"
396
+ local dst="$2"
397
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
398
+ cp -a "$src" "$dst"
399
+ }
400
+ copy_writable_tree() {
401
+ local src="$1"
402
+ local dst="$2"
403
+ [[ -e "$dst" || -L "$dst" || ! -e "$src" ]] && return 0
404
+ cp -a "$src" "$dst"
405
+ chmod -R u+rwX "$dst" 2>/dev/null || true
406
+ }
407
+ prepare_gradle_home() {
408
+ local dst="${GRADLE_USER_HOME:-$workspace/.ecosyncbench/cache/gradle}"
409
+ mkdir -p "$dst" 2>/dev/null || return 0
410
+ if [[ -d /opt/ecosync/gradle-home && ! -e "$dst/.ecosync-preseeded" ]]; then
411
+ cp -R /opt/ecosync/gradle-home/. "$dst"/ 2>/dev/null || true
412
+ chmod -R u+rwX "$dst" 2>/dev/null || true
413
+ touch "$dst/.ecosync-preseeded" 2>/dev/null || true
414
+ fi
415
+ }
416
+ deps_roots_for_repo() {
417
+ local repo="$1"
418
+ local name
419
+ name="$(basename "$repo")"
420
+ local root
421
+ for root in /opt/ecosync/image-deps/*; do
422
+ [[ -d "$root/deps" || -d "$root/repo/node_modules" || -d "$root/pnpm-store" || -d "$root/venv" ]] || continue
423
+ [[ "$(basename "$root")" == *"$name"* ]] && printf '%s\n' "$root"
424
+ done
425
+ [[ -d /opt/ecosync/deps || -d /opt/ecosync/repo/node_modules || -d /opt/ecosync/pnpm-store || -d /opt/ecosync/venv ]] && printf '%s\n' /opt/ecosync
426
+ for root in /opt/ecosync/image-deps/*; do
427
+ [[ -d "$root/deps" || -d "$root/repo/node_modules" || -d "$root/pnpm-store" || -d "$root/venv" ]] && printf '%s\n' "$root"
428
+ done
429
+ return 0
430
+ }
431
+ prepare_repo() {
432
+ local repo="$1"
433
+ [[ -d "$repo" ]] || return 0
434
+ local root
435
+ while IFS= read -r root; do
436
+ [[ -n "$root" ]] || continue
437
+ [[ -f "$repo/composer.json" ]] && copy_tree "$root/deps/vendor" "$repo/vendor"
438
+ [[ -f "$repo/package.json" ]] && copy_tree "$root/deps/node_modules" "$repo/node_modules"
439
+ [[ -f "$repo/package.json" ]] && copy_tree "$root/repo/node_modules" "$repo/node_modules"
440
+ [[ -f "$repo/pyproject.toml" || -f "$repo/setup.py" ]] && copy_or_link "$root/venv" "$repo/.venv"
441
+ done < <(deps_roots_for_repo "$repo")
442
+ if [[ -f "$repo/tests/Java.Interop-Tests/Java.Interop-Tests.csproj" ]]; then
443
+ mkdir -p "$repo/external" "$repo/bin/BuildDebug"
444
+ local xat
445
+ for xat in /opt/ecosync/xamarin-android-tools-* /opt/ecosync/image-deps/*/xamarin-android-tools-*; do
446
+ [[ -d "$xat" ]] || continue
447
+ if [[ -L "$repo/external/xamarin-android-tools" || ! -f "$repo/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj" || ! -w "$repo/external/xamarin-android-tools" ]]; then
448
+ rm -rf "$repo/external/xamarin-android-tools" 2>/dev/null || true
449
+ fi
450
+ copy_writable_tree "$xat" "$repo/external/xamarin-android-tools"
451
+ break
452
+ done
453
+ if [[ ! -f "$repo/bin/BuildDebug/JdkInfo.props" ]]; then
454
+ cat > "$repo/bin/BuildDebug/JdkInfo.props" <<'XML'
455
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
456
+ <Choose>
457
+ <When Condition=" '$(JdkJvmPath)' == '' ">
458
+ <PropertyGroup>
459
+ <JdkJvmPath>/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so</JdkJvmPath>
460
+ </PropertyGroup>
461
+ <ItemGroup>
462
+ <JdkIncludePath Include="/usr/lib/jvm/java-17-openjdk-amd64/include" />
463
+ <JdkIncludePath Include="/usr/lib/jvm/java-17-openjdk-amd64/include/linux" />
464
+ </ItemGroup>
465
+ </When>
466
+ </Choose>
467
+ <PropertyGroup>
468
+ <JavaApiDefineConstants Condition=" '$(JavaApiDefineConstants)' == '' ">JAVA_API_11;JAVA_API_12;JAVA_API_13;JAVA_API_14;JAVA_API_15;JAVA_API_16;JAVA_API_17</JavaApiDefineConstants>
469
+ <JavaMajorVersion Condition=" '$(JavaMajorVersion)' == '' ">17</JavaMajorVersion>
470
+ <JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64</JavaSdkDirectory>
471
+ <JavaPath Condition=" '$(JavaPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/java</JavaPath>
472
+ <JavaCPath Condition=" '$(JavaCPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/javac</JavaCPath>
473
+ <JarPath Condition=" '$(JarPath)' == '' ">/usr/lib/jvm/java-17-openjdk-amd64/bin/jar</JarPath>
474
+ <DotnetToolPath Condition=" '$(DotnetToolPath)' == '' ">dotnet</DotnetToolPath>
475
+ </PropertyGroup>
476
+ </Project>
477
+ XML
478
+ fi
479
+ if [[ ! -f "$repo/bin/BuildDebug/JdkInfo.mk" ]]; then
480
+ cat > "$repo/bin/BuildDebug/JdkInfo.mk" <<'MK'
481
+ export JI_JAR_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/jar
482
+ export JI_JAVA_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/java
483
+ export JI_JAVAC_PATH := /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
484
+ export JI_JDK_INCLUDE_PATHS := /usr/lib/jvm/java-17-openjdk-amd64/include /usr/lib/jvm/java-17-openjdk-amd64/include/linux
485
+ export JI_JVM_PATH := /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
486
+ MK
487
+ fi
488
+ fi
489
+ return 0
490
+ }
491
+ if [[ -d "$workspace/repos" ]]; then
492
+ prepare_gradle_home
493
+ while IFS= read -r -d '' repo; do
494
+ prepare_repo "$repo"
495
+ done < <(find "$workspace/repos" -mindepth 2 -maxdepth 2 -type d -print0)
496
+ fi
497
+ exit 0
498
+ SH
499
+ RUN chmod +x /usr/local/bin/ecosync-case-prepare-workspace \
500
+ && printf '\n[ -r /etc/profile.d/ecosync-tools.sh ] && . /etc/profile.d/ecosync-tools.sh\n' >> /etc/bash.bashrc
501
+ RUN set -eux; \
502
+ for cfg in /opt/ecosync/venv/pyvenv.cfg /opt/ecosync/image-deps/*/venv/pyvenv.cfg; do \
503
+ [ -f "$cfg" ] || continue; \
504
+ venv="$(dirname "$cfg")"; \
505
+ minor="$(sed -n 's/^version = \([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' "$cfg" | head -1)"; \
506
+ [ -n "$minor" ] || continue; \
507
+ if [ -x "/usr/local/bin/python$minor" ]; then \
508
+ ln -sf "/usr/local/bin/python$minor" "$venv/bin/python"; \
509
+ ln -sf python "$venv/bin/python3"; \
510
+ sed -i "s#^home = .*#home = /usr/local/bin#; s#^executable = .*#executable = /usr/local/bin/python$minor#" "$cfg"; \
511
+ for script in "$venv"/bin/*; do \
512
+ [ -f "$script" ] || continue; \
513
+ first="$(head -c 64 "$script" 2>/dev/null || true)"; \
514
+ case "$first" in '#!'*'/opt/ecosync/venv/bin/python'*) sed -i "1s|^#!.*python.*$|#!$venv/bin/python|" "$script" ;; esac; \
515
+ done; \
516
+ fi; \
517
+ done
518
+ RUN if [ -x /etc/init.d/postgresql ]; then \
519
+ for conf in /etc/postgresql/*/main/postgresql.conf; do [ ! -f "$conf" ] || printf '%s\n' 'fsync = off' 'synchronous_commit = off' 'full_page_writes = off' >>"$conf"; done; \
520
+ service postgresql start; \
521
+ printf %s RE8gJGVjb3N5bmMkCkJFR0lOCiAgSUYgTk9UIEVYSVNUUyAoU0VMRUNUIEZST00gcGdfcm9sZXMgV0hFUkUgcm9sbmFtZSA9ICdndycpIFRIRU4KICAgIENSRUFURSBST0xFIGd3IExPR0lOOwogIEVORCBJRjsKICBBTFRFUiBST0xFIGd3IFBBU1NXT1JEICdwYXNzd29yZCc7CiAgSUYgTk9UIEVYSVNUUyAoU0VMRUNUIEZST00gcGdfcm9sZXMgV0hFUkUgcm9sbmFtZSA9ICdhYXBkYXNoYm9hcmQnKSBUSEVOCiAgICBDUkVBVEUgUk9MRSBhYXBkYXNoYm9hcmQgTE9HSU47CiAgRU5EIElGOwogIEFMVEVSIFJPTEUgYWFwZGFzaGJvYXJkIENSRUFURURCIFBBU1NXT1JEICdhYXBkYXNoYm9hcmQnOwogIElGIE5PVCBFWElTVFMgKFNFTEVDVCBGUk9NIHBnX3JvbGVzIFdIRVJFIHJvbG5hbWUgPSAnbWV0cmljc19zZXJ2aWNlJykgVEhFTgogICAgQ1JFQVRFIFJPTEUgbWV0cmljc19zZXJ2aWNlIExPR0lOOwogIEVORCBJRjsKICBBTFRFUiBST0xFIG1ldHJpY3Nfc2VydmljZSBDUkVBVEVEQiBQQVNTV09SRCAnbWV0cmljc19zZXJ2aWNlJzsKICBJRiBOT1QgRVhJU1RTIChTRUxFQ1QgRlJPTSBwZ19yb2xlcyBXSEVSRSByb2xuYW1lID0gJ2F3eCcpIFRIRU4KICAgIENSRUFURSBST0xFIGF3eCBMT0dJTjsKICBFTkQgSUY7CiAgQUxURVIgUk9MRSBhd3ggQ1JFQVRFREIgUEFTU1dPUkQgJ2F3eCc7CiAgQUxURVIgUk9MRSBwb3N0Z3JlcyBQQVNTV09SRCAncGFzc3dvcmQnOwpFTkQKJGVjb3N5bmMkOwpTRUxFQ1QgJ0NSRUFURSBEQVRBQkFTRSBnd19kYiBPV05FUiBndycKV0hFUkUgTk9UIEVYSVNUUyAoU0VMRUNUIEZST00gcGdfZGF0YWJhc2UgV0hFUkUgZGF0bmFtZSA9ICdnd19kYicpClxnZXhlYwpTRUxFQ1QgJ0NSRUFURSBEQVRBQkFTRSBhYXBkYXNoYm9hcmQgT1dORVIgYWFwZGFzaGJvYXJkJwpXSEVSRSBOT1QgRVhJU1RTIChTRUxFQ1QgRlJPTSBwZ19kYXRhYmFzZSBXSEVSRSBkYXRuYW1lID0gJ2FhcGRhc2hib2FyZCcpClxnZXhlYwpTRUxFQ1QgJ0NSRUFURSBEQVRBQkFTRSBtZXRyaWNzX3NlcnZpY2UgT1dORVIgbWV0cmljc19zZXJ2aWNlJwpXSEVSRSBOT1QgRVhJU1RTIChTRUxFQ1QgRlJPTSBwZ19kYXRhYmFzZSBXSEVSRSBkYXRuYW1lID0gJ21ldHJpY3Nfc2VydmljZScpClxnZXhlYwo= | base64 -d | su postgres -c "psql -v ON_ERROR_STOP=1"; \
522
+ service postgresql stop; \
523
+ touch /opt/ecosync/postgres-bootstrap-ready; \
524
+ fi
525
+ RUN if [ -f /usr/local/lib/node_modules/corepack/dist/corepack.js ]; then \
526
+ ln -sf ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
527
+ fi
528
+ ARG ECOSYNC_TASK_ID=ansible_automation_reports_metrics_service_e6fa7bc7aec0
529
+ LABEL org.ecosyncbench.layer=case-base \
530
+ org.ecosyncbench.agent_environment=case-env \
531
+ org.ecosyncbench.task=ansible_automation_reports_metrics_service_e6fa7bc7aec0
532
+ COPY --from=task_ctx /repo_envs.tsv /opt/ecosync/repo-envs.tsv
533
+ COPY --from=task_ctx /runners/ /opt/ecosync/
534
+ RUN chmod a+r /opt/ecosync/repo-envs.tsv \
535
+ && chmod +x /opt/ecosync/run-*.sh \
536
+ && git --version \
537
+ && python3 --version
538
+ WORKDIR /workspace
539
+ CMD ["bash"]
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/repo_envs.tsv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ repos/ansible/automation-reports /opt/ecosync
2
+ repos/ansible/metrics-service /opt/ecosync
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/run_profile_inside.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ cat >&2 <<'EOF'
4
+ ecosync-case-run-profile is disabled in agent case-env images.
5
+ Formal benchmark tests are evaluator-only and are injected after agent work.
6
+ Use the repository's normal visible test commands for debugging.
7
+ EOF
8
+ exit 2
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-dify-pytest.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export PYTHONDONTWRITEBYTECODE=1
8
+ "$deps_root/venv/bin/python" -m pytest -q --no-cov --junitxml="/workspace/.ecosyncbench/test-reports/${profile}.xml" "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-go-redis-test.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ focus="${2:?ginkgo focus required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export GOMODCACHE="${GOMODCACHE:-$deps_root/gomodcache}"
8
+ export GOPATH="${GOPATH:-$deps_root/gopath}"
9
+ export PATH="/usr/local/go/bin:$PATH"
10
+ redis_dir=/workspace/repos/redis/redis
11
+ if [[ ! -x "$redis_dir/src/redis-server" ]]; then
12
+ make -C "$redis_dir" -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
13
+ fi
14
+ "$redis_dir/src/redis-server" --port 6379 --save "" --appendonly no --daemonize yes
15
+ trap '"$redis_dir/src/redis-cli" -p 6379 shutdown nosave >/dev/null 2>&1 || true' EXIT
16
+ for _ in $(seq 1 50); do "$redis_dir/src/redis-cli" -p 6379 ping >/dev/null 2>&1 && break; sleep 0.1; done
17
+ REDIS_VERSION=8.8 RE_CLUSTER=true REDIS_PORT=6379 go test -count=1 -run TestGinkgoSuite -ginkgo.focus "$focus" . | tee "/workspace/.ecosyncbench/test-reports/${profile}.log"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-go-test.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export GOMODCACHE="${GOMODCACHE:-$deps_root/gomodcache}"
8
+ export GOPATH="${GOPATH:-$deps_root/gopath}"
9
+ export GOCACHE="${GOCACHE:-/tmp/ecosync-gocache}"
10
+ export PATH="/usr/local/go/bin:$PATH"
11
+ go test -count=1 -json "$@" | tee "/workspace/.ecosyncbench/test-reports/${profile}.json"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-ioredis-tsd.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then cp -a "$deps_root/deps/node_modules" node_modules; fi
8
+ npm run build
9
+ ./node_modules/.bin/tsd --files "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-jest.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export NODE_ENV=test
8
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then
9
+ cp -a "$deps_root/deps/node_modules" node_modules
10
+ fi
11
+ if [[ -f package.json ]] && node -e "const p=require('./package.json'); process.exit(p.scripts&&p.scripts.version?0:1)" >/dev/null 2>&1; then
12
+ npm run version >/tmp/ecosync-version.log 2>&1 || true
13
+ fi
14
+ ./node_modules/.bin/jest --ci --colors=false --json --outputFile="/workspace/.ecosyncbench/test-reports/${profile}.json" "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-maven-test.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ test_selector="${2:?maven test selector required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export MAVEN_OPTS="-Dmaven.repo.local=$deps_root/m2 ${MAVEN_OPTS:-}"
8
+ export GIT_CONFIG_GLOBAL="${GIT_CONFIG_GLOBAL:-/tmp/ecosyncbench-gitconfig}"
9
+ touch "$GIT_CONFIG_GLOBAL"
10
+ if [[ -f .git ]]; then
11
+ gitdir="$(sed -n 's/^gitdir: //p' .git | head -1)"
12
+ if [[ -n "$gitdir" && ! -d "$gitdir" ]]; then
13
+ rm -f .git
14
+ fi
15
+ fi
16
+ if [[ ! -d .git ]]; then
17
+ git -c safe.directory="$PWD" init -q
18
+ fi
19
+ git -c safe.directory="$PWD" config user.email ecosyncbench@example.invalid
20
+ git -c safe.directory="$PWD" config user.name EcoSyncBench
21
+ if ! git -c safe.directory="$PWD" rev-parse --verify HEAD >/dev/null 2>&1; then
22
+ git -c safe.directory="$PWD" commit --allow-empty -qm ecosyncbench-maven-metadata
23
+ fi
24
+ mvn -B -Dgit.commit.id.skip=true -Dformatter.skip=true -DskipITs=true -DskipIntegrationTests=true -DskipScenarioTests=true -Dtest="$test_selector" test
25
+ find target/surefire-reports -maxdepth 1 -name '*.xml' -type f -exec cp {} /workspace/.ecosyncbench/test-reports/ \; 2>/dev/null || true
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-node-redis-mocha.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ -d "$deps_root/deps/node_modules" && ! -d node_modules ]]; then cp -a "$deps_root/deps/node_modules" node_modules; fi
8
+ if [[ -d "$deps_root/deps/packages" && ! -d packages/node_modules ]]; then
9
+ for pkg_modules in "$deps_root"/deps/packages/*/node_modules; do
10
+ [[ -d "$pkg_modules" ]] || continue
11
+ pkg_name="$(basename "$(dirname "$pkg_modules")")"
12
+ mkdir -p "packages/$pkg_name"
13
+ cp -a "$pkg_modules" "packages/$pkg_name/node_modules"
14
+ done
15
+ fi
16
+ npm run build
17
+ ./node_modules/.bin/mocha -r tsx --reporter mocha-junit-reporter --reporter-options "mochaFile=/workspace/.ecosyncbench/test-reports/${profile}.xml,toConsole=false" --exit "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-phpunit.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ if [[ ! -d vendor && -d "$deps_root/deps/vendor" ]]; then
8
+ cp -a "$deps_root/deps/vendor" vendor
9
+ fi
10
+ composer dump-autoload --no-interaction --no-scripts >/tmp/ecosync-composer-dump.log
11
+ phpunit_args=(--colors=never)
12
+ if ./vendor/bin/phpunit --help 2>/dev/null | grep -q -- "--fail-on-risky"; then
13
+ phpunit_args+=(--fail-on-risky)
14
+ fi
15
+ phpunit_args+=(--log-junit "/workspace/.ecosyncbench/test-reports/${profile}.xml")
16
+ ./vendor/bin/phpunit "${phpunit_args[@]}" "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-redis-pytest.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ "$deps_root/venv/bin/python" -m pip install -e . --no-deps >/dev/null
8
+ redis_dir=/workspace/repos/redis/redis
9
+ if [[ ! -x "$redis_dir/src/redis-server" ]]; then
10
+ make -C "$redis_dir" -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
11
+ fi
12
+ "$redis_dir/src/redis-server" --port 6379 --save "" --appendonly no --daemonize yes
13
+ trap '"$redis_dir/src/redis-cli" -p 6379 shutdown nosave >/dev/null 2>&1 || true' EXIT
14
+ for _ in $(seq 1 50); do "$redis_dir/src/redis-cli" -p 6379 ping >/dev/null 2>&1 && break; sleep 0.1; done
15
+ "$deps_root/venv/bin/python" -m pytest -q --redis-url redis://127.0.0.1:6379/0 --junitxml="/workspace/.ecosyncbench/test-reports/${profile}.xml" "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-redis-server-test.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ single="${2:?single redis test required}"
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ make -j"${ECOSYNC_MAKE_JOBS:-2}" BUILD_TLS=no
7
+ ./runtest --single "$single" --timeout "${ECOSYNC_REDIS_TEST_TIMEOUT:-120}"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/case_env/runners/run-webpack-jest.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ profile="${1:?profile required}"
4
+ shift
5
+ mkdir -p /workspace/.ecosyncbench/test-reports
6
+ deps_root="${ECOSYNC_DEPS_ROOT:-/opt/ecosync}"
7
+ export NODE_ENV=test
8
+ if [[ ! -d node_modules && -d "$deps_root/deps/node_modules" ]]; then
9
+ cp -a "$deps_root/deps/node_modules" node_modules
10
+ fi
11
+ node --expose-gc --max-old-space-size=4096 --experimental-vm-modules \
12
+ ./node_modules/jest-cli/bin/jest \
13
+ --ci --colors=false --json --outputFile="/workspace/.ecosyncbench/test-reports/${profile}.json" "$@"
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/deps_image_lock.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ case_base_image:
2
+ agent_environment: case-env
3
+ local_tag: ecosyncbench/cases/ansible_automation_reports_metrics_service_e6fa7bc7aec0/case-base:deps-env
4
+ base_case_image: ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0
5
+ dependency_images_referenced_by_task:
6
+ - ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0
7
+ release_status: published
8
+ release_tag: ghcr.io/code-tmp/wideswe/cases/ansible_automation_reports_metrics_service_e6fa7bc7aec0/case-base:deps-env
9
+ local_image_id: sha256:0158175914bd84a93d4fa1ba6eb7e38561e03140673054cb55f5ea9fa9f0fbc4
10
+ size_bytes: 1614994126
11
+ release_digest: sha256:4176ee6a2e11e08ef9ae11f51c0c068b016b17439e4dd88f804b6cb8ba6e9967
12
+ generated_at_unix: 1789847920
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/docker-compose.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ ansible-aap-python:
3
+ image: ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0
4
+ build:
5
+ context: .
6
+ dockerfile: ansible-aap-cost-py.Dockerfile
7
+ working_dir: /workspace
8
+ volumes:
9
+ - ${ECOSYNC_WORKSPACE:?ECOSYNC_WORKSPACE required}:/workspace
10
+ - ${ECOSYNC_CACHE_ROOT:-/tmp/ecosyncbench-release120-runtime/cache/legacy/python-cache/ansible-aap-cost}:/python-cache
11
+ environment:
12
+ ECOSYNC_PROFILE: ${ECOSYNC_PROFILE:-}
13
+ UV_CACHE_DIR: /python-cache/uv
14
+ PIP_CACHE_DIR: /python-cache/pip
15
+ UV_LINK_MODE: copy
16
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
17
+ PYTHONDONTWRITEBYTECODE: "1"
18
+ PYTHONUNBUFFERED: "1"
19
+ command: ["/workspace/.ecosyncbench/run-ansible-aap-cost-profile.sh"]
cases/ansible/ansible_automation_reports_metrics_service_e6fa7bc7aec0/environment/run_profile.sh ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ profile="${1:?profile required}"
5
+ task_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
6
+ workspace="$(cd "${ECOSYNC_WORKSPACE:?ECOSYNC_WORKSPACE required}" && pwd)"
7
+ export ECOSYNC_PROFILE="$profile"
8
+
9
+ ensure_runner_script() {
10
+ mkdir -p "$workspace/.ecosyncbench"
11
+ cat > "$workspace/.ecosyncbench/run-ansible-aap-cost-profile.sh" <<'SH'
12
+ #!/usr/bin/env bash
13
+ set -euo pipefail
14
+
15
+ profile="${ECOSYNC_PROFILE:?ECOSYNC_PROFILE required}"
16
+ workspace=/workspace
17
+ reports="$workspace/.ecosyncbench/test-reports"
18
+ mkdir -p "$reports" /python-cache/venvs /python-cache/uv /python-cache/pip /python-cache/locks
19
+ export UV_LINK_MODE="${UV_LINK_MODE:-copy}"
20
+ export UV_CACHE_DIR="${UV_CACHE_DIR:-/python-cache/uv}"
21
+ export PIP_CACHE_DIR="${PIP_CACHE_DIR:-/python-cache/pip}"
22
+ export PIP_DISABLE_PIP_VERSION_CHECK=1
23
+ export PYTHONDONTWRITEBYTECODE=1
24
+ export PYTHONUNBUFFERED=1
25
+
26
+ start_postgres() {
27
+ cat >>/etc/postgresql/17/main/postgresql.conf <<'PGCONF'
28
+ # EcoSyncBench databases are disposable; avoid slow durable writes on evaluator storage.
29
+ fsync = off
30
+ synchronous_commit = off
31
+ full_page_writes = off
32
+ autovacuum = off
33
+ PGCONF
34
+ service postgresql start >/tmp/ecosync-postgres.log 2>&1 || {
35
+ cat /tmp/ecosync-postgres.log >&2
36
+ return 1
37
+ }
38
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_roles WHERE rolname='aapdashboard'\" | grep -q 1 || createuser aapdashboard" >/dev/null
39
+ su postgres -c "psql -v ON_ERROR_STOP=1 -c \"ALTER USER aapdashboard CREATEDB PASSWORD 'aapdashboard';\"" >/dev/null
40
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_database WHERE datname='aapdashboard'\" | grep -q 1 || createdb -O aapdashboard aapdashboard" >/dev/null
41
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_roles WHERE rolname='metrics_service'\" | grep -q 1 || createuser metrics_service" >/dev/null
42
+ su postgres -c "psql -v ON_ERROR_STOP=1 -c \"ALTER USER metrics_service CREATEDB PASSWORD 'metrics_service';\"" >/dev/null
43
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_roles WHERE rolname='awx'\" | grep -q 1 || createuser awx" >/dev/null
44
+ su postgres -c "psql -v ON_ERROR_STOP=1 -c \"ALTER USER awx CREATEDB PASSWORD 'awx';\"" >/dev/null
45
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_database WHERE datname='metrics_service'\" | grep -q 1 || createdb -O metrics_service metrics_service" >/dev/null
46
+ su postgres -c "psql -v ON_ERROR_STOP=1 -tc \"SELECT 1 FROM pg_database WHERE datname='awx'\" | grep -q 1 || createdb -O awx awx" >/dev/null
47
+ }
48
+
49
+ run_automation_reports() {
50
+ start_postgres
51
+ cd "$workspace/repos/ansible/automation-reports"
52
+ local fingerprint
53
+ fingerprint="$({
54
+ printf '%s\n' 'automation-reports-venv-v2-requirements-build'
55
+ sha256sum requirements-build.txt
56
+ } | sha256sum | cut -d' ' -f1)"
57
+ local venv="/python-cache/venvs/automation-reports-$fingerprint"
58
+ if [[ ! -x "$venv/bin/python" ]]; then
59
+ uv venv --seed "$venv"
60
+ uv pip install --python "$venv/bin/python" -r requirements-build.txt
61
+ fi
62
+ export DB_NAME=aapdashboard
63
+ export DB_USER=aapdashboard
64
+ export DB_PASSWORD=aapdashboard
65
+ export DB_HOST=127.0.0.1
66
+ export DB_PORT=5432
67
+ export PYTHONPATH="$workspace/repos/ansible/automation-reports/src:${PYTHONPATH:-}"
68
+ cat > src/backend/django_config/local_settings.py <<'PY'
69
+ import os
70
+
71
+ DB_NAME = os.environ.get("DB_NAME", "aapdashboard")
72
+ DB_USER = os.environ.get("DB_USER", "aapdashboard")
73
+ DB_PASSWORD = os.environ.get("DB_PASSWORD", "aapdashboard")
74
+ DB_HOST = os.environ.get("DB_HOST", "127.0.0.1")
75
+ DB_PORT = int(os.environ.get("DB_PORT", "5432"))
76
+
77
+ DATABASES = {
78
+ "default": {
79
+ "ENGINE": "django.db.backends.postgresql_psycopg2",
80
+ "NAME": DB_NAME,
81
+ "USER": DB_USER,
82
+ "PASSWORD": DB_PASSWORD,
83
+ "HOST": DB_HOST,
84
+ "PORT": DB_PORT,
85
+ },
86
+ "TEST": {
87
+ "ENGINE": "django.db.backends.postgresql_psycopg2",
88
+ "NAME": f"test_{DB_NAME}",
89
+ "USER": DB_USER,
90
+ "PASSWORD": DB_PASSWORD,
91
+ "HOST": DB_HOST,
92
+ "PORT": DB_PORT,
93
+ },
94
+ }
95
+
96
+ SECRET_KEY = "ecosyncbench-test-secret"
97
+ DATABASE_KEY = "ecosyncbench-test-database-key"
98
+ DEBUG = False
99
+ PY
100
+ "$venv/bin/python" -m pytest -q -o addopts="" --ds=backend.tests.settings_for_test \
101
+ src/backend/tests/unit/test_cost_per_elapsed_second.py \
102
+ src/backend/tests/unit/test_views.py \
103
+ --junitxml="$reports/automation-reports-hidden.xml"
104
+ }
105
+
106
+ run_metrics_service() {
107
+ start_postgres
108
+ cd "$workspace/repos/ansible/metrics-service"
109
+ local fingerprint
110
+ fingerprint="$({
111
+ printf '%s\n' 'metrics-service-venv-v1'
112
+ sha256sum pyproject.toml uv.lock
113
+ } | sha256sum | cut -d' ' -f1)"
114
+ local venv="/python-cache/venvs/metrics-service-$fingerprint"
115
+ export METRICS_SERVICE_MODE=test
116
+ export METRICS_SERVICE_DATABASES__DEFAULT__HOST=127.0.0.1
117
+ export METRICS_SERVICE_DATABASES__DEFAULT__USER=metrics_service
118
+ export METRICS_SERVICE_DATABASES__DEFAULT__PASSWORD=metrics_service
119
+ export METRICS_SERVICE_DATABASES__AWX__HOST=127.0.0.1
120
+ export METRICS_SERVICE_DATABASES__AWX__USER=awx
121
+ export METRICS_SERVICE_DATABASES__AWX__PASSWORD=awx
122
+ export UV_PROJECT_ENVIRONMENT="$venv"
123
+ (
124
+ flock 9
125
+ uv sync --frozen --group dev
126
+ ) 9>"/python-cache/locks/metrics-service-$fingerprint.lock"
127
+ uv run pytest -q -o addopts="" \
128
+ tests/coverage/dashboard_reports/test_dashboard_models_extended.py \
129
+ tests/coverage/general/test_final_push.py \
130
+ tests/unit/dashboard_reports/test_daily_subscription_cost.py \
131
+ tests/unit/dashboard_reports/test_export_urls.py \
132
+ tests/unit/dashboard_reports/test_report_view_data.py \
133
+ tests/unit/dashboard_reports/test_report_views.py \
134
+ --junitxml="$reports/metrics-service-hidden.xml"
135
+ }
136
+
137
+ case "$profile" in
138
+ automation_reports-hidden)
139
+ run_automation_reports
140
+ ;;
141
+ metrics_service-hidden)
142
+ run_metrics_service
143
+ ;;
144
+ *)
145
+ echo "Unknown Ansible AAP cost profile: $profile" >&2
146
+ exit 2
147
+ ;;
148
+ esac
149
+ SH
150
+ chmod +x "$workspace/.ecosyncbench/run-ansible-aap-cost-profile.sh"
151
+ }
152
+
153
+ run_compose_profile() {
154
+ local container_name="ecosync_${profile}_$$_${RANDOM}"
155
+ ensure_runner_script
156
+ cd "$task_dir/environment"
157
+ if [[ "${ECOSYNC_DOCKER_BUILD:-0}" == "1" ]] || ! docker image inspect ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0 >/dev/null 2>&1; then
158
+ ECOSYNC_WORKSPACE="$workspace" ECOSYNC_PROFILE="$profile" docker compose build ansible-aap-python
159
+ fi
160
+ if [[ "${ECOSYNC_DOCKER_PREBUILD_ONLY:-0}" == "1" || "${ECOSYNC_DOCKER_WARMUP_ONLY:-0}" == "1" ]]; then
161
+ docker image inspect ecosyncbench/deps/ansible-aap-cost-py:e6fa7bc7aec0 >/dev/null
162
+ return 0
163
+ fi
164
+ ECOSYNC_WORKSPACE="$workspace" ECOSYNC_PROFILE="$profile" docker compose run --rm --name "$container_name" ansible-aap-python
165
+ }
166
+
167
+ case "$profile" in
168
+ automation_reports-hidden|metrics_service-hidden)
169
+ run_compose_profile
170
+ ;;
171
+ *)
172
+ echo "Unknown profile for ansible_automation_reports_metrics_service_e6fa7bc7aec0: $profile" >&2
173
+ exit 2
174
+ ;;
175
+ esac