Uh oh!
There was an error while loading. Please reload this page.
Add VeriFast CI - #239
Conversation
Uh oh!
There was an error while loading. Please reload this page.
remi-delmas-3000
left a comment
There was a problem hiding this comment.
@btj do you think you could add a simple proof example in ./verifast-proofs and implement the diff and tool invocation logic in check-verifast-proofs.mysh ? We'd like to be able to check that the action runs/fails/succeeds at least once. A positive and a negative example would be great
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
btj
commented
Feb 5, 2025
I'm developing a "refinement checker", a simple tool that checks that one |
btj
commented
Feb 6, 2025
I just pushed a first version of the refinement checker: test suitesource code. For now, it supports only a tiny subset of MIR constructs: just function calls and local-to-local assignments. |
2a4f0d1 to
7fb4275Comparebtj
commented
Feb 12, 2025
Hi @remi-delmas-3000 , I think I addressed all of the issues you raised. I'll leave it to you to resolve the conversations or otherwise follow up. |
@btj Tthanks a lot for all the modifications !
|
Need to split action into expect success/expect failure actions
Uh oh!
There was an error while loading. Please reload this page.
@btj This repository is already a copy of the upstream repository, so we'd like to avoid extra copies that are not strictly necessary. That's the last request we have for this PR. We could avoid making a full copy of the library file, and instead use a git command to diff /* UPSTREAM "path/to/file.rs" "abc123...." */And we run something like that to diff that reference hash with the current head. #!/bin/bash# Function to check if a test file's referenced source matches its specified commit# Parameters:# $1: test file path# Returns:# 0 if source file matches the committed version# 1 if differences found or any error occurscheck_test_source() {
local annotated_file="$1"# Check if test file existsif [ !-f"$annotated_file" ];thenecho"Error: Test file $annotated_file not found"return 1
}
# Extract source file and hash from UPSTREAM commentlocal pattern='/\* UPSTREAM "\([^"]*\)" "\([^"]*\)" \*/'local extraction=$(sed -n "s|$pattern|\1 \2|p""$test_file"| head -1)# Check if extraction succeededif [ -z"$extraction" ];thenecho"Error: Could not find UPSTREAM comment with file and hash in $annotated_file"return 1
}
# Split extraction into source_file and hashread -r source_file hash<<<"$extraction"# Check if source file existsif [ !-f"$source_file" ];thenecho"Error: Source file $source_file not found"return 1
}
# Check if the hash exists in git historyif! git rev-parse --quiet --verify "$hash">/dev/null;thenecho"Error: Commit $hash not found in repository"return 1
}
# Compare the file between the hash and HEADif git diff "$hash" HEAD -- "$source_file">/dev/null;thenecho"WARNING: $source_file has changed since commit $hash"return 1
elseecho"OK: $source_file matches the version at commit $hash"return 0
fi
}The refinement check could then directly run against the upstream file ? @carolynzech does that match your idea? |
Yes. Any solution that avoids adding extra copies is fine--the proof-annotated copies are okay, since those require actual code changes to insert ghost code. But there shouldn't be any need to copy the original files; we should be able to reference those from git history alone. The git solution 1) prevents the size of this repository from exploding and 2) provides a record of how the verified files fit into the history of the upstream repo. I recommend looking at Kani's setup for how to organize it--you could add a script of your own to I had a few other comments as well:
|
Let me try to understand. The current file structure of the example Here, Now, if I understand correctly, you are objecting to the presence of While this is definitely feasible, I would like to double-check if you really think this is better than the current approach. A big advantage of the current approach, IMHO, is simplicity: fewer moving parts. The file structure that you get from checking out the repo is immediately ready for running VeriFast (which needs While I applaud your optimism regarding how fast Having said all this, I will of course implement the requested changes if confirmed. |
carolynzech
left a comment
There was a problem hiding this comment.
@btj Your comment was helpful--I think I got a bit confused trying to map the abstract examples in the README to the actual files you're adding here. I think I understand the reason for the copies now, and I'm okay with them.
I added an "Example" section to the README inspired by your comment; I think a more explicit example is useful here. Feel free to make any changes as you see fit, then I'm good to merge.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Carolyn Zech <cmzech@amazon.com>
btj
commented
Feb 19, 2025
Many thanks, @carolynzech ! The edits to the README you suggested will indeed be very useful to readers; I applied them almost verbatim. |
Adds a GitHub Actions workflow that downloads VeriFast and runs
verifast-proofs/check-verifast-proofs.mysh. (myshis a simple tool that ships with VeriFast for running simple scripts. It is optimized for running test suites (and used to run VeriFast's test suite. Works on Linux, Mac, and Windows.)See #238 to see how this can be used to verify the
linked_list.rs(Challenge 5) solution.Resolves#213
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.