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

Enable --list-harnesses flag #1648

Closed
wants to merge 1 commit into from
Closed

Enable --list-harnesses flag #1648

wants to merge 1 commit into from

Conversation

jaisnan
Copy link
Contributor

@jaisnan jaisnan commented Sep 7, 2022

Description of changes:

Kani contains the harness metadata in a JSON file but it is only read temporarily before being deleted. The only way to retain this information was through the --keep-temps flag which stores these temporary files but is a bulky operation. The flag now however, does not start the verification process. The --list-harnesses flag returns a JSON string which can be consumed as an API by any receiver.

The output with the flag looks like this -
$cargo kani --enable-unstable --list-harnesses

[
  {
    "pretty_name": "check_estimate_size_2",
    "mangled_name": "check_estimate_size_2",
    "original_file": "../src/lib.rs",
    "original_start_line": 39,
    "original_end_line": 42,
    "unwind_value": null
  },
  {
    "pretty_name": "check_estimate_size",
    "mangled_name": "check_estimate_size",
    "original_file": "..src/lib.rs",
    "original_start_line": 30,
    "original_end_line": 33,
    "unwind_value": null
  }
]

Resolved issues:

Resolves #1612

Call-outs:

The flag only runs with cargo kani and not the single script kani because the cargo kani output would always be a superset of the kani output. i.e running the flag with just kani -

kani --list-harnesses test.rs

would return the regular verification output as if kani test.rs were run.

Testing:

  • How is this change tested?

  • Is this a refactor change?

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.

@jaisnan jaisnan requested a review from a team as a code owner September 7, 2022 19:53
@jaisnan jaisnan changed the title Enable --list-harnesses flag Enable --list-harnesses flag Sep 7, 2022
@celinval
Copy link
Contributor

celinval commented Sep 7, 2022

I would expect --list-harnesses to be formatted as a user friendly output though. I would suggest to rename it to be --print-metadata or something like that if you want to keep that output.

@celinval
Copy link
Contributor

celinval commented Sep 7, 2022

Call-outs:

The flag only runs with cargo kani and not the single script kani because the cargo kani output would always be a superset of the kani output.

I don't understand what you mean here? What will happen if the user invokes:

kani --list-harnesses test.rs

You should also clarify that this will not run the verification.

@jaisnan
Copy link
Contributor Author

jaisnan commented Sep 7, 2022

Call-outs:

The flag only runs with cargo kani and not the single script kani because the cargo kani output would always be a superset of the kani output.

I don't understand what you mean here? What will happen if the user invokes:

kani --list-harnesses test.rs

You should also clarify that this will not run the verification.

Makes sense. Will clarify these in the PR.

@jaisnan jaisnan closed this Sep 7, 2022
@jaisnan
Copy link
Contributor Author

jaisnan commented Sep 7, 2022

PR came directly from a local branch by mistake.

@jaisnan jaisnan deleted the list-harnesses-api branch April 14, 2023 18:13
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.

Create --list-harnessesAPI
2 participants