Skip to content

Commit

Permalink
fix tests on < 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gares committed Feb 7, 2025
1 parent 100d14e commit 44e8f6e
Show file tree
Hide file tree
Showing 31 changed files with 179 additions and 60 deletions.
43 changes: 26 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
dune = dune $(1) $(DUNE_$(1)_FLAGS)

all:
all: theories-stdlib/dune
$(call dune,build)
$(call dune,build) builtin-doc
.PHONY: all

build-core:
build-core: theories-stdlib/dune
$(call dune,build) theories
$(call dune,build) builtin-doc
.PHONY: build-core

build-apps:
build-apps: theories-stdlib/dune
$(call dune,build) $$(find apps -type d -name theories)
.PHONY: build-apps

build:
build: theories-stdlib/dune
$(call dune,build) -p coq-elpi @install
$(call dune,build) builtin-doc
.PHONY: build

test-core:
all-tests: test-core test-stdlib test-apps test-apps-stdlib
.PHONY: all-tests

test-core: theories-stdlib/dune
$(call dune,runtest) tests
$(call dune,build) tests
.PHONY: test-core

test-apps:
test-apps: theories-stdlib/dune
$(call dune,build) $$(find apps -type d -name tests)
.PHONY: test-apps

test-apps-stdlib:
test-apps-stdlib: theories-stdlib/dune
$(call dune,build) $$(find apps -type d -name tests-stdlib)
.PHONY: test-apps-stdlib

test:
$(call dune,runtest)
$(call dune,build) tests
$(call dune,build) $$(find apps -type d -name tests)
.PHONY: test

test-stdlib:
test-stdlib: theories-stdlib/dune
$(call dune,build) tests-stdlib
$(call dune,build) $$(find apps -type d -name tests-stdlib)
.PHONY: test-stdlib

examples:
all-examples: examples examples-stdlib
.PHONY: all-examples

examples: theories-stdlib/dune
$(call dune,build) examples
.PHONY: examples

examples-stdlib:
examples-stdlib: theories-stdlib/dune
$(call dune,build) examples-stdlib
.PHONY: examples-stdlib

theories-stdlib/dune: theories-stdlib/dune.in
@rm -f $@
@echo "; generated by make, do not edit" > $@
@if $$(coqc --version | grep -q "8.19\|8.20") ; then \
sed -e 's/@@STDLIB@@//' $< >> $@ ; \
else \
sed -e 's/@@STDLIB@@/Stdlib/' $< >> $@ ; \
fi
@chmod a-w $@

doc: build
@echo "########################## generating doc ##########################"
@mkdir -p doc
Expand Down
1 change: 0 additions & 1 deletion apps/derive/examples/usage.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
This example shows how to use derive
*)

From Coq Require Import Bool.
From elpi.apps Require Import derive.std.
Set Uniform Inductive Parameters.

Expand Down
2 changes: 1 addition & 1 deletion apps/derive/tests-stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(package coq-elpi-tests-stdlib)
(name elpi_apps_derive_tests_stdlib)
(flags :standard -w -default-output-directory)
(theories elpi elpi.apps.derive elpi.apps.derive.tests Stdlib))
(theories elpi elpi.apps.derive elpi.apps.derive.tests elpi_stdlib))

(include_subdirs qualified)
4 changes: 0 additions & 4 deletions apps/derive/tests-stdlib/test_derive.v
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,3 @@ End derive_container.
About wimpls.wimpls.
About wimpls.Kwi.
Redirect "tmp" Check Kwi _ (refl_equal 3).

From Coq Require Ascii.

#[only(param2)] derive Ascii.ascii.
2 changes: 1 addition & 1 deletion apps/eltac/tests-stdlib/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(coq.theory
(package coq-elpi-tests-stdlib)
(name elpi_apps_eltac_tests_stdlib)
(theories elpi elpi.apps.eltac Stdlib))
(theories elpi elpi.apps.eltac elpi_stdlib))

(include_subdirs qualified)
7 changes: 4 additions & 3 deletions apps/tc/tests-stdlib/bigTest.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ These two functions being defined both in [Coq.Bool] and in [Coq.Peano],
we must export [Coq.Peano] later than any export of [Coq.Bool]. *)
(* We also want to ensure that notations from [Coq.Utf8] take precedence
over the ones of [Coq.Peano] (see Coq PR#12950), so we import [Utf8] last. *)
From Coq Require Export Morphisms RelationClasses List Bool Setoid Peano Utf8.
From Coq Require Import Permutation.
From elpi.core Require Export Morphisms RelationClasses ListDef Bool Setoid.
From elpi_stdlib Require Export Peano Utf8 Permutation.
From elpi_stdlib Require Export Program.Basics Program.Syntax.

Export ListNotations.
From Coq.Program Require Export Basics Syntax.

TC.AddAllClasses.
TC.AddAllInstances.
Expand Down
2 changes: 1 addition & 1 deletion apps/tc/tests-stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(package coq-elpi-tests-stdlib)
(name elpi_apps_tc_tests_stdlib)
(flags :standard -async-proofs-cache force)
(theories elpi elpi.apps.tc elpi.apps.tc.tests Stdlib))
(theories elpi elpi.apps.tc elpi.apps.tc.tests elpi_stdlib))

(include_subdirs qualified)
8 changes: 5 additions & 3 deletions apps/tc/tests-stdlib/stdppInj.v
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(* Test inspired from https://gitlab.mpi-sws.org/iris/stdpp/-/blob/8c98553ad0ca2029b30cf18b58e321ec3a79172b/stdpp/base.v *)

From Coq Require Export Morphisms RelationClasses List Bool Setoid Peano Utf8.
From Coq Require Import Permutation.
From elpi.core Require Export Morphisms RelationClasses ListDef Bool Setoid.
From elpi_stdlib Require Export Peano Utf8 Permutation.
From elpi_stdlib Require Export Program.Basics Program.Syntax.

Export ListNotations.
From Coq.Program Require Export Basics Syntax.


From elpi.apps Require Import tc.
Elpi TC Solver Override TC.Solver All.
Expand Down
8 changes: 5 additions & 3 deletions apps/tc/tests-stdlib/stdppInjClassic.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
(* File inspired from https://gitlab.mpi-sws.org/iris/stdpp/-/blob/8c98553ad0ca2029b30cf18b58e321ec3a79172b/stdpp/base.v *)
From Coq Require Export Morphisms RelationClasses List Bool Setoid Peano Utf8.
From Coq Require Import Permutation.
From elpi.core Require Export Morphisms RelationClasses ListDef Bool Setoid.
From elpi_stdlib Require Export Peano Utf8 Permutation.
From elpi_stdlib Require Export Program.Basics Program.Syntax.

Export ListNotations.
From Coq.Program Require Export Basics Syntax.


Notation length := Datatypes.length.
Global Generalizable All Variables.
Expand Down
2 changes: 1 addition & 1 deletion apps/tc/tests-stdlib/test_import/f1.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From elpi.apps Require Export tc.
From Coq Require Export Morphisms.
From elpi.core Require Export Morphisms.

Elpi TC Solver Override TC.Solver Rm Proper ProperProxy.
7 changes: 0 additions & 7 deletions builtin-doc/coq-builtin.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -1372,13 +1372,6 @@ external pred coq.arguments.simplification i:gref,
external pred coq.arguments.set-simplification i:gref,
i:simplification_strategy.

% [coq.arguments.reset-simplification GR] resets the behavior of the
% simplification tactics.
% Also resets the ! and / modifiers for the Arguments command.
% Supported attributes:
% - @global! (default: false)
external pred coq.arguments.reset-simplification i:gref.

% [coq.locate-abbreviation Name Abbreviation] locates an abbreviation. It's
% a fatal error if Name cannot be located.
external pred coq.locate-abbreviation i:id, o:abbreviation.
Expand Down
2 changes: 1 addition & 1 deletion examples-stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(package coq-elpi-tests-stdlib)
(name elpi_examples_stdlib)
(plugins coq-elpi.elpi)
(theories elpi Stdlib))
(theories elpi elpi_stdlib))

; (include_subdirs qualified)
8 changes: 0 additions & 8 deletions examples/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@
(plugins coq-elpi.elpi)
(theories elpi))

(rule
(target tutorial_coq_elpi_tactic.v)
(deps
(glob_files tutorial_coq_elpi_tactic.v.in))
(action
(with-stdout-to %{target}
(run coq_elpi_optcomp "%{coq:version.major}.%{coq:version.minor}" %{deps}))))

; (include_subdirs qualified)
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,7 @@ Elpi Accumulate default lp:{{
}}.


#[only="8.20"] From Coq Require Import Uint63.
#[skip="8.20"] From Corelib Require Import PrimInt63.
From elpi.core Require Import PrimInt63.
Open Scope uint63_scope.

Fail Definition baz : list nat := default 1. (* .fails *)
Expand Down
2 changes: 1 addition & 1 deletion tests-stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(package coq-elpi-tests-stdlib)
(name elpi_tests_stdlib)
(plugins coq-elpi.elpi)
(theories elpi Stdlib))
(theories elpi elpi_stdlib))

; (include_subdirs qualified)
6 changes: 3 additions & 3 deletions tests-stdlib/test_API_env.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From elpi Require Import elpi.
From Coq Require Vector.
From elpi_stdlib Require Vector.

(****** env **********************************)
Elpi Command test.
Expand Down Expand Up @@ -333,7 +333,7 @@ Elpi Query lp:{{

End HOAS.

From Coq Require Ranalysis5.
From elpi_stdlib Require Ranalysis5.

Elpi Query lp:{{

Expand Down Expand Up @@ -372,7 +372,7 @@ Elpi Query lp:{{
Set Printing Universes. Print Module Test.
Check Test.f.

From Coq Require Import ZArith.
From elpi_stdlib Require Import ZArith.

Elpi Query lp:{{
coq.locate-module "N2Z" MP,
Expand Down
3 changes: 1 addition & 2 deletions tests-stdlib/test_open_terms.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Require Import Arith List FunctionalExtensionality.
From elpi_stdlib Require Import ZArith Arith List FunctionalExtensionality.
From elpi Require Import elpi.
Require Import ZArith.

Lemma ring_example x : x + 1 = 1 + x.
Proof. ring. Qed.
Expand Down
2 changes: 1 addition & 1 deletion tests-stdlib/test_quotation.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Elpi Query lp:{{
coq.say BO1.
}}.

Require Vector.
From elpi_stdlib Require Vector.

Elpi Query lp:{{
T = {{ fun v : Vector.t nat 2 =>
Expand Down
3 changes: 3 additions & 0 deletions theories-stdlib/Arith.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Arith.
#[skip="8.20"] From Stdlib Require Export Arith.

3 changes: 3 additions & 0 deletions theories-stdlib/FunctionalExtensionality.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export FunctionalExtensionality.
#[skip="8.20"] From Stdlib Require Export FunctionalExtensionality.

3 changes: 3 additions & 0 deletions theories-stdlib/List.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export List.
#[skip="8.20"] From Stdlib Require Export List.

3 changes: 3 additions & 0 deletions theories-stdlib/Peano.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Peano.
#[skip="8.20"] From Stdlib Require Export Peano.

3 changes: 3 additions & 0 deletions theories-stdlib/Permutation.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Permutation.
#[skip="8.20"] From Stdlib Require Export Permutation.

3 changes: 3 additions & 0 deletions theories-stdlib/Program/Basics.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq.Program Require Export Basics.
#[skip="8.20"] From Stdlib.Program Require Export Basics.

3 changes: 3 additions & 0 deletions theories-stdlib/Program/Syntax.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq.Program Require Export Syntax.
#[skip="8.20"] From Stdlib.Program Require Export Syntax.

15 changes: 15 additions & 0 deletions theories-stdlib/Program/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(rule
(target Basics.v)
(deps
(glob_files Basics.v.in))
(action
(with-stdout-to %{target}
(run coq_elpi_optcomp "%{coq:version.major}.%{coq:version.minor}" %{deps}))))

(rule
(target Syntax.v)
(deps
(glob_files Syntax.v.in))
(action
(with-stdout-to %{target}
(run coq_elpi_optcomp "%{coq:version.major}.%{coq:version.minor}" %{deps}))))
3 changes: 3 additions & 0 deletions theories-stdlib/Ranalysis5.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Ranalysis5.
#[skip="8.20"] From Stdlib Require Export Ranalysis5.

3 changes: 3 additions & 0 deletions theories-stdlib/Utf8.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Utf8.
#[skip="8.20"] From Stdlib Require Export Utf8.

3 changes: 3 additions & 0 deletions theories-stdlib/Vector.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export Vector.
#[skip="8.20"] From Stdlib Require Export Vector.

3 changes: 3 additions & 0 deletions theories-stdlib/ZArith.v.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[only="8.20"] From Coq Require Export ZArith.
#[skip="8.20"] From Stdlib Require Export ZArith.

Loading

0 comments on commit 44e8f6e

Please sign in to comment.