-
Notifications
You must be signed in to change notification settings - Fork 90
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
poor PG man's workaround for coq/coq#11479 #750
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e52c7b7
omit-proofs: split command processing into two phases
hendriktews e261103
proof-check: new feature for listing passing and failing tests
hendriktews 3c0a989
CI: add proof-check tests
hendriktews a9f453d
proof-stat: add batch mode and TAP support
hendriktews 4f8e276
PG manual: add documentation for proof-check-proofs
hendriktews be3f8c9
proof-stat: add menu item for proof-check-proofs
hendriktews 4f7f5b1
proof-stat: add documentation for proof-check-proofs in PG-adapting
hendriktews 3d5055d
proof-stat: add CHANGES entry
hendriktews 1440ac2
proof-stat: address review comments
hendriktews 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 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 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 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 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 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,84 @@ | ||
;; This file is part of Proof General. | ||
;; | ||
;; © Copyright 2024 Hendrik Tews | ||
;; | ||
;; Authors: Hendrik Tews | ||
;; Maintainer: Hendrik Tews <hendrik@askra.de> | ||
;; | ||
;; SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
;;; Commentary: | ||
;; | ||
;; Test proof-check-proofs. | ||
|
||
(defun reset-coq () | ||
"Reset Coq and Proof General. | ||
Do `proof-shell-exit' to kill Coq and reset the locked region and | ||
a lot of other internal state of Proof General. Used at the | ||
beginning of the test when several tests work on the same Coq | ||
source file." | ||
(when (and (boundp 'proof-shell-buffer) | ||
(buffer-live-p proof-shell-buffer)) | ||
(proof-shell-exit t) | ||
(message "Coq and Proof General reseted"))) | ||
|
||
|
||
(ert-deftest proof-check-correct-stat () | ||
"Test `proof-check-proofs' on a file that is correct in non-opaque parts. | ||
Test that the report buffer contains the expected output." | ||
(setq proof-three-window-enable nil) | ||
(reset-coq) | ||
(find-file "proof_stat.v") | ||
|
||
;; run check on file where all errors are in opaque parts | ||
(proof-check-proofs nil) | ||
|
||
;; the result buffer should exist | ||
(should (buffer-live-p (get-buffer "*proof-check-report*"))) | ||
(with-current-buffer "*proof-check-report*" | ||
;; the summary should be correct | ||
(goto-char (point-min)) | ||
(should | ||
(search-forward "3 opaque proofs recognized: 1 successful 2 FAILING" | ||
nil t)) | ||
;; results for all 3 test lemmas should be correct | ||
(mapc | ||
(lambda (s) (should (search-forward s nil t))) | ||
'("FAIL a1_equal_4" | ||
"OK b_equal_6" | ||
"FAIL b2_equal_6")))) | ||
|
||
|
||
(ert-deftest proof-check-error-on-error () | ||
"Test `proof-check-proofs' with errors in non-opaque parts. | ||
Check that `proof-check-proofs' signals an error with the expected message." | ||
(setq proof-three-window-enable nil) | ||
(reset-coq) | ||
(let (buffer) | ||
(unwind-protect | ||
(progn | ||
(find-file "proof_stat.v") | ||
(setq buffer (current-buffer)) | ||
|
||
;; insert an error in non-opaque part | ||
(goto-char (point-min)) | ||
(should (search-forward "automatic test marker 1" nil t)) | ||
(end-of-line) | ||
(insert " X ") | ||
|
||
;; proof-check-proofs should abort now with an error | ||
(condition-case err-desc | ||
(progn | ||
(proof-check-proofs nil) | ||
;; Still here? Make test fail! | ||
(should nil)) | ||
(error | ||
(should | ||
(equal (error-message-string err-desc) | ||
"Error encountered outside opaque proofs after line 10"))))) | ||
|
||
;; clean-up modified file in any case | ||
(when buffer | ||
(with-current-buffer buffer | ||
(set-buffer-modified-p nil)) | ||
(kill-buffer buffer))))) |
This file contains 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,16 @@ | ||
Proof check results for proof_stat.v | ||
|
||
3 opaque proofs recognized: 1 successful 2 FAILING | ||
|
||
FAIL a1_equal_4 | ||
OK b_equal_6 | ||
FAIL b2_equal_6 | ||
|
||
|
||
TAP version 13 | ||
1..3 | ||
not ok 1 - a1_equal_4 | ||
ok 2 - b_equal_6 | ||
not ok 3 - b2_equal_6 | ||
|
||
|
This file contains 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,24 @@ | ||
|
||
Definition a : nat := 4. | ||
|
||
Lemma a1_equal_4 : a = 2 * 2. | ||
Proof using. | ||
simpl. | ||
zzzz. (* this proof should fail *) | ||
trivial. | ||
Qed. | ||
|
||
Definition b : nat := | ||
(* automatic test marker 1 *) | ||
6. | ||
|
||
Lemma b_equal_6 : b = 2 * 3. | ||
Proof using. | ||
simpl. | ||
trivial. | ||
Qed. | ||
|
||
Lemma b2_equal_6 : b = 2 * 3. | ||
Proof using. (* this proof should fail *) | ||
Qed. | ||
|
This file contains 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 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
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.
CI is a good use case as well indeed. Did you already tried this? I mean, not from an internal PG elisp test, but from an example GHA script stored in this repo or another one, that would call emacs like this?
And maybe I'm mistaken, but to facilitate this, maybe the function
proof-check-proofs
should query from some way the filename of the file to test? (which could be the current buffer in interactive mode, for example)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.
No GHA and no other repo but I manually tested it a lot from the shell. Please see the PG manual for the command line. Adding a test invoking
proof-check-proofs
from a makefile is probably a good idea.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.
Apparently we get this error in GHA:
Yes!—and maybe calling this Makefile test from a specific GHA job would make it more visible in the GHA page?
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.
I investigated the error yesterday: 3-pane mode (on by default) is broken if the frame height is too small and certain Emacses set the frame height to 9 inside a docker container.
In the commit I added yesterday, the test you asked for runs as part of the simple tests. Do you have the opinion that this is not enough?
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.
OK!
No worries! it is enough as is.
Thanks a lot @hendriktews !