Skip to content

Commit 1cf1a79

Browse files
brettfobaronfel
authored andcommitted
properly fail the build on unix failures (#7015)
I discovered that unix (linux/macos) failures would report the failing tests via the `Tests` tab in ADO, but the specific build step would appear green which made diagnosing failures difficult.
1 parent a814c1a commit 1cf1a79

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

eng/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ function TestUsingNUnit() {
170170
projectname="${projectname%.*}"
171171
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
172172
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\""
173-
"$DOTNET_INSTALL_DIR/dotnet" $args
173+
"$DOTNET_INSTALL_DIR/dotnet" $args || {
174+
local exit_code=$?
175+
echo "dotnet test failed (exit code '$exit_code')." >&2
176+
ExitWithExitCode $exit_code
177+
}
174178
}
175179

176180
function BuildSolution {

0 commit comments

Comments
 (0)