Skip to content

Commit

Permalink
Correctly run tests with opam
Browse files Browse the repository at this point in the history
I have no clue how to get it to work with dune so I call make
directly.

We make test suite get BIN from configure.
(COQLIB was already found that way)
We also use this in CI test-suite-template instead of passing them
through the command line.

Close coq#17923

Might be worth adding `--with-test` in the CI `pkg:opam` script?
  • Loading branch information
SkySkimmer committed Nov 9, 2023
1 parent 3a2d005 commit 6575966
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@ before_script:
script:
- cd test-suite
- make clean
# careful with the ending /
- BIN=$(readlink -f ../_install_ci/bin)/
- LIB=$(readlink -f ../_install_ci/lib/coq)/
- export OCAMLPATH=$(readlink -f ../_install_ci/lib/):"$OCAMLPATH"
- COQEXTRAFLAGS="${COQEXTRAFLAGS}" make -j "$NJOBS" BIN="$BIN" COQLIB="$LIB" all
- COQEXTRAFLAGS="${COQEXTRAFLAGS}" make -j "$NJOBS" all
artifacts:
name: "$CI_JOB_NAME.logs"
when: on_failure
Expand Down
10 changes: 8 additions & 2 deletions coq.opam
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ depends: [
"coqide-server" {= version}
"odoc" {with-doc}
]
dev-repo: "git+https://github.com/coq/coq.git"
build: [
["dune" "subst"] {dev}
[ "./configure"
"-prefix" prefix
"-mandir" man
"-libdir" "%{lib}%/coq"
"-native-compiler" "yes" {coq-native:installed} "no" {!coq-native:installed}
] {with-test}
[
"dune"
"build"
Expand All @@ -37,9 +44,8 @@ build: [
jobs
"--promote-install-files=false"
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
[ make "-C" "test-suite" "-j" jobs "COQ_INSTALLED=1" "PRINT_LOGS=1" ] {with-test}
["dune" "install" "-p" name "--create-install-files" name]
]
dev-repo: "git+https://github.com/coq/coq.git"
22 changes: 22 additions & 0 deletions coq.opam.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
build: [
["dune" "subst"] {dev}
[ "./configure"
"-prefix" prefix
"-mandir" man
"-libdir" "%{lib}%/coq"
"-native-compiler" "yes" {coq-native:installed} "no" {!coq-native:installed}
] {with-test}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"--promote-install-files=false"
"@install"
"@doc" {with-doc}
]
[ make "-C" "test-suite" "-j" jobs "COQ_INSTALLED=1" "PRINT_LOGS=1" ] {with-test}
["dune" "install" "-p" name "--create-install-files" name]
]
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
; Use summary.log as the target
(alias
(name runtest)
(package coqide-server)
(package coq)
(deps test-suite/summary.log))

; For make compat
Expand Down
6 changes: 2 additions & 4 deletions test-suite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ endif
# Variables
#######################################################################

# Using quotes to anticipate the possibility of spaces in the directory name
# COQPREFIX is quoted to anticipate the possibility of spaces in the directory name
# Note that this will later need an eval in shell to interpret the quotes
ROOT='$(shell cd ..; pwd)'

BIN:=$(ROOT)/_build/install/default/bin/
BIN:=$(COQPREFIX)/bin/

# An alternative is ifeq ($(OS),Windows_NT) using make's own variable.
ifeq ($(ARCH),win32)
Expand Down

0 comments on commit 6575966

Please sign in to comment.