mirror of
https://github.com/ceph/go-ceph
synced 2024-12-23 06:33:24 +00:00
entrypoint: fix pausing after test failure
The --pause option for the entrypoint script is useful for interactive debugging after a test failure, but the script was not pausing if the test suite failed. Add code to explicitly handle test failures including pausing. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
691cd8d99b
commit
7790594ee4
@ -51,6 +51,13 @@ while true ; do
|
||||
esac
|
||||
done
|
||||
|
||||
test_failed() {
|
||||
local pkg="$1"
|
||||
echo "*** ERROR: ${pkg} tests failed"
|
||||
pause_if_needed
|
||||
return 1
|
||||
}
|
||||
|
||||
test_pkg() {
|
||||
local pkg="$1"
|
||||
if [[ "$TEST_PKG" && "$TEST_PKG" != "$pkg" ]]; then
|
||||
@ -67,7 +74,9 @@ test_pkg() {
|
||||
fi
|
||||
|
||||
go test -v "${testargs[@]}" "./$pkg"
|
||||
ret=$?
|
||||
grep -v "^mode: count" "$pkg.cover.out" >> "cover.out"
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
pre_all_tests() {
|
||||
@ -105,13 +114,14 @@ test_go_ceph() {
|
||||
)
|
||||
pre_all_tests
|
||||
for pkg in "${pkgs[@]}"; do
|
||||
test_pkg "$pkg"
|
||||
test_pkg "$pkg" || test_failed "$pkg"
|
||||
done
|
||||
post_all_tests
|
||||
}
|
||||
|
||||
pause_if_needed() {
|
||||
if [[ ${PAUSE} = yes ]]; then
|
||||
echo "*** pausing execution"
|
||||
sleep infinity
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user