Description
It is possible to end up in a situation where an rb_test
rule produces a shell script from binary.sh.tpl
that never receives arguments. In this case, executing the rule results in a false negative - in other words, bazel test
will pass even though the Ruby test has never been executed because the only thing that runs is bundle exec ruby
which returns successfully.
I'm still trying to determine what I've done in my local setup to misconfigure the rb_test
in this way, but having defense in depth could help others avoid losing the same time that I have tracking this down.
Something like:
if [[ -n "${TEST_BINARY:-}" && $# -le 0 ]]; then
echo "Error! No arguments provided to test binary"
exit -1
fi
This approach would rely on TEST_BINARY
(set by test-setup.sh
) to be present so that the check for missing arguments doesn't apply to vanilla rb_binary
rules.
WDYT, @p0deje ?