Skip to content

Commit

Permalink
Fail build when test fail (sonic-net#53)
Browse files Browse the repository at this point in the history
Why I did it
In current PR check, we would build dhcp6relay debian package, but even if the unit test failed, the build would still be ongoing, then the PR check would pass. It would cause we miss some unexpected damage change
image

How I did it
Modify Makefile to exit with code 1 if test fail

How I verify it
PR check
  • Loading branch information
yaqiangz authored Dec 25, 2024
1 parent ef7b972 commit dbaee8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $(DHCP6RELAY_TEST_TARGET): $(TEST_OBJS)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_TEST) -o $@

test: $(DHCP6RELAY_TEST_TARGET)
sudo ASAN_OPTIONS=detect_leaks=0 ./$(DHCP6RELAY_TEST_TARGET) --gtest_output=xml:$(DHCP6RELAY_TEST_TARGET)-test-result.xml || true
sudo ASAN_OPTIONS=detect_leaks=0 ./$(DHCP6RELAY_TEST_TARGET) --gtest_output=xml:$(DHCP6RELAY_TEST_TARGET)-test-result.xml || { echo 'Tests failed'; exit 1; }
$(GCOVR) -r ./ --html --html-details -o $(DHCP6RELAY_TEST_TARGET)-code-coverage.html
$(GCOVR) -r ./ --xml-pretty -o $(DHCP6RELAY_TEST_TARGET)-code-coverage.xml

Expand Down

0 comments on commit dbaee8b

Please sign in to comment.