Skip to content

Commit 7139219

Browse files
btjtautschnig
andauthored
update-subtree action: patch VeriFast proofs (#371)
When preparing a merge subtree PR, try to patch the VeriFast proofs. Also tweaks `patch-verifast-proofs.sh` to ensure that no temporary files are left behind inside the working directory, even when the script fails mid-way. Note: I did not test this. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Michael Tautschnig <[email protected]>
1 parent 111339d commit 7139219

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

.github/workflows/update-subtree.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ jobs:
194194
sed -i "s/commit = .*/commit = \"${KANI_COMMIT_HASH}\"/" tool_config/kani-version.toml
195195
git -c user.name=gitbot -c user.email=git@bot \
196196
commit -m "Update Kani version to ${KANI_COMMIT_HASH}" tool_config/kani-version.toml
197+
198+
# Try to automatically patch the VeriFast proofs
199+
pushd verifast-proofs
200+
if bash ./patch-verifast-proofs.sh; then
201+
if ! git diff --quiet; then
202+
git -c user.name=gitbot -c user.email=git@bot \
203+
commit . -m "Update VeriFast proofs"
204+
else
205+
# The original files have not changed; no updates to the VeriFast proofs are necessary.
206+
fi
207+
else
208+
# Patching the VeriFast proofs failed; requires manual intervention.
209+
fi
210+
popd
197211
198212
- name: Create Pull Request without conflicts
199213
if: ${{ env.MERGE_CONFLICTS == 'no' && env.MERGE_PR_EXISTS == 'no' }}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
set -e -x
22

33
pushd alloc/collections/linked_list.rs
4-
diff original/linked_list.rs ../../../../library/alloc/src/collections/linked_list.rs > linked_list.diff || [ "$?" = 1 ]
5-
patch -p0 verified/linked_list.rs < linked_list.diff
6-
patch -p0 original/linked_list.rs < linked_list.diff
7-
rm linked_list.diff
4+
diff original/linked_list.rs ../../../../library/alloc/src/collections/linked_list.rs > /tmp/linked_list.diff || [ "$?" = 1 ]
5+
patch -p0 verified/linked_list.rs < /tmp/linked_list.diff
6+
patch -p0 original/linked_list.rs < /tmp/linked_list.diff
7+
rm /tmp/linked_list.diff
88
popd
99
pushd alloc/collections/linked_list.rs-negative
10-
diff original/linked_list.rs ../../../../library/alloc/src/collections/linked_list.rs > linked_list.diff || [ "$?" = 1 ]
11-
patch -p0 verified/linked_list.rs < linked_list.diff
12-
patch -p0 original/linked_list.rs < linked_list.diff
13-
rm linked_list.diff
10+
diff original/linked_list.rs ../../../../library/alloc/src/collections/linked_list.rs > /tmp/linked_list.diff || [ "$?" = 1 ]
11+
patch -p0 verified/linked_list.rs < /tmp/linked_list.diff
12+
patch -p0 original/linked_list.rs < /tmp/linked_list.diff
13+
rm /tmp/linked_list.diff
1414
popd

0 commit comments

Comments
 (0)