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

Use the clap derive API for the command line arguments of kani-compiler #2689

Merged
merged 6 commits into from
Aug 29, 2023

Conversation

JustusAdam
Copy link
Contributor

@JustusAdam JustusAdam commented Aug 17, 2023

Description of changes:

Ideally this doesn't change Kani's behavior at all. It only changes how kani-compiler processes its command line arguments.

This is mean as code simplification and cleanup and in anticipation of factoring out UnstableAttributes into a common crate so that they can be consistently handled by the compiler and the driver.

This change is supposed to be invisible to users

Isues

Closes #1647

Call outs

I tried to make this diff as small as possible, and in the process made some decisions that I think we can debate the efficacy of. I'm not married to these decisions and I'll happily adjust them.

  1. Use QueryDb as the argument struct. I think this is the most "centralized" and "canonical" way to do things, but I'm happy to make the arguments a separate struct that gets merged onto QueryDb. Although In that case I think I'd prefer to just store that arguments struct as a field in QueryDb because the code duplication would be yikes.
  2. Hand QueryDb to init_*. Maybe it doesn't need full access to the DB so we could also factor the logging arguments into a small substruct and #[clap(flatten)] it.
  3. I generally ignored the help fields, because clap will just use the documentation. And for that documentation I used the doc on the argument string constants or a combination of that and the doc on QueryDb because they were more elaborate. I'm happy to use a different strategy here but I also find this less important, since no user realistically is ever going to run kani-compiler manually.

Testing:

  • How is this change tested? No special test necessary

  • Is this a refactor change? You might say that ...

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@celinval
Copy link
Contributor

Can you link with #1647 please?

@JustusAdam
Copy link
Contributor Author

Can you link with #1647 please?

Oh damn, I probably should have run a search on issues first. Thanks for pointing it out.

@JustusAdam JustusAdam marked this pull request as ready for review August 17, 2023 22:54
@JustusAdam JustusAdam requested a review from a team as a code owner August 17, 2023 22:54
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should merge queries and the parser. I understand that there's a lot of redundancy, but the queries represents more than just the inputs.

You could still remove redundancy by changing the query to store the arguments that were passed inside an args field.

Edit: BTW, thank you so much for changing the compiler to use clap derived! So much nicer.

@JustusAdam
Copy link
Contributor Author

I don't think we should merge queries and the parser. I understand that there's a lot of redundancy, but the queries represents more than just the inputs.

You could still remove redundancy by changing the query to store the arguments that were passed inside an args field.

Edit: BTW, thank you so much for changing the compiler to use clap derived! So much nicer.

No problem. That's the way I'd prefer too. I used this first because it was a smaller diff but happy to pivot.

@JustusAdam
Copy link
Contributor Author

JustusAdam commented Aug 29, 2023

I'm not sure what's wrong with the CI here. @feliperodri or @celinval do you have an idea why this fails? I've rerun it multiple times but it seems to have the same failure every time.

@adpaco-aws
Copy link
Contributor

It looks like GitHub is failing to download some dependencies (e.g., kissat) from itself. These failures are often intermittent and it's just a matter of trying later.

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome! Thank you @JustusAdam.

@JustusAdam JustusAdam changed the title clap derived arguments for the compiler Use the clap derive API for the command line arguments of kani-compiler Aug 29, 2023
@JustusAdam JustusAdam merged commit 03d9331 into model-checking:main Aug 29, 2023
tautschnig pushed a commit to tautschnig/kani that referenced this pull request Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Use Clap Derive API instead of Builder API in kani-compiler
3 participants