-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add VeriFast CI #239
Add VeriFast CI #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
I'm developing a "refinement checker", a simple tool that checks that one |
I just pushed a first version of the refinement checker: test suite source code. For now, it supports only a tiny subset of MIR constructs: just function calls and local-to-local assignments. |
2a4f0d1
to
7fb4275
Compare
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
@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 occurs
check_test_source() {
local annotated_file="$1"
# Check if test file exists
if [ ! -f "$annotated_file" ]; then
echo "Error: Test file $annotated_file not found"
return 1
}
# Extract source file and hash from UPSTREAM comment
local pattern='/\* UPSTREAM "\([^"]*\)" "\([^"]*\)" \*/'
local extraction=$(sed -n "s|$pattern|\1 \2|p" "$test_file" | head -1)
# Check if extraction succeeded
if [ -z "$extraction" ]; then
echo "Error: Could not find UPSTREAM comment with file and hash in $annotated_file"
return 1
}
# Split extraction into source_file and hash
read -r source_file hash <<< "$extraction"
# Check if source file exists
if [ ! -f "$source_file" ]; then
echo "Error: Source file $source_file not found"
return 1
}
# Check if the hash exists in git history
if ! git rev-parse --quiet --verify "$hash" >/dev/null; then
echo "Error: Commit $hash not found in repository"
return 1
}
# Compare the file between the hash and HEAD
if git diff "$hash" HEAD -- "$source_file" >/dev/null; then
echo "WARNING: $source_file has changed since commit $hash"
return 1
else
echo "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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Co-authored-by: Carolyn Zech <[email protected]>
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
. (mysh
is 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.