unittest.bash: Correctly handle failures due to "errexit" in tests. This will get rid of all the "ghost flakes" where tests crashed with no apparant reason printed into our logs. Now a stack trace is printed and an easy to understand failure reason, too.
--
MOS_MIGRATED_REVID=110142957
diff --git a/scripts/bash_completion_test.sh b/scripts/bash_completion_test.sh
index d45c0b7..3eed6fb 100755
--- a/scripts/bash_completion_test.sh
+++ b/scripts/bash_completion_test.sh
@@ -170,8 +170,10 @@
assert_expansion_function() {
local ws=${PWD}
local function="$1" displacement="$2" type="$3" expected="$4" current="$5"
- assert_equals "$(echo -e "${expected}")" \
- "$(eval "_bazel__${function} \"${ws}\" \"${displacement}\" \"${current}\" \"${type}\"")"
+ disable_errexit
+ local actual_result=$(eval "_bazel__${function} \"${ws}\" \"${displacement}\" \"${current}\" \"${type}\"")
+ enable_errexit
+ assert_equals "$(echo -ne "${expected}")" "${actual_result}"
}
test_expand_rules_in_package() {