0

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?

Jonathan Mayer
  • 132
  • 1
  • 5
  • I took a peek at the bazel source code and it looks like the "expect_failure" attribute might only be usable for analysis tests. It'd be a shame if this was true... – Jonathan Mayer Jul 05 '22 at 17:52

1 Answers1

1

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

daohu527
  • 452
  • 4
  • 15