Skip to content

Commit ab9dc24

Browse files
committed
test(e2e): a tool read from build.ninja is run as a command line
For a compiler without its own library search path the binding starts with `env LD_LIBRARY_PATH=...` (D29); the resource round-trip (mingw-cross) and e2e 188 ran the binding as one program name.
1 parent 26943c7 commit ab9dc24

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎tests/e2e/188_build_actions.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ EOF
298298
printf 'int main() { return 0; }\n' > src/main.cpp
299299
"$MCPP" build > o0.log 2>&1 || { cat o0.log; echo "FAIL: probe build failed"; exit 1; }
300300
OBJ_NINJA=$(find target -name build.ninja | head -1)
301+
# A command line, written into mkobj.sh as one: it may start with
302+
# `env LD_LIBRARY_PATH=...` for a compiler without its own search path.
301303
OBJ_CXX=$(sed -n 's/^cxx *= *//p' "$OBJ_NINJA" | head -1)
302304
[ -n "$OBJ_CXX" ] || { cat "$OBJ_NINJA"; echo "FAIL: could not read the compiler out of build.ninja"; exit 1; }
303305

@@ -311,7 +313,7 @@ printf 'extern "C" int blob_value() { return 7; }\n' > blob.cpp
311313
cat > mkobj.sh <<EOF
312314
#!/usr/bin/env bash
313315
# \$1 = source, \$2 = object to produce
314-
"$OBJ_CXX" -c "\$1" -o "\$2"
316+
$OBJ_CXX -c "\$1" -o "\$2"
315317
EOF
316318
chmod +x mkobj.sh
317319
cat > build.mcpp <<'EOF'

‎tests/e2e/_windows_resources_body.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ esac
119119
# The rc tool comes out of build.ninja rather than off PATH: mcpp resolved it
120120
# payload-relative on purpose (a bare `windres` on PATH is an xlings shim), so
121121
# asking PATH here would inspect the artifact with a different tool than the one
122-
# that built it.
122+
# that built it. The binding is a command line: for a compiler without its own
123+
# library search path it starts with `env LD_LIBRARY_PATH=...`, so it is run by
124+
# a shell.
123125
RC_TOOL=$(sed -n 's/^rc *= *//p' "$BUILD_DIR/build.ninja" | head -1)
124126
[ -n "$RC_TOOL" ] || fail "no 'rc =' binding in build.ninja" "$BUILD_DIR/build.ninja"
125127

@@ -138,7 +140,7 @@ version_name_is() {
138140

139141
# Route 1 — windres back to rc SOURCE. Readable, and no PE parser needed.
140142
if [ -n "$RC_TOOL" ] \
141-
&& "$RC_TOOL" -J coff -O rc -i "$1" -o "rt.$2.rc" 2>"rt.$2.err" \
143+
&& sh -c "$RC_TOOL -J coff -O rc -i \"\$1\" -o \"\$2\"" rc "$1" "rt.$2.rc" 2>"rt.$2.err" \
142144
&& grep -qiE 'VERSIONINFO' "rt.$2.rc"; then
143145
grep -qE "$_want" "rt.$2.rc" \
144146
|| fail "expected the version resource to be named by $3 in $1" "rt.$2.rc"

0 commit comments

Comments
 (0)