From 8a914448c94dea0bcf6a8cd4d4dd15217fae2283 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 2 Jun 2021 15:39:50 -0400 Subject: [PATCH] avoid dune stanza for inline tests simpler to just do the testing ourselves --- .github/workflows/main.yml | 3 --- dune-project | 2 +- src/dune | 1 - src/qtest/dune | 17 +++++++++++++++++ tiny_httpd.opam | 2 +- tiny_httpd_camlzip.opam | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 src/qtest/dune diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e96bba80..5ef715a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,9 +14,6 @@ jobs: with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - run: opam pin -n . - # dune 2.8 breaks the inline tests… because of warn-error 😱. So we use an - # older version - - run: opam pin dune 1.11.0 -y -n - run: opam depext -yt tiny_httpd tiny_httpd_camlzip - run: opam install -t . --deps-only - run: opam exec -- dune build diff --git a/dune-project b/dune-project index 7655de07..929c696e 100644 --- a/dune-project +++ b/dune-project @@ -1 +1 @@ -(lang dune 1.1) +(lang dune 2.0) diff --git a/src/dune b/src/dune index ee350ab0..29a2fb12 100644 --- a/src/dune +++ b/src/dune @@ -3,6 +3,5 @@ (name tiny_httpd) (public_name tiny_httpd) (libraries threads) - (inline_tests (backend qtest.lib)) (flags :standard -safe-string -warn-error -a+8) (wrapped false)) diff --git a/src/qtest/dune b/src/qtest/dune new file mode 100644 index 00000000..e5704247 --- /dev/null +++ b/src/qtest/dune @@ -0,0 +1,17 @@ + +(executable + (name qtest) + (modes native) + (flags :standard -warn-error -a+8 -w -33) + (libraries qcheck-core qcheck ounit2 + threads threads.posix tiny_httpd)) + +(rule + (deps (glob_files ../*.ml{,i})) + (targets qtest.ml) + (action (run qtest extract --quiet %{deps} -o %{targets}))) + +(rule + (alias runtest) + (action (run ./qtest.exe))) + diff --git a/tiny_httpd.opam b/tiny_httpd.opam index 3b448e16..869ced7a 100644 --- a/tiny_httpd.opam +++ b/tiny_httpd.opam @@ -10,7 +10,7 @@ build: [ ["dune" "runtest" "-p" name] {with-test} ] depends: [ - "dune" { >= "1.1" } # for now, since qtest needs old dune + "dune" { >= "2.0" } "base-threads" "ocaml" { >= "4.04.0" } "odoc" {with-doc} diff --git a/tiny_httpd_camlzip.opam b/tiny_httpd_camlzip.opam index 9a0b8b31..fd7a6de4 100644 --- a/tiny_httpd_camlzip.opam +++ b/tiny_httpd_camlzip.opam @@ -10,10 +10,10 @@ build: [ ["dune" "runtest" "-p" name] {with-test} ] depends: [ - "dune" { >= "1.1" } + "dune" { >= "2.0" } "camlzip" "tiny_httpd" { = version } - "ocaml" { >= "4.03.0" } + "ocaml" { >= "4.04.0" } "odoc" {with-doc} ] tags: [ "http" "thread" "server" "gzip" "camlzip" ]