Skip to content

Commit 575453f

Browse files
committed
fix: dynamically detect WASM output path in reproducibility test
The output path varies between environments (bazel-bin symlink vs bazel-out path). Extract the actual path from bazel's build output to make the test work in CI.
1 parent bb35b8e commit 575453f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.hermetic_test.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,23 @@ test_reproducibility() {
149149
echo "-----------------------------"
150150

151151
TARGET="//examples/basic:hello_component_release"
152-
WASM_OUTPUT="bazel-bin/examples/basic/hello_component_wasm_lib_release_wasm_base.wasm"
153152

154153
# First build
155154
echo " Building first time..."
156-
if ! bazel build "$TARGET" 2>&1 | tail -3; then
155+
BUILD_OUTPUT=$(bazel build "$TARGET" 2>&1)
156+
if [ $? -ne 0 ]; then
157157
echo -e "${RED}✗ First build failed${NC}"
158+
echo "$BUILD_OUTPUT" | tail -3
158159
return 1
159160
fi
160161

162+
# Extract the actual output path from bazel's output
163+
WASM_OUTPUT=$(echo "$BUILD_OUTPUT" | grep -o "bazel-out/.*/hello_component_wasm_lib_release_wasm_base.wasm" | head -1)
164+
if [ -z "$WASM_OUTPUT" ]; then
165+
# Fallback to symlink path
166+
WASM_OUTPUT="bazel-bin/examples/basic/hello_component_wasm_lib_release_wasm_base.wasm"
167+
fi
168+
161169
if [ ! -f "$WASM_OUTPUT" ]; then
162170
echo -e "${RED}✗ WASM output not found: $WASM_OUTPUT${NC}"
163171
return 1

0 commit comments

Comments
 (0)