Skip to content

Commit 2939d65

Browse files
committed
tests: the counterexample for a gcc tree that states a linker
Every refusal this feature adds has a case; this one did not. It runs against an installed gcc payload and says so when none is present, rather than passing silently on a host without one.
1 parent 3fa5533 commit 2939d65

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎tests/e2e/875_toolchain_by_path.sh‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,21 @@ write_manifest "$work/empty" ''
8888
out="$("$MCPP" build 2>&1 || true)"
8989
grep -q "no C++ driver in bin/" <<<"$out" || fail "a tree without a driver was accepted"
9090

91+
# A gcc tree that states `ld` is refused: the role reaches a link through clang's
92+
# `--ld-path`, and gcc selects a linker by the name `ld` in a `-B` directory, so a
93+
# program under another name could not be chosen. Refused at the declaration
94+
# rather than ignored in the link.
95+
gcc_base="$HOME/.mcpp/registry/data/xpkgs/xim-x-gcc"
96+
[[ -d "$gcc_base" && -n "${USERPROFILE:-}" ]] || true
97+
gcc_ver="$(ls -1 "$gcc_base" 2>/dev/null | grep -E '^[0-9]+(\.[0-9]+)*$' | sort -V | tail -1)"
98+
if [[ -n "$gcc_ver" && -x "$gcc_base/$gcc_ver/bin/g++" ]]; then
99+
write_manifest "$gcc_base/$gcc_ver" ', tools = { ld = "'"$work/ld-wrapper"'" }'
100+
rm -rf target
101+
out="$("$MCPP" build 2>&1 || true)"
102+
grep -q "this is a gcc toolchain" <<<"$out" \
103+
|| fail "a gcc toolchain that states ld was accepted: $out"
104+
else
105+
echo "note: no gcc payload installed, so the gcc refusal is not exercised here"
106+
fi
107+
91108
echo "PASS: a toolchain named by path builds, is reported, and is identified"

0 commit comments

Comments
 (0)