avoid dune stanza for inline tests

simpler to just do the testing ourselves
This commit is contained in:
Simon Cruanes 2021-06-02 15:39:50 -04:00
parent e5d5f60e67
commit 8a914448c9
6 changed files with 21 additions and 8 deletions

View file

@ -14,9 +14,6 @@ jobs:
with: with:
ocaml-compiler: ${{ matrix.ocaml-compiler }} ocaml-compiler: ${{ matrix.ocaml-compiler }}
- run: opam pin -n . - 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 depext -yt tiny_httpd tiny_httpd_camlzip
- run: opam install -t . --deps-only - run: opam install -t . --deps-only
- run: opam exec -- dune build - run: opam exec -- dune build

View file

@ -1 +1 @@
(lang dune 1.1) (lang dune 2.0)

View file

@ -3,6 +3,5 @@
(name tiny_httpd) (name tiny_httpd)
(public_name tiny_httpd) (public_name tiny_httpd)
(libraries threads) (libraries threads)
(inline_tests (backend qtest.lib))
(flags :standard -safe-string -warn-error -a+8) (flags :standard -safe-string -warn-error -a+8)
(wrapped false)) (wrapped false))

17
src/qtest/dune Normal file
View file

@ -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)))

View file

@ -10,7 +10,7 @@ build: [
["dune" "runtest" "-p" name] {with-test} ["dune" "runtest" "-p" name] {with-test}
] ]
depends: [ depends: [
"dune" { >= "1.1" } # for now, since qtest needs old dune "dune" { >= "2.0" }
"base-threads" "base-threads"
"ocaml" { >= "4.04.0" } "ocaml" { >= "4.04.0" }
"odoc" {with-doc} "odoc" {with-doc}

View file

@ -10,10 +10,10 @@ build: [
["dune" "runtest" "-p" name] {with-test} ["dune" "runtest" "-p" name] {with-test}
] ]
depends: [ depends: [
"dune" { >= "1.1" } "dune" { >= "2.0" }
"camlzip" "camlzip"
"tiny_httpd" { = version } "tiny_httpd" { = version }
"ocaml" { >= "4.03.0" } "ocaml" { >= "4.04.0" }
"odoc" {with-doc} "odoc" {with-doc}
] ]
tags: [ "http" "thread" "server" "gzip" "camlzip" ] tags: [ "http" "thread" "server" "gzip" "camlzip" ]