Skip to content

Commit

Permalink
Re-enable test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rleonid committed Oct 29, 2016
1 parent 6182147 commit c0001f2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,6 @@
_build
_test_build
_lite_build
_covered_test_build
_doc_build
report_dir/
*.native
Expand Down
18 changes: 10 additions & 8 deletions Makefile
@@ -1,6 +1,7 @@
TEST_BUILD_DIR="_test"
TEST_BUILD_DIR="_test_build"
COVERED_TEST_BUILD_DIR="_covered_test_build"

.PHONY: all clean test build setup doc
.PHONY: all clean test build setup doc

default: FORCE
@echo "available targets:"
Expand Down Expand Up @@ -31,12 +32,13 @@ clean:

#### Testing

test:
ocaml pkg/pkg.ml build --build-dir $(TEST_BUILD_DIR) -n omltest && time ocaml pkg/pkg.ml test --build-dir $(TEST_BUILD_DIR)

covered_test: covered_test.native
time ./oml_test.native ${TEST}
test:
ocaml pkg/pkg.ml build --build-dir $(TEST_BUILD_DIR) -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(TEST_BUILD_DIR)

covered_test:
ocaml pkg/pkg.ml build --build-dir $(COVERED_TEST_BUILD_DIR) --with-coverage true -n omltest && \
time ocaml pkg/pkg.ml test --build-dir $(COVERED_TEST_BUILD_DIR)

#### Test Coverage

Expand All @@ -47,7 +49,7 @@ report_dir:
# (ie. the *.ml has the *.mlt inside of it with our label), we get proper
# alignment of the html!
report: report_dir
cd $(TEST_BUILD_DIR) && \
cd $(COVERED_TEST_BUILD_DIR) && \
bisect-ppx-report -html ../report_dir ../$(shell ls -t bisect*.out | head -1) && \
cd -

Expand Down
53 changes: 33 additions & 20 deletions pkg/pkg.ml
Expand Up @@ -7,25 +7,38 @@ let lacaml = Conf.with_pkg ~default:false "lacaml"
let lbfgs = Conf.with_pkg ~default:false "lbfgs"
let ocephes = Conf.with_pkg ~default:false "ocephes"
let kaputt = Conf.with_pkg "kaputt"
let bisect_ppx = Conf.with_pkg "bisect_ppx"
let coverage = Conf.with_pkg ~default:false "coverage"

let () =
Pkg.describe "oml" @@ fun c ->
let lacaml = Conf.value c lacaml in
let lbfgs = Conf.value c lbfgs in
let ocephes = Conf.value c ocephes in
let full = lacaml && lbfgs && ocephes in
match Conf.pkg_name c with
| "oml" ->
Ok [ Pkg.mllib ~api:["Oml"] "src/oml.mllib"
; Pkg.mllib ~cond:full ~api:["Oml_full"] "src-full/oml_full.mllib"
]
| "omltest" ->
let kaputt = Conf.value c kaputt in
(* TODO: Add dsfo! *)
let full = full && kaputt in
Ok [ Pkg.mllib ~api:["Oml"] "src/oml.mllib"
; Pkg.mllib ~cond:full ~api:["Oml_full"] "src-full/oml_full.mllib"
; Pkg.test "test/oml_test"
]
| other ->
R.error_msgf "Unrecognized package name: %s" other
let build =
let cmd c os fpaths =
let scmd =
if Conf.value c coverage
then Cmd.((Pkg.build_cmd c os) % "-package" % "bisect_ppx" %% of_list fpaths)
else Cmd.(Pkg.build_cmd c os %% of_list fpaths)
in
OS.Cmd.run scmd
in
Pkg.build ~cmd ()
in
Pkg.describe ~build "oml" @@ fun c ->
let lacaml = Conf.value c lacaml in
let lbfgs = Conf.value c lbfgs in
let ocephes = Conf.value c ocephes in
let full = lacaml && lbfgs && ocephes in
match Conf.pkg_name c with
| "oml" ->
Ok [ Pkg.mllib ~api:["Oml"] "src/oml.mllib"
; Pkg.mllib ~cond:full ~api:["Oml_full"] "src-full/oml_full.mllib"
]
| "omltest" ->
let kaputt = Conf.value c kaputt in
(* TODO: Add dsfo! *)
let full = full && kaputt in
Ok [ Pkg.mllib ~api:["Oml"] "src/oml.mllib"
; Pkg.mllib ~cond:full ~api:["Oml_full"] "src-full/oml_full.mllib"
; Pkg.test "test/oml_test"
]
| other ->
R.error_msgf "Unrecognized package name: %s" other
13 changes: 5 additions & 8 deletions tools/travis_ci_test.sh
Expand Up @@ -44,12 +44,9 @@ opam install ocephes lacaml lbfgs
echo Compiling with C/Fortran deps
make build

echo Testing with C/Fortran dest
make test

echo Install bisect ppx and ocveralls for coverage reporting
opam install bisect_ppx ocveralls

#echo PostingCoverage
#opam install ocveralls

#cd _test_build
#ocveralls --repo_token $COVERALLSTOKEN --git --send ../bisect0001.out
echo Testing with C/Fortran dest
make covered_test
ocveralls --repo_token $COVERALLSTOKEN --git --send ../bisect0001.out

0 comments on commit c0001f2

Please sign in to comment.