Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macros: add test macro #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

macros: add test macro #64

wants to merge 2 commits into from

Conversation

camshaft
Copy link
Owner

@camshaft camshaft commented Nov 9, 2021

closes #39

@Ekleog-NEAR
Copy link
Contributor

Just thinking: would it make sense, in addition to this, to have a #[bolero::non_fuzz_test] or similar macro?

This’d allow the tests to be skipped when run with BOLERO_LIBFUZZER_ARGS, CARGO_BOLERO_SELECT, or any similar environment variable, and thus to make listing probably significantly faster

@camshaft
Copy link
Owner Author

I'd really like to fix the listing in a different way, ideally by embedding sections in the output artifact and cargo-bolero reading from those. This way we don't have to run the program at all and the user doesn't have to go annotate a bunch of slower tests.

@Ekleog-NEAR
Copy link
Contributor

That’d definitely be a much better solution, you’re right!

@Ekleog-NEAR
Copy link
Contributor

I thought about it some more, and it turns out that:

  • Linker-based test listing is hard
  • If a #[bolero::test] macro is added, we no longer need bolero::check!()
  • With a #[bolero::test] proc macro, making a list becomes trivial: just have the proc macro output an additional item #[test] fn __bolero_internal_list__{test_name}() that just outputs the JSON information, and run cargo test __bolero_internal_list__

As such, I think a reasonable way forward would be:

  • Add a #[bolero::test] macro that in addition to the test, also adds the __bolero_internal_list__{test_name}
  • Remove the current bolero::check macro
  • Make cargo list use cargo test __bolero_internal_list__

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement test attribute
2 participants