diff --git a/.gitignore b/.gitignore index 6eabfca84..5b185bd4b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ /src/client/embedded/bootstrap/concrete_parser.mli /test/.depend +/test/reports /test/test-store /test/test-state @@ -39,8 +40,11 @@ *.cmti *.cmxa *.cmxs +*.cmp *.mli.deps *.ml.deps +bisect*.out + *.rej *.orig \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index d56bc8215..5425b524f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -142,7 +142,8 @@ UTILS_PACKAGES := \ lwt \ ocplib-json-typed \ sodium \ - zarith + zarith \ + $(COVERAGEPKG) \ UTILS_OBJS := \ ${UTILS_LIB_IMPLS:.ml=.cmx} ${UTILS_LIB_IMPLS:.ml=.ml.deps} \ @@ -167,10 +168,10 @@ COMPILER_LIB_INTFS := \ COMPILER_LIB_IMPLS := \ compiler/embedded_cmis.ml \ - compiler/tezos_compiler.ml + compiler/tezos_compiler.ml \ COMPILER_IMPLS := \ - compiler_main.ml + compiler_main.ml \ COMPILER_PACKAGES := \ ${UTILS_PACKAGES} \ @@ -179,7 +180,7 @@ COMPILER_PACKAGES := \ lwt.unix \ ocplib-endian \ ocplib-ocamlres \ - unix + unix \ COMPILER_OBJS := \ ${COMPILER_IMPLS:.ml=.cmx} ${COMPILER_IMPLS:.ml=.ml.deps} \ @@ -277,7 +278,8 @@ NODE_PACKAGES := \ dynlink \ git \ irmin.unix \ - ocplib-resto.directory + ocplib-resto.directory \ + EMBEDDED_NODE_PROTOCOLS := \ $(patsubst proto/%/,proto/embedded_proto_%.cmxa, \ @@ -426,7 +428,7 @@ clean:: .PHONY: clean clean:: - -find \( -name \*.cm\* -or -name \*~ -or -name \*.o -or -name \*.a \) -delete + -find \( -name \*.cm\* -or -name \*.cmp -or -name \*.out -or -name \*~ -or -name \*.o -or -name \*.a \) -delete ## Dependencies diff --git a/src/Makefile.config b/src/Makefile.config index f9f74976e..b8c22e19c 100644 --- a/src/Makefile.config +++ b/src/Makefile.config @@ -1,4 +1,8 @@ +ifeq ($(strip ${COVERAGE}),yes) + COVERAGEPKG := bisect_ppx +endif + INCLUDES = \ $(patsubst %, -I %, $(SOURCE_DIRECTORIES)) \ $(patsubst %, -package %, $(PACKAGES)) \ diff --git a/src/tezos-deps.opam b/src/tezos-deps.opam index d6f4182e1..8f1494c51 100644 --- a/src/tezos-deps.opam +++ b/src/tezos-deps.opam @@ -28,5 +28,6 @@ depends: [ "ocplib-json-typed" "ocplib-resto" {>= "dev"} "sodium" {>= "0.3.0"} - "kaputt" + "kaputt" (* only for testing *) + "bisect_ppx" (* only for testing *) ] diff --git a/test/.merlin b/test/.merlin index b59cb5c6a..a655756d5 100644 --- a/test/.merlin +++ b/test/.merlin @@ -22,4 +22,4 @@ B ./lib FLG -w -40 PKG lwt PKG sodium -PKG kaputt \ No newline at end of file +PKG kaputt diff --git a/test/Makefile b/test/Makefile index edbdefc00..e8e03b99f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -42,7 +42,8 @@ PACKAGES := \ ocplib-resto.directory \ sodium \ unix \ - kaputt + kaputt \ + bisect_ppx.runtime ############################################################################ ## External packages @@ -190,6 +191,28 @@ test-data-encoding: ${NODELIB} ${TEST_DATA_ENCODING_IMPLS:.ml=.cmx} clean:: rm -f test-data-encoding +COVERAGESRCDIR= \ + -I ../src \ + -I ../src/client \ + -I ../src/client/embedded \ + -I ../src/client/embedded/bootstrap \ + -I ../src/client/embedded/bootstrap/mining \ + -I ../src/client/embedded/bootstrap/demo \ + -I ../src/compiler \ + -I ../src/node \ + -I ../src/node/db \ + -I ../src/node/updater \ + -I ../src/node/net \ + -I ../src/node/shell \ + -I ../src/proto \ + -I ../src/proto/bootstrap \ + -I ../src/proto/demo \ + -I ../src/utils + +bisect: + bisect-ppx-report $(COVERAGESRCDIR) \ + -ignore-missing-files -html reports bisect*.out + ############################################################################ ## Generic rules @@ -205,7 +228,7 @@ test.cmx: test.cmi ocamlfind ocamlc ${OCAMLFLAGS} -c $< clean:: - -rm -f *.cm* lib/*.cm* + -rm -f *.cm* lib/*.cm* *.out *.o -include .depend .depend: $(wildcard *.ml *.mli lib/*.ml lib/*.mli)