Skip to content

Commit

Permalink
Opam make tests (#730)
Browse files Browse the repository at this point in the history
*  Make test-suite and examples also installable from the opam package

* Test the "with-test" targets of the opam file

* Plugin-demo building

* Missing MetaCoq prefix in test-suite/plugin

* The opam files actually require bash
  • Loading branch information
mattam82 authored Jul 4, 2022
1 parent 22d17db commit fd85ea3
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 31 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,10 @@ erasure/src/eGlobalEnv.ml
Makefile.conf
test-suite/plugin-demo/src/META.coq-metacoq-demo-plugin
pcuic/src/META.coq-metacoq-pcuic
examples/_CoqProject
test-suite/_CoqProject
examples/metacoq-config
test-suite/metacoq-config
test-suite/plugin-demo/_CoqProject
test-suite/plugin-demo/_PluginProject
test-suite/plugin-demo/metacoq-config
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ci-quick:

ci-opam:
# Use -v so that regular output is produced
opam install -v -y .
opam install --with-test -v -y .
opam remove -y coq-metacoq coq-metacoq-template

checktodos:
Expand Down
13 changes: 13 additions & 0 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,38 @@ then
SAFECHECKER_DEPS="-R ../pcuic/theories MetaCoq.PCUIC"
ERASURE_DEPS="-R ../safechecker/theories MetaCoq.SafeChecker"
TRANSLATIONS_DEPS=""
EXAMPLES_DEPS="-R ../erasure/theories MetaCoq.Erasure"
TEST_SUITE_DEPS="-R ../erasure/theories MetaCoq.Erasure"
PLUGIN_DEMO_DEPS="-R ../../template-coq/theories MetaCoq.Template -I ../../template-coq/"
echo "METACOQ_CONFIG = local" > Makefile.conf
else
echo "Building MetaCoq globally (default)"
PCUIC_DEPS=""
SAFECHECKER_DEPS=""
ERASURE_DEPS=""
TRANSLATIONS_DEPS=""
EXAMPLES_DEPS=""
TEST_SUITE_DEPS=""
PLUGIN_DEMO_DEPS=""
echo "METACOQ_CONFIG = global" > Makefile.conf
fi

echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > pcuic/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > safechecker/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > erasure/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > translations/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > examples/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > test-suite/metacoq-config
echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > test-suite/plugin-demo/metacoq-config

echo ${PCUIC_DEPS} >> pcuic/metacoq-config
echo ${PCUIC_DEPS} ${SAFECHECKER_DEPS} >> safechecker/metacoq-config
echo ${PCUIC_DEPS} ${SAFECHECKER_DEPS} ${ERASURE_DEPS} >> erasure/metacoq-config
echo ${PCUIC_DEPS} ${TRANSLATIONS_DEPS} >> translations/metacoq-config
echo ${PCUIC_DEPS} ${SAFECHECKER_DEPS} ${ERASURE_DEPS} ${TRANSLATIONS_DEPS} ${EXAMPLES_DEPS} >> examples/metacoq-config
echo ${PCUIC_DEPS} ${SAFECHECKER_DEPS} ${ERASURE_DEPS} ${TRANSLATIONS_DEPS} ${TEST_SUITE_DEPS} >> test-suite/metacoq-config
echo ${PLUGIN_DEMO_DEPS} >> test-suite/plugin-demo/metacoq-config

else
echo "Error: coqc not found in path"
fi
2 changes: 1 addition & 1 deletion coq-metacoq-erasure.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors: ["Abhishek Anand <[email protected]>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
["bash" "./configure.sh"]
[make "-j" "%{jobs}%" "-C" "erasure"]
]
install: [
Expand Down
2 changes: 1 addition & 1 deletion coq-metacoq-pcuic.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors: ["Abhishek Anand <[email protected]>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
["bash" "./configure.sh"]
[make "-j" "%{jobs}%" "-C" "pcuic"]
]
install: [
Expand Down
2 changes: 1 addition & 1 deletion coq-metacoq-safechecker.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors: ["Abhishek Anand <[email protected]>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
["bash" "./configure.sh"]
[make "-j" "%{jobs}%" "-C" "safechecker"]
]
install: [
Expand Down
2 changes: 1 addition & 1 deletion coq-metacoq-translations.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors: ["Abhishek Anand <[email protected]>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
["bash" "./configure.sh"]
[make "-j" "%{jobs}%" "-C" "translations"]
]
install: [
Expand Down
2 changes: 1 addition & 1 deletion coq-metacoq.opam
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ depends: [
"coq-metacoq-translations" {= version}
]
build: [
["sh" "./configure.sh" ] {with-test}
["bash" "./configure.sh" ] {with-test}
[make "-C" "examples" ] {with-test}
[make "-C" "test-suite" ] {with-test}
]
Expand Down
6 changes: 5 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ all: examples
examples: Makefile.coq
$(MAKE) -f Makefile.coq TIMED=$(TIMED)

Makefile.coq: Makefile
Makefile.coq: Makefile _CoqProject
coq_makefile -f _CoqProject -o Makefile.coq

_CoqProject: _CoqProject.in metacoq-config
cat metacoq-config > _CoqProject
cat _CoqProject.in >> _CoqProject

clean: Makefile.coq
$(MAKE) -f Makefile.coq clean

Expand Down
13 changes: 0 additions & 13 deletions examples/_CoqProject

This file was deleted.

9 changes: 9 additions & 0 deletions examples/_CoqProject.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-R . MetaCoq.Examples

demo.v
constructor_tac.v
add_constructor.v
tauto.v
typing_correctness.v
metacoq_tour_prelude.v
metacoq_tour.v
6 changes: 5 additions & 1 deletion test-suite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ all: bugs plugin-demo
bugs: Makefile.coq
$(MAKE) -f Makefile.coq TIMED=$(TIMED)

Makefile.coq: Makefile
Makefile.coq: Makefile _CoqProject
coq_makefile -f _CoqProject -o Makefile.coq

_CoqProject: _CoqProject.in metacoq-config
cat metacoq-config > _CoqProject
cat _CoqProject.in >> _CoqProject

clean: Makefile.coq
$(MAKE) -f Makefile.coq clean

Expand Down
4 changes: 0 additions & 4 deletions test-suite/_CoqProject → test-suite/_CoqProject.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
-Q ../template-coq/theories MetaCoq.Template
-Q ../pcuic/theories MetaCoq.PCUIC
-Q ../safechecker/theories MetaCoq.SafeChecker
-Q ../erasure/theories MetaCoq.Erasure
-R . MetaCoq.TestSuite

# list obtained with `ls -1 *.v`
Expand Down
8 changes: 8 additions & 0 deletions test-suite/plugin-demo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Makefile.coq: _CoqProject
Makefile.plugin: _PluginProject
coq_makefile -f _PluginProject -o Makefile.plugin

_CoqProject: _CoqProject.in metacoq-config
cat metacoq-config > _CoqProject
cat _CoqProject.in >> _CoqProject

_PluginProject: _PluginProject.in metacoq-config
cat metacoq-config > _PluginProject
cat _PluginProject.in >> _PluginProject

plugin: Makefile.plugin coq
$(MAKE) -f Makefile.plugin

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
META.coq-metacoq-demo-plugin
-R ../../template-coq/theories MetaCoq.Template
-I ../../template-coq/build
-I ../../template-coq/
-R theories MetaCoq.ExtractedPluginDemo

theories/Lens.v
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
-generate-meta-for-package coq-metacoq-demo-plugin
-R ../../template-coq/theories MetaCoq.Template
-I ../../template-coq/

-I src
-I gen-src
Expand Down
2 changes: 1 addition & 1 deletion test-suite/plugin-demo/theories/Extraction.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Require Import Template.Extraction.
From MetaCoq Require Import Template.Extraction.
Require Import Lens MyPlugin.

Set Warnings "-extraction-opaque-accessed".
Expand Down

0 comments on commit fd85ea3

Please sign in to comment.