-
Notifications
You must be signed in to change notification settings - Fork 84
Collection of saw-core-rocq cleanups and fixes #3361
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
Merged
+35,479
−5,554
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
6a0c143
saw-core-rocq: Remove stray "Check" from SAWCoreScaffolding.v
sauclovian-g 9557bc3
Language.Rocq.AST: Add missing export list. NFCI.
sauclovian-g 2a9d909
Language.Rocq.AST: tidy
sauclovian-g 9dce661
Language.Rocq.AST: tsort contents of file. NFCI
sauclovian-g a135964
Language.Rocq.Pretty: tidy.
sauclovian-g 0550306
Language.Rocq.Pretty: import Prettyprinter as PP.
sauclovian-g b4e3afd
Language.Rocq.Pretty: tsort contents of file. NFCI
sauclovian-g 763d731
otherTests/saw-core-rocq: There are no tests that print lists.
sauclovian-g 163b1a3
saw-core-rocq: Add actual prettyprinting logic for expressions.
sauclovian-g 649b9e8
saw-core-rocq: Fix printing of inductives.
sauclovian-g 2f9db12
saw-core-rocq: Fix printing of definitions.
sauclovian-g 59b71b0
saw-core-rocq: Fix printing of other declarations.
sauclovian-g 4776506
saw-core-rocq: Fix printing of sections.
sauclovian-g 3a4d93e
Language.Rocq.Pretty: whitespace
sauclovian-g f312ceb
saw-core-rocq: Improve the printing of function applications.
sauclovian-g 85e0120
saw-core-rocq: A few more printing fixes.
sauclovian-g d0b69e2
saw-core-rocq: Rearrange the prettyprinter doc rendering.
sauclovian-g ea93b62
saw-core-rocq: Use the "smart" prettyprinter layout engine.
sauclovian-g 2c7d115
saw-core-rocq: Textify.
sauclovian-g 11e0665
saw-core-rocq: Fix printing of chains of foralls.
sauclovian-g f801a1e
saw-core-rocq: Give the same treatment to function headers.
sauclovian-g 72b5ebc
CHANGES entry for Rocq printing fixes.
sauclovian-g 1b8624e
otherTests/saw-core-rocq: Reorganize.
sauclovian-g ffd75cb
saw-core-rocq-tests: Add build machinery for running Rocq.
sauclovian-g 6c06b41
CI: Rename the saw-core-rocq-tests job to rocq-builds.
sauclovian-g 136bd79
CI: use the new "make rocq" functionality.
sauclovian-g d7a30e8
Language.Rocq.AST: Fix Haddock formatting
sauclovian-g 11198f2
Language.Rocq.Pretty: Fix Haddock formatting
sauclovian-g cd5e8bb
Language.Rocq.Pretty: more type signatures in contractPiBinders
sauclovian-g fd47fb4
Language.Rocq.Pretty: Fix spelling of the alternate binder types.
sauclovian-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| # test-and-diff-rocq.sh: variant test-and-diff for the Rocq exporter tests. | ||
| # | ||
| # usage: sh ../../intTests/support/test-and-diff.sh [verb] | ||
| # where [verb] is the same as in the base test-and-diff. | ||
| # | ||
| # This version runs all SAW files *.saw like test-and-diff. But it | ||
| # also expects each one to generate some number of output .v files; it | ||
| # also diffs those against reference versions. | ||
| # | ||
| # The output .v files must be numbered using the form foo_1.v, | ||
| # foo_2.v, etc. The files foo_1.v.good and foo_2.v.good should | ||
| # correspondingly exist. The numbering starts at 1. | ||
| # | ||
| # Alternatively they can be named foo_{1,2,3,...}_prove0.v. | ||
| # | ||
| # It does not support SAW repl scripts (*.isaw) for simplicity, nor | ||
| # does it support output filtering stuff that isn't relevant to this | ||
| # use case. | ||
| # | ||
| # Note: we assume all .v files are test output and the clean rule may | ||
| # clobber them. Don't put your own handwritten files in the test dir. | ||
|
|
||
| # Get the list of tests. | ||
| # | ||
| # Note that in some shells (and depending on settings) asking for | ||
| # *.saw when there aren't any will yield "*.saw" rather than | ||
| # generating an error or an empty list. | ||
| TESTS= | ||
| for SCRIPT in *.saw; do | ||
| if [ "$SCRIPT" = "*.saw" ]; then | ||
| break | ||
| fi | ||
| BASE=${SCRIPT%.saw} | ||
| TESTS="$TESTS $BASE" | ||
| done | ||
| if [ "$TESTS" = "" ]; then | ||
| echo "$0: Found no files matching *.saw" 1>&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # shell function for the run-tests op | ||
| run-tests() { | ||
| for TEST in $TESTS; do | ||
| # Remove any existing test.log first as a precaution. This | ||
| # protects against misreading the results if the whole run | ||
| # gets killed before a new test.log gets produced. | ||
| # Also remove any corresponding .v files. | ||
| rm -f $TEST.log | ||
| rm -f ${TEST}_*.v | ||
|
|
||
| # run the test | ||
| # (do not fail if saw does, instead log it) | ||
| echo "$SAW $TEST.saw" | ||
| $SAW $TEST.saw > $TEST.log 2>&1 || echo FAILED >> $TEST.log | ||
|
|
||
| # Check the output against the expected version. | ||
| # Note: because we (intentionally) aren't using set -e, we | ||
| # don't need to failure-protect this with || true. | ||
| # Send any errors from diff to the output so they get seen. | ||
| diff -u $TEST.log.good $TEST.log > $TEST.log.diff 2>&1 | ||
| echo "diff -u $TEST.log.good $TEST.log" | ||
|
|
||
| # Now diff the output .v files. Count up until we get to | ||
| # a number where neither $TEST_$I.v nor $TEST_SI.v.good | ||
| # exists. | ||
| I=1 | ||
| while :; do | ||
| TESTX=${TEST}_$I | ||
| TESTY=${TEST}_${I}_prove0 | ||
| if [ -f "$TESTX.v" ] || [ -f "$TESTX.v.good" ]; then | ||
| diff -u "$TESTX.v.good" "$TESTX.v" > "$TESTX.v.diff" | ||
| echo "diff -u $TESTX.v.good $TESTX.v" | ||
| I=$(( $I + 1 )) | ||
| elif [ -f "$TESTY.v" ] || [ -f "$TESTY.v.good" ]; then | ||
| diff -u "$TESTY.v.good" "$TESTY.v" > "$TESTY.v.diff" | ||
| echo "diff -u $TESTY.v.good $TESTY.v" | ||
| I=$(( $I + 1 )) | ||
| else | ||
| break | ||
| fi | ||
| done | ||
| done | ||
| } | ||
|
|
||
| # shell function for the show-diffs op | ||
| show-diffs() { | ||
| # We assume all *.diff files belong to us, so we can just do | ||
| # "cat *.diff" rather than iterating over the known filenames. | ||
| cat *.diff | ||
| } | ||
|
|
||
| # shell function for the check-diffs op | ||
| check-diffs() { | ||
| LINES=$(cat *.diff 2>/dev/null | wc -l) | ||
| if [ $LINES -gt 0 ]; then | ||
| cat 1>&2 <<EOF | ||
|
|
||
| Unexpected test diffs. | ||
| If the new outputs are correct, update the reference outputs, but | ||
| please don't do so without thinking. | ||
| EOF | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| # shell function for the good op | ||
| good() { | ||
| checkonce () { | ||
| if ! [ -f $1 ]; then | ||
| echo "$0: No test output for $1" 1>&2 | ||
| echo "$0: Cannot update reference outputs" 1>&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
| for TEST in $TESTS; do | ||
| checkonce $TEST.log | ||
| I=1 | ||
| while :; do | ||
| TESTX=${TEST}_$I | ||
| TESTY=${TEST}_${I}_prove0 | ||
| if [ -f "$TESTX.v" ] || [ -f "$TESTX.v.good" ]; then | ||
| checkonce "$TESTX.v" | ||
| I=$(( $I + 1 )) | ||
| elif [ -f "$TESTY.v" ] || [ -f "$TESTY.v.good" ]; then | ||
| checkonce "$TESTY.v" | ||
| I=$(( $I + 1 )) | ||
| else | ||
| break | ||
| fi | ||
| done | ||
| done | ||
|
|
||
| once () { | ||
| if ! [ -f $1.good ] || \ | ||
| ! diff -q $1.good $1 >/dev/null; then | ||
| echo "cp $1 $1.good" | ||
| cp $1 $1.good | ||
| fi | ||
| } | ||
| for TEST in $TESTS; do | ||
| once $TEST.log | ||
| I=1 | ||
| while :; do | ||
| TESTX=${TEST}_$I | ||
| TESTY=${TEST}_${I}_prove0 | ||
| if [ -f "$TESTX.v" ] || [ -f "$TESTX.v.good" ]; then | ||
| once "$TESTX.v" | ||
| I=$(( $I + 1 )) | ||
| elif [ -f "$TESTY.v" ] || [ -f "$TESTY.v.good" ]; then | ||
| once "$TESTY.v" | ||
| I=$(( $I + 1 )) | ||
| else | ||
| break | ||
| fi | ||
| done | ||
| done | ||
| } | ||
|
|
||
| # shell function for the clean op | ||
| clean() { | ||
| echo "rm -f *_[0-9]*.v *.log *.diff" | ||
| rm -f *_[0-9]*.v *.log *.diff | ||
| } | ||
|
|
||
| # shell function for the test op | ||
| test() { | ||
| run-tests | ||
| show-diffs | ||
| check-diffs | ||
| } | ||
|
|
||
| # run the requested operations | ||
| if [ $# = 0 ]; then | ||
| test | ||
| else | ||
| for VERB in "$@"; do | ||
| case "$VERB" in | ||
| test) | ||
| test | ||
| ;; | ||
| run-tests) | ||
| run-tests | ||
| ;; | ||
| show-diffs|show) # allow "show" as short form | ||
| show-diffs | ||
| ;; | ||
| check-diffs|check) # allow "check" as short form | ||
| check-diffs | ||
| ;; | ||
| good) | ||
| good | ||
| ;; | ||
| clean) | ||
| clean | ||
| ;; | ||
| *) | ||
| echo "$0: unknown action $VERB" 1>&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
| fi | ||
|
|
||
| # done | ||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| test_offline_rocq*_prove0.v | ||
| *.log | ||
| *.rawlog | ||
| *.v | ||
| *.log.diff | ||
| *.v.diff | ||
|
|
||
| .depend | ||
| .lia.cache | ||
| *.vo | ||
| *.vok | ||
| *.vos | ||
| *.glob | ||
| *.vo.diff | ||
| .*.aux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,34 @@ | ||
| ROCQDIR=../../saw-core-rocq/rocq | ||
|
|
||
| ROCQ=rocq | ||
| ROCQFLAGS=\ | ||
| -Q $(ROCQDIR)/generated/CryptolToRocq CryptolToRocq \ | ||
| -Q $(ROCQDIR)/handwritten/CryptolToRocq CryptolToRocq | ||
|
|
||
| # Note: to load one of these into rocqide, you can do | ||
| # rocqide -f ../../saw-core-rocq/rocq/_RocqProject file.v | ||
| # | ||
| # However, for either that or the "make rocq" build you must first | ||
| # build saw-core-rocq/rocq. | ||
|
|
||
| all: | ||
| sh ./test.sh | ||
| clean: | ||
| sh ./test.sh clean | ||
| rm -f test_offline_rocq*_prove0.v | ||
| rm -f *.vo *.vo.diff | ||
|
|
||
| rocq: | ||
| for f in *.v; do $(MAKE) $${f%.v}.vo || exit 1; done | ||
| cat *.vo.diff | ||
| cat *.vo.diff | awk '{ print "Unexpected test diffs"; exit (1); }' | ||
|
|
||
| %.vo: %.v | ||
| $(ROCQ) c $(ROCQFLAGS) $< >$@.log 2>&1 || echo FAILED >> $@.log | ||
| diff -u $@.log.good $@.log > $@.diff || true | ||
|
|
||
| rocqdepend: | ||
| $(ROCQ) dep $(ROCQFLAGS) *.v > .depend | ||
|
|
||
| -include .depend | ||
|
|
||
| .PHONY: all clean | ||
| .PHONY: all clean rocq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| exec ${TEST_SHELL:-bash} ../../intTests/support/test-and-diff.sh "$@" | ||
| exec ${TEST_SHELL:-bash} ../../intTests/support/test-and-diff-rocq.sh "$@" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Some more debugging is needed here, based on the CI output here:
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.
Yeah, that's caused by the .v files not being there. I'll change it to run
test.shfirst to regenerate them, and if that doesn't work we may need to rearrange things further.