Skip to content

Commit d51a973

Browse files
committed
debug: show build log on test 02 failure for Windows diagnosis
1 parent 577c008 commit d51a973

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/e2e/02_new_build_run.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ cd hello
1717
grep -q "import std" src/main.cpp || { echo "main.cpp missing 'import std'"; exit 1; }
1818
grep -q "std::println" src/main.cpp || { echo "main.cpp missing 'std::println'"; exit 1; }
1919

20-
# Build
21-
"$MCPP" build > build.log 2>&1 || { cat build.log; echo "build failed"; exit 1; }
20+
# Build (capture output, show on failure)
21+
set +e
22+
"$MCPP" build > build.log 2>&1
23+
build_rc=$?
24+
set -e
25+
if [[ $build_rc -ne 0 ]]; then
26+
cat build.log
27+
echo "build failed (rc=$build_rc)"
28+
exit 1
29+
fi
2230
[[ -d target ]] || { cat build.log; echo "no target/ dir"; exit 1; }
2331
# On Windows (MINGW/MSYS) the binary has a .exe suffix
2432
OS="$(uname -s)"
@@ -27,7 +35,7 @@ if [[ "$OS" == MINGW* || "$OS" == MSYS* || "$OS" == CYGWIN* ]]; then
2735
else
2836
binary="$(find target -name hello -type f | head -1)"
2937
fi
30-
[[ -n "$binary" ]] || { echo "binary not produced"; exit 1; }
38+
[[ -n "$binary" ]] || { echo "binary not produced"; find target -type f 2>/dev/null | head -10; exit 1; }
3139
[[ -x "$binary" ]] || { echo "binary not executable"; exit 1; }
3240

3341
# Run via mcpp

0 commit comments

Comments
 (0)