10000 binary.sh.tpl doesn't check that arguments are passed when used as a test · Issue #233 · bazel-contrib/rules_ruby · GitHub
[go: up one dir, main page]

Skip to content
binary.sh.tpl doesn't check that arguments are passed when used as a test #233
Open
@JasonLunn

Description

@JasonLunn

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0