Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dynamic_include to include the generated file dune.inc #1199

Merged
merged 6 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,23 @@ 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
Comment on lines -120 to -122
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we no longer have a way to generate automatically new expected files for new tests now. Do we need to add them manually?

Copy link
Collaborator Author

@Halbaroth Halbaroth Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it still works and I checked it. After putting your new file, you have just to run make runtest and gentest will create an empty expected file for you and compare it with the result. Then you can run make promote if you are happy with the output ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhm actually, make runtest will create a new file in _build/default/test/, so you cannot promote it :/ Ok we have to fix that.

dune build @tests/gentest --auto-promote
# Generate dummy expected file for new tests.
genexpected:
dune exec -- tools/gentest.exe --kind expected tests >/dev/null

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

# Run non-regression tests for the CI.
runtest-ci: gentest bin
runtest-ci: genexpected 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
8 changes: 8 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(subdir runtest
(dynamic_include ../gentest/dune.inc))

(subdir gentest
(rule
(deps (source_tree ../tests))
(action
(with-stdout-to dune.inc (run ../tools/gentest.exe --kind rule ../tests)))))
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
23 changes: 0 additions & 23 deletions tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@
(package alt-ergo)
(deps %{bin:alt-ergo}))

(include 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)))

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