kani icon indicating copy to clipboard operation
kani copied to clipboard

Harness output individual files

Open Alexander-Aghili opened this issue 1 year ago • 27 comments

Resolves #3356

  1. Changes allow for directory with individual output of files named by the full harness name. --output-into-files command line argument will allow for placing all output of individual harnesses into files named by the full harness pretty_name. The output directory is either --target-dir or a hard coded default: "kani_output" directory. (These can be changed if there is a better interface). Still prints output to std::out exactly as previous.
  2. Previously, all output was placed into std::out. This will allow for some control over output. It will also enable easier parsing of harness output.
  3. Only solved #3356 but could be expanded to include more features.
  4. Ran manually to check the flags and output behaved as expected. Indeed: --output-into-files enabled will place output into individual files, disabled will not --output-terse will create terse output to command line, regular output to individual files if --output-into-files is enabled. --target-dir will place output into target-dir directory when --output-into-files is enabled, and will not place file output when disabled.

Let me know if you need specific explanations of code segments, a clean list of all the testing configurations, or any feature enhancement for greater configuration options.

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

Alexander-Aghili avatar Jul 19 '24 05:07 Alexander-Aghili

This output format is untested as of this PR. I'd like to see one regression test added at least. This isn't a blocking request, but likely something we want to add immediately, maybe in a follow up PR.

jaisnan avatar Jul 21 '24 12:07 jaisnan

This output format is untested as of this PR. I'd like to see one regression test added at least. This isn't a blocking request, but likely something we want to add immediately, maybe in a follow up PR.

I agree that tests should be added. I'd be fine adding it as a component of this PR or as a separate one, whichever is easier for you guys.

Alexander-Aghili avatar Jul 22 '24 05:07 Alexander-Aghili

Hey guys, sorry I haven't gotten to this in a minute. I was testing this on a server used by my research group, but my laptop's SSD failed with my ssh key so I can't really access the server at the moment. Should be fixed in a couple days. Thanks for the patience.

Alexander-Aghili avatar Jul 26 '24 00:07 Alexander-Aghili

Okay I tested it and added the -Z --unstable-options instead of --enable-unstable. Do we still want to add tests as a part of this PR?

Alexander-Aghili avatar Jul 31 '24 20:07 Alexander-Aghili

Okay I tested it and added the -Z --unstable-options instead of --enable-unstable. Do we still want to add tests as a part of this PR?

I'm okay without a regression for this specific output format since its a really special case and testing will involve some work. I can take that up in a follow up PR. You might want to do the following though (in order of priorities),

Required :-

  1. Fix existing regression tests that are failing
  2. Add comments on the functions related to processing the output.
  3. Format the code with cargo fmt and run cargo clippy on it once.

Optionally

  1. Create an issue to test the new output format.

jaisnan avatar Jul 31 '24 20:07 jaisnan

Hey there, I've done most of it but I ran into this issue when running regression tests: ERROR: CBMC version is 5.89.0, expected at least 5.95.0 How can I upgrade the CBMC version?

Alexander-Aghili avatar Aug 01 '24 17:08 Alexander-Aghili

Hey there, I've done most of it but I ran into this issue when running regression tests: ERROR: CBMC version is 5.89.0, expected at least 5.95.0 How can I upgrade the CBMC version?

You can re-run the script responsible for installing the dependencies to install the appropriate CBMC version. Here is a link to the wiki page that explains what exactly to run: https://model-checking.github.io/kani/build-from-source.html#dependencies.

artemagvanian avatar Aug 01 '24 18:08 artemagvanian

If you're using a Mac, run:

./scripts/setup/macos/install_cbmc.sh

If you're using Ubuntu, run:

./scripts/setup/ubuntu/install_cbmc.sh

zhassan-aws avatar Aug 01 '24 18:08 zhassan-aws

I don't want to be the bottleneck on this but in short, I am having a difficult time upgrading because of permissions issues on my remote server, and thus, if others want to try and fix the regression tests, then that is fine as well. Otherwise I am going to have to spend some time fixing the issue on the server I do my development work on and I'm out of town at the moment.

Alexander-Aghili avatar Aug 04 '24 17:08 Alexander-Aghili

I don't want to be the bottleneck on this but in short, I am having a difficult time upgrading because of permissions issues on my remote server, and thus, if others want to try and fix the regression tests, then that is fine as well. Otherwise I am going to have to spend some time fixing the issue on the server I do my development work on and I'm out of town at the moment.

Hi @Alexander-Aghili, the regression tests should pass now after the fix from @celinval. You should be able to resume development if you have the time to add tests. If not, please let us know and we can take on the task of adding a test on this PR 😄

jaisnan avatar Aug 14 '24 21:08 jaisnan

Hi guys, Sorry for taking so long, I've been out on holiday. I made an issue for adding regression tests. Do we want to complete that in this PR? If not, what needs to be done with this PR to merge it? If we do, how should the regression test be done?

Alexander-Aghili avatar Aug 20 '24 00:08 Alexander-Aghili

Hi guys, Sorry for taking so long, I've been out on holiday. I made an issue for adding regression tests. Do we want to complete that in this PR? If not, what needs to be done with this PR to merge it? If we do, how should the regression test be done?

For this pr to be merged, we are looking for at least something that uses the new flag and ensure Kani still succeeds. It doesn't need to check that the files exist, just needs to test that Kani doesn't break. If you can add that, I am OK with merging the PR. Lmk if thats putting too much on your plate, and I can take over this PR and add those changes myself as well. In any case, thank you very much for the changes :D.

jaisnan avatar Aug 20 '24 14:08 jaisnan

I swear I'm not as flaky as I seem but my computer's screen just broke and I'm going to have to get it replaced which might take some time. If you want to take it over and finish the PR feel free to do so otherwise I'll get on it immediately when I can.

Alexander-Aghili avatar Aug 20 '24 15:08 Alexander-Aghili

I swear I'm not as flaky as I seem but my computer's screen just broke and I'm going to have to get it replaced which might take some time. If you want to take it over and finish the PR feel free to do so otherwise I'll get on it immediately when I can.

No worries :D

jaisnan avatar Aug 20 '24 15:08 jaisnan

Finally getting back around to this. I will be creating that test and merging in the new base, then asking for a review to be merged.

Alexander-Aghili avatar Sep 18 '24 00:09 Alexander-Aghili

Finally getting back around to this. I will be creating that test and merging in the new base, then asking for a review to be merged.

Awesome, thank you!

jaisnan avatar Sep 18 '24 14:09 jaisnan

Hey, I was checking the other UI tests and they verify the validity of the response by running a proof in a main.rs file and checking it with an expected output which is a single txt. With the proper output being a directory, how should I handle that? Also, do you use git merge or git rebase when updating the git structure?

Alexander-Aghili avatar Sep 21 '24 17:09 Alexander-Aghili

Hey, I was checking the other UI tests and they verify the validity of the response by running a proof in a main.rs file and checking it with an expected output which is a single txt. With the proper output being a directory, how should I handle that? Also, do you use git merge or git rebase when updating the git structure?

Great question. Most of our tests check Kani's console output. For cases like this PR, we have a script based regression that we store in tests/script-based-pre. You can find more details here: https://model-checking.github.io/kani/regression-testing.html#script-based-tests

About git. I personally prefer rebasing as I'm developing a feature, but once I publish a PR, I switch to merge since the GitHub UI seems to handle it better. Our PR merge strategy uses squash, so each PR eventually becomes a single commit. I hope that answers your questions.

Thanks again for your collaboration! I can't wait for this PR to be merged. 😃

celinval avatar Sep 23 '24 12:09 celinval

So I think when I merged, it included all of the commits in the commit history here. Is there a way to prevent that in the future? Also, I looked at the script-based-pre testing and it seemed like the .expected file checks the output of the command to stdout but I wasn't sure how to verify the generation of the output to directories. I decided that I would do it through a script which is almost done. Would it be better to do it another way or do you need to see the code first to decide?

Alexander-Aghili avatar Oct 07 '24 20:10 Alexander-Aghili

So I think when I merged, it included all of the commits in the commit history here. Is there a way to prevent that in the future? Also, I looked at the script-based-pre testing and it seemed like the .expected file checks the output of the command to stdout but I wasn't sure how to verify the generation of the output to directories. I decided that I would do it through a script which is almost done. Would it be better to do it another way or do you need to see the code first to decide?

Hi @Alexander-Aghili, the only problem I see is that you seem to have accidentally a target/tools folder. If you remove this, it should be good to go.

celinval avatar Oct 07 '24 22:10 celinval

@celinval I updated with a test to ensure the feature operates and behaves as expected... how could I remove the target/tools file from the commit if that matters because git rm --cached is not working.

Alexander-Aghili avatar Oct 07 '24 23:10 Alexander-Aghili

Just remove the folder with regular rm and create a new commit. It's fine.

celinval avatar Oct 07 '24 23:10 celinval

Given it passes the regression tests, it should be good to go.

Alexander-Aghili avatar Oct 08 '24 02:10 Alexander-Aghili

Hey everyone, any update here?

Alexander-Aghili avatar Oct 15 '24 15:10 Alexander-Aghili

Hey everyone, any update here?

Almost there, can you resolve the merge conflicts and push again?

jaisnan avatar Oct 15 '24 15:10 jaisnan

@jaisnan Fixed

Alexander-Aghili avatar Oct 15 '24 22:10 Alexander-Aghili

Okay I updated it. However, it seems like sometimes the tests fail only on the CI?

Alexander-Aghili avatar Oct 17 '24 22:10 Alexander-Aghili

Before we merge, can you resolve the merge conflicts locally? It'll allow us to see CI as well

jaisnan avatar Oct 24 '24 21:10 jaisnan

Anything more needed here?

Alexander-Aghili avatar Nov 04 '24 00:11 Alexander-Aghili

We should be good to go after resolving the conflicts.

zhassan-aws avatar Nov 04 '24 04:11 zhassan-aws