Skip to content

Commit

Permalink
Use dynamic_include to include the generated file dune.inc
Browse files Browse the repository at this point in the history
This PR uses the new feature `dynamic_include` to include our generated
file `dune.inc`.

Pros:
- We do not upstream `dune.inc` anymore!
- The output of `dune.inc` depends on the plateform. This is the main
  motivation of this PR because Windows does not use the convention for
  path.

Cons:
- We need `Dune > 3.14`
- We cannot use the stanza `subdir` in `dune.inc`, which means we have
  to ensure we do not use twice the same name for two tests even if
  there are not in the same directory. See issue
  ocaml/dune#10405
  • Loading branch information
Halbaroth committed Aug 8, 2024
1 parent 6d8efd7 commit e36dd34
Show file tree
Hide file tree
Showing 1,862 changed files with 46 additions and 202,396 deletions.
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Declare files will always have LF line endings on checkout.
*.sh text eol=lf

# Hide the file in statistics and pull request diffs.
tests/dune.inc linguist-generated
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,19 @@ packages:
# Generate tests
# ==============

# Generate new Dune tests from the problems in
# the directory tests/.
gentest: $(wildcard tests/**/*)
# TODO: There should be an option to gentest to avoid printing the
# dune.inc file and only touch the expected files in this call.
dune exec -- tools/gentest.exe tests >/dev/null
dune build @tests/gentest --auto-promote

# Run non-regression tests.
runtest: gentest bin
runtest: bin
dune build @runtest @runtest-quick

# Run non-regression tests for the CI.
runtest-ci: gentest bin
runtest-ci: bin
dune build @runtest @runtest-quick @runtest-ci

# Promote new outputs of the tests.
promote:
dune promote

.PHONY: gentest runtest runtest-ci promote
.PHONY: runtest runtest-ci promote

# ============
# Installation
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-lib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"dune-build-info"
"dolmen" {>= "0.10"}
"dolmen_type" {>= "0.10"}
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-parsers.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo-lib" {= version}
"psmt2-frontend" {>= "0.4"}
"menhir"
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo-plugin-ab-why3.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage: "https://alt-ergo.ocamlpro.com/"
doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo" {= version}
"alt-ergo-lib" {= version}
"alt-ergo-parsers" {= version}
Expand Down
2 changes: 1 addition & 1 deletion alt-ergo.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ doc: "https://ocamlpro.github.io/alt-ergo"
bug-reports: "https://github.com/OCamlPro/alt-ergo/issues"
depends: [
"ocaml" {>= "4.08.1"}
"dune" {>= "3.0"}
"dune" {>= "3.14"}
"alt-ergo-lib" {= version}
"alt-ergo-parsers" {= version}
"menhir"
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.0)
(lang dune 3.14)
(version dev)

; Since we want to generate opam files we need to provide informations ;
Expand Down
2 changes: 1 addition & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sources.nixpkgs {
overlays = [
(_: pkgs: { inherit sources; })
(_: pkgs: {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14.overrideScope' (self: super: {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14.overrideScope (self: super: {
pp_loc = pkgs.callPackage ./pp_loc.nix { };
ocplib-simplex = pkgs.callPackage ./ocplib-simplex.nix { };
dolmen = pkgs.callPackage ./dolmen.nix { };
Expand Down
8 changes: 4 additions & 4 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"version": "dev"
},
"nixpkgs": {
"branch": "release-23.11",
"branch": "release-24.05",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
"sha256": "1f5d2g1p6nfwycpmrnnmc2xmcszp804adp16knjvdkj8nz36y1fg",
"rev": "b260a95463a8f5f9094527c05329d79527e5a4aa",
"sha256": "0qlnwrha950kflbnfsl39mrdkkll3663bssjlxrrm7w1qnbbbp1n",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/205fd4226592cc83fd4c0885a3e4c9c400efabb5.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/b260a95463a8f5f9094527c05329d79527e5a4aa.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ocplib-simplex": {
Expand Down
28 changes: 7 additions & 21 deletions tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,14 @@
(package alt-ergo)
(deps %{bin:alt-ergo}))

(include dune.inc)
(subdir run
(dynamic_include ../generate/dune.inc))

(rule
(deps (file ../tools/gentest.exe) (source_tree .))
(action
(with-stdout-to dune.inc.gen (run ../tools/gentest.exe .))))

(rule
(alias gentest)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest-quick)
(action (diff dune.inc dune.inc.gen)))

(rule
(alias runtest-ci)
(action (diff dune.inc dune.inc.gen)))
(subdir generate
(rule
(deps (source_tree ../input))
(action
(with-stdout-to dune.inc (run ../../tools/gentest.exe ../input)))))

(test
(package alt-ergo-lib)
Expand Down
Loading

0 comments on commit e36dd34

Please sign in to comment.