Skip to content
Merged
Show file tree
Hide file tree
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 Jul 18, 2026
9557bc3
Language.Rocq.AST: Add missing export list. NFCI.
sauclovian-g Aug 3, 2026
2a9d909
Language.Rocq.AST: tidy
sauclovian-g Aug 3, 2026
9dce661
Language.Rocq.AST: tsort contents of file. NFCI
sauclovian-g Aug 3, 2026
a135964
Language.Rocq.Pretty: tidy.
sauclovian-g Aug 3, 2026
0550306
Language.Rocq.Pretty: import Prettyprinter as PP.
sauclovian-g Aug 3, 2026
b4e3afd
Language.Rocq.Pretty: tsort contents of file. NFCI
sauclovian-g Aug 3, 2026
763d731
otherTests/saw-core-rocq: There are no tests that print lists.
sauclovian-g Aug 3, 2026
163b1a3
saw-core-rocq: Add actual prettyprinting logic for expressions.
sauclovian-g Aug 4, 2026
649b9e8
saw-core-rocq: Fix printing of inductives.
sauclovian-g Aug 7, 2026
2f9db12
saw-core-rocq: Fix printing of definitions.
sauclovian-g Aug 7, 2026
59b71b0
saw-core-rocq: Fix printing of other declarations.
sauclovian-g Aug 7, 2026
4776506
saw-core-rocq: Fix printing of sections.
sauclovian-g Aug 7, 2026
3a4d93e
Language.Rocq.Pretty: whitespace
sauclovian-g Aug 7, 2026
f312ceb
saw-core-rocq: Improve the printing of function applications.
sauclovian-g Aug 7, 2026
85e0120
saw-core-rocq: A few more printing fixes.
sauclovian-g Aug 7, 2026
d0b69e2
saw-core-rocq: Rearrange the prettyprinter doc rendering.
sauclovian-g Aug 8, 2026
ea93b62
saw-core-rocq: Use the "smart" prettyprinter layout engine.
sauclovian-g Aug 8, 2026
2c7d115
saw-core-rocq: Textify.
sauclovian-g Aug 8, 2026
11e0665
saw-core-rocq: Fix printing of chains of foralls.
sauclovian-g Aug 8, 2026
f801a1e
saw-core-rocq: Give the same treatment to function headers.
sauclovian-g Aug 8, 2026
72b5ebc
CHANGES entry for Rocq printing fixes.
sauclovian-g Aug 7, 2026
1b8624e
otherTests/saw-core-rocq: Reorganize.
sauclovian-g Aug 8, 2026
ffd75cb
saw-core-rocq-tests: Add build machinery for running Rocq.
sauclovian-g Aug 8, 2026
6c06b41
CI: Rename the saw-core-rocq-tests job to rocq-builds.
sauclovian-g Aug 8, 2026
136bd79
CI: use the new "make rocq" functionality.
sauclovian-g Aug 8, 2026
d7a30e8
Language.Rocq.AST: Fix Haddock formatting
sauclovian-g Aug 8, 2026
11198f2
Language.Rocq.Pretty: Fix Haddock formatting
sauclovian-g Aug 8, 2026
cd5e8bb
Language.Rocq.Pretty: more type signatures in contractPiBinders
sauclovian-g Aug 8, 2026
fd47fb4
Language.Rocq.Pretty: Fix spelling of the alternate binder types.
sauclovian-g Aug 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ jobs:
publish_dir: gh-pages
keep_files: true

saw-core-rocq-tests:
rocq-builds:
needs: [build]
strategy:
fail-fast: false
Expand Down Expand Up @@ -626,6 +626,17 @@ jobs:
shell: bash
run: opam exec -- make -j

# Regenerate the test .v files, since we don't have the ones from the
# test run and rebuilding them isn't super expensive.
- working-directory: otherTests/saw-core-rocq
shell: bash
run: SAW=saw sh ./test.sh

# Now build, or try to build, all the output files.
- working-directory: otherTests/saw-core-rocq
shell: bash
run: opam exec -- make -j rocq
Comment on lines +636 to +638

Copy link
Copy Markdown
Contributor

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:

Run opam exec -- make -j rocq
for f in *.v; do make ${f%.v}.vo || exit 1; done
make[1]: *** No rule to make target '*.vo'.  Stop.
make[1]: Entering directory '/home/runner/work/saw-script/saw-script/otherTests/saw-core-rocq'
make[1]: Leaving directory '/home/runner/work/saw-script/saw-script/otherTests/saw-core-rocq'
make: *** [Makefile:21: rocq] Error 1

Copy link
Copy Markdown
Contributor Author

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.sh first to regenerate them, and if that doesn't work we may need to rearrange things further.


crux-mir-comp-tests:
needs: [build]
strategy:
Expand Down Expand Up @@ -1197,7 +1208,7 @@ jobs:
runs-on: ubuntu-24.04
needs:
- build
- saw-core-rocq-tests
- rocq-builds
- crux-mir-comp-tests
- saw-remote-api-tests
- cabal-test
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ This release supports [version

## Bug Fixes

* The Rocq exporter now generates more or less normal width output
instead of cramming everything onto one very long line.

* Fix bug in the `rme` solver causing the `<` operator to be treated as `<=`.

* Avoid exponential blow-up when generating uninterpreted functions.
Expand Down
205 changes: 205 additions & 0 deletions intTests/support/test-and-diff-rocq.sh
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
13 changes: 11 additions & 2 deletions otherTests/saw-core-rocq/.gitignore
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
31 changes: 29 additions & 2 deletions otherTests/saw-core-rocq/Makefile
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
2 changes: 1 addition & 1 deletion otherTests/saw-core-rocq/test.sh
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 "$@"
Loading
Loading