forked from ProofGeneral/PG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI compile tests: add coqdep error detection tests
Add 3 tests to check that coqdep errors are reliably detected, see also issue ProofGeneral#722. Two of them are expected to fail for 8.19, because coqdep output changed in that version.
- Loading branch information
1 parent
250c2f8
commit ba755fd
Showing
11 changed files
with
258 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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 | ||
|
||
|
||
.PHONY: test | ||
test: | ||
$(MAKE) clean | ||
emacs -batch -l ../../../generic/proof-site.el -l ../cct-lib.el \ | ||
-l runtest.el -f ert-run-tests-batch-and-exit | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f *.vo *.glob *.vio *.vos *.vok .*.aux |
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,21 @@ | ||
(* 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 | ||
* | ||
* | ||
* This file is part of an automatic test case for parallel background | ||
* compilation in coq-par-compile.el. See runtest.el in this directory. | ||
*) | ||
|
||
(* The test script relies on absolute line numbers. | ||
* DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
*) | ||
|
||
(* This is line 19 *) | ||
Require X25XX. | ||
(* This is line 21 *) |
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,21 @@ | ||
(* 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 | ||
* | ||
* | ||
* This file is part of an automatic test case for parallel background | ||
* compilation in coq-par-compile.el. See runtest.el in this directory. | ||
*) | ||
|
||
(* The test script relies on absolute line numbers. | ||
* DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
*) | ||
|
||
(* This is line 19 *) | ||
Require c. | ||
(* This is line 21 *) |
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 @@ | ||
(* 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 | ||
* | ||
* | ||
* This file is part of an automatic test case for parallel background | ||
* compilation in coq-par-compile.el. See runtest.el in this directory. | ||
*) | ||
|
||
(* The next line intentionally contains a syntax error. *) | ||
Definition c : nat := |
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,21 @@ | ||
(* 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 | ||
* | ||
* | ||
* This file is part of an automatic test case for parallel background | ||
* compilation in coq-par-compile.el. See runtest.el in this directory. | ||
*) | ||
|
||
(* The test script relies on absolute line numbers. | ||
* DO NOT INSERT ANY LINE UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
*) | ||
|
||
(* This is line 19 *) | ||
Require e. | ||
(* This is line 21 *) |
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,15 @@ | ||
(* 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 | ||
* | ||
* | ||
* This file is part of an automatic test case for parallel background | ||
* compilation in coq-par-compile.el. See runtest.el in this directory. | ||
*) | ||
|
||
Require X25XX. |
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,126 @@ | ||
;; This file is part of Proof General. -*- lexical-binding: t; -*- | ||
;; | ||
;; © Copyright 2024 Hendrik Tews | ||
;; | ||
;; Authors: Hendrik Tews | ||
;; Maintainer: Hendrik Tews <hendrik@askra.de> | ||
;; | ||
;; SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
;;; Commentary: | ||
;; | ||
;; Coq Compile Tests (cct) -- | ||
;; ert tests for parallel background compilation for Coq | ||
;; | ||
;; Test that parallel background compilation reliably detects coqdep | ||
;; errors. There are three tests that check the following coqdep errors: | ||
;; - coqdep on a require fails because of a missing library (using a.v) | ||
;; - coqdep on a dependency fails because of a syntax error (using b.v) | ||
;; - coqdep on a dependency fails because of a missing library (using d.v) | ||
;; | ||
;; The following graph shows the file dependencies in these test: | ||
;; | ||
;; a b d | ||
;; | | | ||
;; c e | ||
|
||
|
||
;; require cct-lib for the elisp compilation, otherwise this is present already | ||
(require 'cct-lib "ci/compile-tests/cct-lib") | ||
|
||
;;; set configuration | ||
(cct-configure-proof-general) | ||
|
||
;;; Define the tests | ||
|
||
(ert-deftest cct-coqdep-fail-on-require () | ||
:expected-result (if (coq--post-v818) :failed :passed) | ||
"coqdep error on missing library in a require command is detected." | ||
;; (setq cct--debug-tests t) | ||
;; (setq coq--debug-auto-compilation t) | ||
(let (coqdep-errror-in-response | ||
missing-module-in-response | ||
missing-module-in-coq) | ||
(find-file "a.v") | ||
(message "coqdep error detection test: non-existing module in require") | ||
(cct-process-to-line 21) | ||
(cct-check-locked 20 'unlocked) | ||
(with-current-buffer coq--compile-response-buffer | ||
;; (message "|%s|" (buffer-string)) | ||
(goto-char (1+ (length coq--compile-response-initial-content))) | ||
(setq coqdep-errror-in-response (looking-at "^coqdep ")) | ||
(setq missing-module-in-response (search-forward "X25XX" nil t))) | ||
(with-current-buffer proof-shell-buffer | ||
(goto-char (point-min)) | ||
(setq missing-module-in-coq (search-forward "X25XX" nil t))) | ||
(message | ||
(concat "CHECK RESULT: *coq-compile-response* %s report a coqdep problem\n" | ||
"\tand the missing module X25XX %s in *coq-compile-response*\n" | ||
"\tand it %s in *coq*") | ||
(if coqdep-errror-in-response "DOES" "DOES NOT") | ||
(if missing-module-in-response "IS" "IS NOT") | ||
(if missing-module-in-coq "IS" "IS NOT")) | ||
(should (and coqdep-errror-in-response | ||
missing-module-in-response | ||
(not missing-module-in-coq))))) | ||
|
||
|
||
(ert-deftest cct-coqdep-syntax-error-dependency () | ||
"coqdep syntax error on a dependency is detected." | ||
;; (setq cct--debug-tests t) | ||
;; (setq coq--debug-auto-compilation t) | ||
(let (coqdep-errror-in-response | ||
syntax-error-in-response | ||
dependency-in-coq) | ||
(find-file "b.v") | ||
(message "coqdep error detection test: non-existing module in dependency") | ||
(cct-process-to-line 21) | ||
(cct-check-locked 20 'unlocked) | ||
(with-current-buffer coq--compile-response-buffer | ||
;; (message "|%s|" (buffer-string)) | ||
(goto-char (1+ (length coq--compile-response-initial-content))) | ||
(setq coqdep-errror-in-response (looking-at "^coqdep ")) | ||
(setq syntax-error-in-response (search-forward "Syntax error" nil t))) | ||
(with-current-buffer proof-shell-buffer | ||
(goto-char (point-min)) | ||
(setq dependency-in-coq (search-forward "Require c." nil t))) | ||
(message | ||
(concat "CHECK RESULT: *coq-compile-response* %s report a coqdep problem\n" | ||
"\tand *coq-compile-response* %s contain a syntax error\n" | ||
"\tand 'Require c' %s in *coq*") | ||
(if coqdep-errror-in-response "DOES" "DOES NOT") | ||
(if syntax-error-in-response "DOES" "DOES NOT") | ||
(if dependency-in-coq "IS" "IS NOT")) | ||
(should (and coqdep-errror-in-response | ||
syntax-error-in-response | ||
(not dependency-in-coq))))) | ||
|
||
|
||
(ert-deftest cct-coqdep-fail-on-require-in-dependency () | ||
:expected-result (if (coq--post-v818) :failed :passed) | ||
"coqdep error because of a missing library in a dependency is detected." | ||
(let (coqdep-errror-in-response | ||
missing-module-in-response | ||
dependency-in-coq) | ||
(find-file "d.v") | ||
(message "coqdep error detection test: non-existing module in dependency") | ||
(cct-process-to-line 21) | ||
(cct-check-locked 20 'unlocked) | ||
(with-current-buffer coq--compile-response-buffer | ||
;; (message "|%s|" (buffer-string)) | ||
(goto-char (1+ (length coq--compile-response-initial-content))) | ||
(setq coqdep-errror-in-response (looking-at "^coqdep ")) | ||
(setq missing-module-in-response (search-forward "X25XX" nil t))) | ||
(with-current-buffer proof-shell-buffer | ||
(goto-char (point-min)) | ||
(setq dependency-in-coq (search-forward "Require d." nil t))) | ||
(message | ||
(concat "CHECK RESULT: *coq-compile-response* %s report a coqdep problem\n" | ||
"\tand missing module X25XX %s in *coq-compile-response*\n" | ||
"\tand require %s in *coq*") | ||
(if coqdep-errror-in-response "DOES" "DOES NOT") | ||
(if missing-module-in-response "IS" "IS NOT") | ||
(if dependency-in-coq "IS" "IS NOT")) | ||
(should (and coqdep-errror-in-response | ||
missing-module-in-response | ||
(not dependency-in-coq))))) |
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