From 5ef71430f67777f6cb013a889e7ecfc155d655a6 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Mon, 6 Jun 2016 12:25:26 +0100 Subject: [PATCH 1/3] Add a run-examples Makefile target. --- .travis-ci.sh | 5 +---- Makefile.examples | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 21e6e0ca..53052ef2 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -62,10 +62,7 @@ $MAKE # build and run the tests $MAKE test # build and run the examples -$MAKE examples -_build/date.native -_build/date-cmd.native -_build/fts-cmd.native examples +$MAKE run-examples if test $USE_BISECT ; then ocveralls --send bisect*.out _build/bisect*.out > coveralls.json diff --git a/Makefile.examples b/Makefile.examples index 84495e50..024df349 100644 --- a/Makefile.examples +++ b/Makefile.examples @@ -107,6 +107,12 @@ EXAMPLES += ncurses ncurses-stubs ncurses-cmd-build ncurses- EXAMPLES += fts fts-stubs fts-stub-generator fts-cmd-build fts-cmd EXAMPLES += date date-stubs date-stub-generator date-cmd-build date-cmd +run-examples: examples + # this doesn't run the ncurses example, which takes control of the terminal + _build/date.native + _build/date-cmd.native + _build/fts-cmd.native src + .PHONY: build $(EXAMPLES) examples: build $(EXAMPLES) From 1107dc6d6b4953f1bb610907d9a413a78ea60b16 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Mon, 6 Jun 2016 15:24:38 +0100 Subject: [PATCH 2/3] Add coverage dependencies to the opam file. --- ctypes.opam | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ctypes.opam b/ctypes.opam index d9031917..1707d672 100644 --- a/ctypes.opam +++ b/ctypes.opam @@ -7,7 +7,12 @@ dev-repo: "http://github.com/ocamllabs/ocaml-ctypes.git" bug-reports: "http://github.com/ocamllabs/ocaml-ctypes/issues" license: "MIT" build: [ - [make "XEN=%{mirage-xen:enable}%" "libffi.config" "ctypes-base" "ctypes-stubs"] + [make + "XEN=%{mirage-xen:enable}%" + "COVERAGE=true" {bisect_ppx:installed} + "libffi.config" + "ctypes-base" + "ctypes-stubs"] [make "XEN=%{mirage-xen:enable}%" "ctypes-foreign"] {ctypes-foreign:installed} ] install: [ @@ -21,10 +26,19 @@ depends: [ "ocamlfind" {build} "conf-pkg-config" {build} "lwt" {test} + "ctypes-foreign" {test} + "ounit" {test} ] depopts: [ "ctypes-foreign" "mirage-xen" + "bisect_ppx" {test} + "ocveralls" {test} +] +build-test: [ + [make "COVERAGE=true" {bisect_ppx:installed} "test"] + [make "COVERAGE=true" {bisect_ppx:installed} "run-examples"] + ["sh" "-c" "ocveralls" "--send bisect*.out" "_build/bisect*.out" ">" "coveralls.json"] {bisect_ppx:installed} ] tags: ["org:ocamllabs" "org:mirage"] available: [ ocaml-version >= "4.01.0" ] From 0891e6fa01380d491cbad94596bd9015481ca746 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Mon, 6 Jun 2016 15:29:19 +0100 Subject: [PATCH 3/3] Use the opam file to drive the Travis builds. --- .travis-ci.sh | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 53052ef2..0a569df6 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -1,14 +1,3 @@ -if test $COVERAGE -a $TRAVIS_OS_NAME != osx ; then - USE_BISECT=true; -fi - -OPAM_DEPENDS="ocamlfind ounit lwt" -if test $USE_BISECT ; then - OPAM_DEPENDS="$OPAM_DEPENDS bisect_ppx ocveralls" - MAKE="make COVERAGE=true" -else - MAKE="make" -fi case "$OCAML_VERSION" in 4.01.0) ppa=avsm/ocaml41+opam12 ;; 4.02.3) ppa=avsm/ocaml42+opam12 ;; @@ -56,23 +45,17 @@ ocaml -version echo OPAM versions opam --version opam --git-version -opam install ${OPAM_DEPENDS} + + eval `opam config env` -$MAKE -# build and run the tests -$MAKE test -# build and run the examples -$MAKE run-examples -if test $USE_BISECT ; then - ocveralls --send bisect*.out _build/bisect*.out > coveralls.json +# Optional dependencies for coverage testing +if test $COVERAGE -a $TRAVIS_OS_NAME != osx ; then + opam install bisect_ppx ocveralls fi -# check Xen support builds too -set -eu -if opam install mirage-xen; then - make XEN=enable - ls -l _build/libctypes_stubs_xen.a -else - echo "Mirage not installable, so not testing Xen build." -fi +# Optional dependencies for Xen build +opam install mirage-xen || echo "Mirage not installable, so not testing Xen build." + +opam pin add -n ctypes $(pwd) +opam install --build-test --yes ctypes