Jonathan Mayer
Jonathan Mayer

Reputation: 346

"expect_failure" attributes for bazel rules

I want to define an "expect_failure" boolean attribute for a bazel rule set that I'm devising, so I can properly write tests for my tool chain. However:

ERROR: /blah/blah.bzl:7:26: cannot add attribute: There is already a built-in attribute 'expect_failure' which cannot be overridden.

I can't find documentation for this "built-in attribute" anywhere. When I attempt to make use of this built in attribute, I find that it is of type "string" rather than "bool" which maybe implies some nuance to its implementation. When I attempt to naively use it by defining "expect_failure" to be the string "True", I see an unexpected error message:

ERROR: /blah/blah/BUILD:159:21: in _verilog_test rule //blah/blah:blah-test: Expected failure not found: True

Can anyone illuminate correct use of the built-in "expect_failure" attribute for me?

Upvotes: 0

Views: 250

Answers (1)

daohu527
daohu527

Reputation: 512

expect_failure is use for analysis test framework. It depends on analysistest, and use to verify that a rule fails given certain inputs or in certain state.

Here is the docs

Upvotes: 1

Related Questions