This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,3 @@
From basic Require Import foo.
Definition false : t := t.

View file

@ -0,0 +1,9 @@
(coq.theory
(name basic)
(package base)
(modules :standard)
(synopsis "Test Coq library"))
(rule
(alias default)
(action (echo "%{read:base.install}")))

View file

@ -0,0 +1,3 @@
(lang dune 2.7)
(using coq 0.1)

View file

@ -0,0 +1,2 @@
(lang dune 2.7)
(env (unsound (coq (flags -type-in-type))))

View file

@ -0,0 +1 @@
Definition t := Type.

View file

@ -0,0 +1,8 @@
$ dune build --display short --profile unsound --debug-dependency-path @all
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
coqdep .basic.theory.d
coqc foo.{glob,vo}
coqc bar.{glob,vo}

View file

@ -0,0 +1,3 @@
From basic Require Import foo.
Definition mynum (i : mynat) := 3.

View file

@ -0,0 +1,9 @@
(coq.theory
(name basic)
(package base)
(modules :standard)
(synopsis "Test Coq library"))
(alias
(name default)
(action (echo "%{read:base.install}")))

View file

@ -0,0 +1,3 @@
(lang dune 1.9)
(using coq 0.1)

View file

@ -0,0 +1 @@
Definition mynat := nat.

View file

@ -0,0 +1,27 @@
$ dune build --display short --debug-dependency-path @all --always-show-command-line
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
coqdep .basic.theory.d
coqc foo.{glob,vo}
coqc bar.{glob,vo}
$ dune build --debug-dependency-path @default
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
lib: [
"_build/install/default/lib/base/META"
"_build/install/default/lib/base/dune-package"
"_build/install/default/lib/base/opam"
]
lib_root: [
"_build/install/default/lib/coq/user-contrib/basic/bar.glob" {"coq/user-contrib/basic/bar.glob"}
"_build/install/default/lib/coq/user-contrib/basic/bar.v" {"coq/user-contrib/basic/bar.v"}
"_build/install/default/lib/coq/user-contrib/basic/bar.vo" {"coq/user-contrib/basic/bar.vo"}
"_build/install/default/lib/coq/user-contrib/basic/foo.glob" {"coq/user-contrib/basic/foo.glob"}
"_build/install/default/lib/coq/user-contrib/basic/foo.v" {"coq/user-contrib/basic/foo.v"}
"_build/install/default/lib/coq/user-contrib/basic/foo.vo" {"coq/user-contrib/basic/foo.vo"}
]

View file

@ -0,0 +1 @@
Inductive AnotherBeginning := Of | The | Universe.

View file

@ -0,0 +1,5 @@
(coq.theory
(name A)
(package A)
(theories B)
(boot))

View file

@ -0,0 +1,3 @@
(lang dune 2.5)
(using coq 0.2)

View file

@ -0,0 +1 @@
Inductive Beginning := Of | The | Universe.

View file

@ -0,0 +1,5 @@
(coq.theory
(name B)
(package B))

View file

@ -0,0 +1,3 @@
(lang dune 2.5)
(using coq 0.2)

View file

@ -0,0 +1,12 @@
Testing composition with two boot libraries
$ dune build
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
File "A/dune", line 4, characters 11-12:
4 | (theories B)
^
Error: (boot) libraries cannot have dependencies
[1]

View file

@ -0,0 +1 @@
Inductive AnotherBeginning := Of | The | Universe.

View file

@ -0,0 +1,4 @@
(coq.theory
(name A)
(package A)
(boot))

View file

@ -0,0 +1,3 @@
(lang dune 2.5)
(using coq 0.2)

View file

@ -0,0 +1 @@
Inductive Beginning := Of | The | Universe.

View file

@ -0,0 +1,4 @@
(coq.theory
(name B)
(package B)
(boot))

View file

@ -0,0 +1,3 @@
(lang dune 2.5)
(using coq 0.2)

View file

@ -0,0 +1,12 @@
Testing composition with two boot libraries
$ dune build
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
Error: Cannot have more than one boot theory in scope:
- A at A/dune:1
- B at B/dune:1
-> required by alias default
[1]

View file

@ -0,0 +1,5 @@
Fail Print Prelude.
From Coq Require Import Prelude.
Print Prelude.
Require Import mytheory.
Check Hello.

View file

@ -0,0 +1,4 @@
(coq.theory
(name A)
(stdlib no)
(theories Coq))

View file

@ -0,0 +1,2 @@
(lang dune 3.5)
(using coq 0.6)

View file

@ -0,0 +1,3 @@
Print Prelude.
Require Import mytheory.
Check Hello.

View file

@ -0,0 +1,4 @@
(coq.theory
(name B)
(stdlib yes)
(theories Coq))

View file

@ -0,0 +1,2 @@
(lang dune 3.5)
(using coq 0.6)

View file

@ -0,0 +1,2 @@
Unset Elimination Schemes.
Inductive BootType := boot | type.

View file

@ -0,0 +1,6 @@
(coq.theory
(name Coq)
(package Coq)
(boot))
(include_subdirs qualified)

View file

@ -0,0 +1,2 @@
(lang dune 3.3)
(using coq 0.4)

View file

@ -0,0 +1,2 @@
Inductive Hello := World | Bye.

View file

@ -0,0 +1,30 @@
Testing composition of theories across a Dune workspace with a boot library and
importing ``stdlib`` enabled or disabled.
Composing library A depending on Coq but having `(stdlib no)`:
$ dune build A
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
Module
Prelude
:= Struct Inductive BootType : Set := boot : BootType | type : BootType. End
Hello
: Set
Composing library B depending on Coq but having `(stdlib yes)`:
$ dune build B
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
Module
Prelude
:= Struct Inductive BootType : Set := boot : BootType | type : BootType. End
Hello
: Set

View file

@ -0,0 +1,3 @@
(lang dune 3.4)
(using coq 0.5)

View file

@ -0,0 +1,4 @@
(library
(name boot_plugin)
(public_name coq-boot.boot_plugin))

View file

@ -0,0 +1 @@
let () = Format.eprintf "plugin loaded@\n%!"

View file

@ -0,0 +1,2 @@
Declare ML Module "boot_plugin:coq-boot.boot_plugin".
Inductive AnotherBeginning := Of | The | Universe.

View file

@ -0,0 +1,7 @@
(coq.theory
(name Coq)
(boot)
(package coq-boot)
(plugins coq-boot.boot_plugin))
(include_subdirs qualified)

View file

@ -0,0 +1,5 @@
(coq.theory
(name User)
(package coq-user))

View file

@ -0,0 +1,3 @@
(lang dune 3.4)
(using coq 0.5)

View file

@ -0,0 +1 @@
Definition from_boot : AnotherBeginning := Universe.

View file

@ -0,0 +1,9 @@
Testing composition with a boot library with plugins
$ dune build
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
plugin loaded
plugin loaded

View file

@ -0,0 +1 @@
Definition foo := 3.

View file

@ -0,0 +1,3 @@
(coq.theory
(name A)
(theories B))

View file

@ -0,0 +1,3 @@
From a Require Import a.
Definition bar := a.foo.

View file

@ -0,0 +1,3 @@
(coq.theory
(name B)
(theories A))

View file

@ -0,0 +1,2 @@
(lang dune 3.2)
(using coq 0.3)

View file

@ -0,0 +1,14 @@
We check cycles are detected
$ dune build
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
Error: Dependency cycle between:
theory A in A/dune:2
-> theory B in B/dune:2
-> theory A in A/dune:2
-> required by _build/default/A/.A.theory.d
-> required by alias A/all
-> required by alias default
[1]

View file

@ -0,0 +1,2 @@
From B Require Import b.
Print hello.

View file

@ -0,0 +1,3 @@
(coq.theory
(name A)
(theories Coq B))

View file

@ -0,0 +1,2 @@
(lang dune 3.8)
(using coq 0.8)

View file

@ -0,0 +1 @@
Inductive hello := I | am | an | install | loc.

View file

@ -0,0 +1,4 @@
(coq.theory
(name B)
(package B)
(theories Coq))

View file

@ -0,0 +1,3 @@
(lang dune 3.8)
(using coq 0.7)
(package (name "B"))

View file

@ -0,0 +1,73 @@
We make sure that Coq lang versions < 0.8 can still somewhat compose with
installed theories. The way this was done before was due to `-boot` not being
passed to Coq. This meant that we essentially have `-Q "" user-contrib` being
passed. In order to restore this behaviour for Coq lang < 0.8 we explicitly add
that flag. This PR makes sure that this is indeed the case.
We configure COQLIB to be lib/coq. Coq will search for user-contrib from here.
We also need to set up a fake Coq install.
$ mkdir -p lib/coq
$ export COQLIB=$PWD/lib/coq
$ echo $COQLIB
$TESTCASE_ROOT/lib/coq
$ mkdir -p lib/coq/theories/Init/
$ cat > lib/coq/theories/Init/Prelude.v << EOF
> Inductive PreludeLoaded := Yes.
> EOF
We need to manually compile the prelude.
$ coqc -boot -noinit -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler no -R lib/coq/theories/ Coq lib/coq/theories/Init/Prelude.v
We also setup some plugins
$ mkdir -p lib/coq-core/plugins
We setup an installed theory. Note that lib/coq/user-contrib doesn't exist yet,
so this also tests that it won't be a problem.
$ dune build --root B @install
Entering directory 'B'
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
3.8 and will be removed in an upcoming Dune version.
Hint: To disable this warning, add the following to your dune-project file:
(warnings (deprecated_coq_lang_lt_08 disabled))
Leaving directory 'B'
$ dune install --root B --prefix=$PWD --display=short
Installing $TESTCASE_ROOT/lib/B/META
Installing $TESTCASE_ROOT/lib/B/dune-package
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Next we go into our Dune project and build it.
$ dune build --root A
Entering directory 'A'
Inductive hello : Set :=
I : hello | am : hello | an : hello | install : hello | loc : hello.
Leaving directory 'A'
Now we check the flags that were passed to coqdep and coqc:
$ tail -4 A/_build/log | head -2 | ../scrub_coq_args.sh
coqdep
-boot
-R coq/theories Coq
-Q $TESTCASE_ROOT/lib/coq/user-contrib/B B
-R . A -dyndep opt -vos a.v >
_build/default/.A.theory.d
coqc -q
-w -deprecated-native-compiler-option -native-output-dir .
-native-compiler on
-nI lib/coq-core/kernel
-nI .
-boot
-R coq/theories Coq
-Q $TESTCASE_ROOT/lib/coq/user-contrib/B B
-R . A
a.v

View file

@ -0,0 +1,15 @@
Test for https://github.com/ocaml/dune/issues/7893
When using an installed theory with plugins, things should work fine.
$ dune build --root to_install @all
Entering directory 'to_install'
Hello
Leaving directory 'to_install'
$ dune install --root to_install --prefix=$PWD
We now build the normal theory, and should work
$ COQPATH=$PWD/lib/coq/user-contrib dune build --root user @all
Entering directory 'user'
Hello
Leaving directory 'user'

View file

@ -0,0 +1,4 @@
(lang dune 3.8)
(using coq 0.8)
(package (name global))

View file

@ -0,0 +1,3 @@
(library
(name plugin)
(public_name global.plugin))

View file

@ -0,0 +1 @@
let () = Format.eprintf "Hello@\n%!"

View file

@ -0,0 +1 @@
Declare ML Module "plugin:global.plugin".

View file

@ -0,0 +1,4 @@
(coq.theory
(name Bar)
(package global)
(plugins global.plugin))

View file

@ -0,0 +1 @@
From Bar Require Import bar.

View file

@ -0,0 +1,4 @@
(coq.theory
(name Foo)
(package local)
(theories Bar))

View file

@ -0,0 +1,4 @@
(lang dune 3.8)
(using coq 0.8)
(package (name local))

View file

@ -0,0 +1,3 @@
(coq.theory
(name A.B)
(package Theory1))

View file

@ -0,0 +1,3 @@
(lang dune 3.8)
(using coq 0.8)
(package (name Theory1))

View file

@ -0,0 +1,3 @@
(coq.theory
(name A.C)
(package Theory2))

View file

@ -0,0 +1,3 @@
(lang dune 3.8)
(using coq 0.8)
(package (name Theory2))

View file

@ -0,0 +1,36 @@
If we have installed theories A.B and A.C then Dune should not complain that A
is a duplicate theory.
First we install our two theories with the conflicting name prefix.
$ (cd B && dune build @install && dune install --prefix .)
$ (cd C && dune build @install && dune install --prefix .)
We add these to COQPATH
$ export COQPATH=../B/lib/coq/user-contrib:../C/lib/coq/user-contrib:$COQPATH
Now we create a theory that depends on both
$ mkdir mytheory && cd mytheory
$ cat > dune-project << EOF
> (lang dune 3.8)
> (using coq 0.8)
> EOF
$ cat > dune << EOF
> (coq.theory
> (name mytheory)
> (theories A.B A.C))
> EOF
$ cat > a.v << EOF
> From A.B Require Import a.
> From A.C Require Import a.
> Print b.
> EOF
$ dune build a.vo
Inductive b : Prop := .

View file

@ -0,0 +1,2 @@
From B Require Import b.
Print hello.

View file

@ -0,0 +1,3 @@
(coq.theory
(name A)
(theories Coq B))

View file

@ -0,0 +1,2 @@
(lang dune 3.8)
(using coq 0.8)

View file

@ -0,0 +1,4 @@
(coq.theory
(name B)
(package B)
(theories Coq))

View file

@ -0,0 +1,3 @@
(lang dune 3.8)
(using coq 0.8)
(package (name "B"))

View file

@ -0,0 +1,121 @@
We test that installed Coq theories, when updated, prompt Dune to rebuild
$ mkdir -p lib/coq
$ export COQLIB=$PWD/lib/coq
$ echo $COQLIB
$TESTCASE_ROOT/lib/coq
$ mkdir -p lib/coq/theories/Init/
$ cat > lib/coq/theories/Init/Prelude.v << EOF
> Inductive PreludeLoaded := Yes.
> EOF
We need to manually compile the prelude.
$ coqc -boot -noinit -w -deprecated-native-compiler-option -w -native-compiler-disabled -native-compiler no -R lib/coq/theories/ Coq lib/coq/theories/Init/Prelude.v
We also setup some plugins
$ mkdir -p lib/coq-core/plugins
We setup an installed theory. Note that lib/coq/user-contrib doesn't exist yet,
so this also tests that it won't be a problem.
$ cat > B/b.v << EOF
> Inductive hello := I | am | an | install | loc.
> EOF
$ dune build --root B @install
Entering directory 'B'
Leaving directory 'B'
$ dune install --root B --prefix=$PWD --display=short
Installing $TESTCASE_ROOT/lib/B/META
Installing $TESTCASE_ROOT/lib/B/dune-package
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Next we go into our Dune project and build it.
$ dune build --root A
Entering directory 'A'
Inductive hello : Set :=
I : hello | am : hello | an : hello | install : hello | loc : hello.
Leaving directory 'A'
Next we update B and install it again.
$ cat > B/b.v << EOF
> Inductive hello := I | am | an | install | loc | but | updated.
> EOF
$ dune build --root B @install
Entering directory 'B'
Leaving directory 'B'
$ dune install --root B --prefix=$PWD --display=short
Deleting $TESTCASE_ROOT/lib/B/META
Installing $TESTCASE_ROOT/lib/B/META
Deleting $TESTCASE_ROOT/lib/B/dune-package
Installing $TESTCASE_ROOT/lib/B/dune-package
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Now we should see that A is rebuilt
$ dune build --root A
Entering directory 'A'
Inductive hello : Set :=
I : hello
| am : hello
| an : hello
| install : hello
| loc : hello
| but : hello
| updated : hello.
Leaving directory 'A'
Next we add a new file to B that should cause a call to coqdep, but no rebuild.
$ cat > B/c.v << EOF
> Inductive bye := I | am | a | new | install | loc.
> EOF
$ dune build --root B @install
Entering directory 'B'
Leaving directory 'B'
$ dune install --root B --prefix=$PWD --display=short
Deleting $TESTCASE_ROOT/lib/B/META
Installing $TESTCASE_ROOT/lib/B/META
Deleting $TESTCASE_ROOT/lib/B/dune-package
Installing $TESTCASE_ROOT/lib/B/dune-package
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmi
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_b.cmxs
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_c.cmi
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/.coq-native/NB_c.cmxs
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.glob
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.v
Deleting $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/b.vo
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/c.glob
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/c.v
Installing $TESTCASE_ROOT/lib/coq/user-contrib/B/c.vo
Now we should see that A is not rebuilt, however coqdep is called, this seems to fail
$ dune build --root A --display=short
Entering directory 'A'
Leaving directory 'A'

View file

@ -0,0 +1,2 @@
(lang dune 3.8)
(using coq 0.8)

View file

@ -0,0 +1,11 @@
Testing the composition of the installed stdlib
$ cat > dune << EOF
> (coq.theory
> (name test)
> (theories Coq))
> EOF
$ dune build test.vo --display=short --always-show-command-line
coqdep .test.theory.d
coqc Ntest_test.{cmi,cmxs},test.{glob,vo}

View file

@ -0,0 +1 @@
From Coq Require Import List.

View file

@ -0,0 +1 @@
Inductive hello_alg := I | am | an | install | loc | at_alg.

View file

@ -0,0 +1,3 @@
(coq.theory
(name global.algebra)
(package global))

Some files were not shown because too many files have changed in this diff Show more