Skip to content

Commit

Permalink
Adds bisect_ppx instrumentation to measure tests code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeom committed Mar 21, 2024
1 parent 048f6a6 commit c7c808d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ jobs:
- name: Build
run: opam exec -- dune build @install
- name: Test
run: opam exec -- dune runtest
run: BISECT_FILE=`pwd`/bisect opam exec -- dune runtest --force --instrument-with bisect_ppx
- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
run: opam exec -- bisect-ppx-report send-to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# OCaml Generated Files
_build
_build/
_coverage/
*.coverage

# MacOS Files
.DS_Store

# VSCode Files
.vscode
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Whilloc
# Whilloc [![Build](https://github.com/formalsec/whilloc/actions/workflows/build.yml/badge.svg)](https://github.com/formalsec/whilloc/actions/workflows/build.yml) [![Coverage Status](https://coveralls.io/repos/github/formalsec/whilloc/badge.svg?branch=HEAD)](https://coveralls.io/github/formalsec/whilloc?branch=HEAD)

A simple "while"-like programming language that includes memory
allocation support.
Expand Down
4 changes: 3 additions & 1 deletion bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
(modules main options dir cmd_execute cmd_test doc_execute doc_test)
(libraries whilloc cmdliner bos ppx_deriving_yojson.runtime)
(preprocess
(pps ppx_deriving_yojson)))
(pps ppx_deriving_yojson))
(instrumentation
(backend bisect_ppx)))
17 changes: 9 additions & 8 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
(name whilloc)
(synopsis "A short synopsis")
(description "A longer description")
(depends
ocaml
dune
z3
menhir
bos
cmdliner
(depends
ocaml
dune
z3
menhir
bos
cmdliner
ppx_deriving_yojson
(encoding (= "dev")))
(encoding (= "dev"))
(bisect_ppx (and :with-test (>= "2.5.0"))))
(tags
(topics "to describe" your project)))

Expand Down
4 changes: 3 additions & 1 deletion lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
(name whilloc)
(libraries z3 ppx_deriving_yojson.runtime encoding)
(preprocess
(pps ppx_deriving_yojson)))
(pps ppx_deriving_yojson))
(instrumentation
(backend bisect_ppx)))

(ocamllex
(modules lexer))
Expand Down
1 change: 1 addition & 0 deletions whilloc.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ depends: [
"cmdliner"
"ppx_deriving_yojson"
"encoding" {= "dev"}
"bisect_ppx" {with-test & >= "2.5.0"}
"odoc" {with-doc}
]
build: [
Expand Down

0 comments on commit c7c808d

Please sign in to comment.