Skip to content

Commit 7f5c39b

Browse files
test(e2e): harden the conformance program helpers
Take the openshell-conformance path from cargo's build messages instead of assuming <target>/debug, so CARGO_BUILD_TARGET and other profiles work. Make the drift check fail clearly when it reads no test names from nextest. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent 9d4f6e5 commit 7f5c39b

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎e2e/support/conformance.sh‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,21 @@ e2e_openshell_conformance_bin() {
3737
return
3838
fi
3939

40-
cargo build \
40+
# Cargo reports where it put the binary, which depends on the target
41+
# directory and on CARGO_BUILD_TARGET. Diagnostics still go to stderr.
42+
local messages program
43+
messages="$(cargo build \
4144
--locked \
45+
--message-format=json-render-diagnostics \
4246
--manifest-path "${root}/tests/suites/conformance/Cargo.toml" \
43-
--bin openshell-conformance >&2 || return
44-
# Cargo resolves a relative CARGO_TARGET_DIR against the working directory.
45-
local target_dir
46-
target_dir="$(cd "${CARGO_TARGET_DIR:-${root}/tests/suites/conformance/target}" && pwd)" || return
47-
echo "${target_dir}/debug/openshell-conformance"
47+
--bin openshell-conformance)" || return
48+
program="$(printf '%s\n' "${messages}" \
49+
| sed -n 's/.*"executable":"\([^"]*\)".*/\1/p' | tail -n 1)"
50+
if [ -z "${program}" ] || [ ! -x "${program}" ]; then
51+
echo "ERROR: cargo did not report the openshell-conformance binary" >&2
52+
return 2
53+
fi
54+
echo "${program}"
4855
}
4956

5057
# Run the conformance suite with openshell-conformance. The JUnit report goes

‎tasks/scripts/check-conformance-program.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ cargo run --quiet --locked --manifest-path "${manifest}" --bin openshell-conform
1919
cargo nextest list --locked --color never --manifest-path "${manifest}" --message-format oneline \
2020
| awk '{print $2}' | sort > "${work}/nextest"
2121

22+
if [[ ! -s "${work}/nextest" ]]; then
23+
echo "error: could not read test names from nextest's list; has its oneline format changed?" >&2
24+
exit 1
25+
fi
2226
if ! diff -u "${work}/nextest" "${work}/program"; then
2327
echo "error: openshell-conformance list differs from nextest's list (-nextest +program)" >&2
2428
exit 1

0 commit comments

Comments
 (0)