Skip to content

Commit

Permalink
switch to dune
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon committed Sep 8, 2019
1 parent d8ea88e commit 2926194
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 234 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ _build
setup.data
setup.log
summary.native
*.merlin
*.install
65 changes: 0 additions & 65 deletions Makefile

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[![Build Status](https://travis-ci.org/lindig/bisect-summary.svg?branch=master)](https://travis-ci.org/lindig/bisect-summary)

# Bisect Summary
Expand Down Expand Up @@ -32,9 +31,9 @@ If you prefer the latest version, you can pin this repository:

If you like to work on the code directly without installing it via Opam:

$ opam install oasis
$ opam install dune
$ opam install bisect_ppx
$ make
$ dune build @install

# Usage

Expand Down
23 changes: 0 additions & 23 deletions _oasis

This file was deleted.

21 changes: 21 additions & 0 deletions bisect-summary.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
opam-version : "2.0"
maintainer : "Christian Lindig <[email protected]>"
authors : ["Christian Lindig <[email protected]>"]
license : "MIT"
homepage : "https://github.com/lindig/bisect-summary"
bug-reports : "https://github.com/lindig/bisect-summary/issues"
dev-repo : "git://github.com/lindig/bisect-summary.git"
synopsis : "Simple analysis of coverage data created by bisect-ppx"
build: [
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"bisect_ppx"
"dune" {build & >= "1.11.0"}
]
description: """bisect-summary - simple analysis of coverage data created by bisect-ppx

This tool reads the data produced by bisect-ppx-instrumented code at
runtime and reports the coverate ratio. Unlike bisect-ppx-report, it
doesn't require access to the source code of the instrumented code and
the *.pmx files that bisect-ppx created at instrumentation time."""
27 changes: 0 additions & 27 deletions configure

This file was deleted.

3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 1.11)
(name bisect-summary)
(explicit_js_mode)
40 changes: 0 additions & 40 deletions ocaml-bisect-summary.spec

This file was deleted.

8 changes: 0 additions & 8 deletions opam/descr

This file was deleted.

22 changes: 0 additions & 22 deletions opam/opam

This file was deleted.

2 changes: 0 additions & 2 deletions opam/url

This file was deleted.

37 changes: 0 additions & 37 deletions setup.ml

This file was deleted.

3 changes: 3 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name summary)
(libraries unix bisect_ppx))
14 changes: 7 additions & 7 deletions src/summary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* ocamlbuild -use-ocamlfind -pkg bisect_ppx summary.native
*)

module B = Bisect.Common
[@@@ocaml.warning "-3"]

(* these are the types used by [bisect_ppx] *)
type file = string
Expand Down Expand Up @@ -53,7 +53,7 @@ let merge
| rx, [] -> rx
| (fx, px)::rx, (fy, py)::ry when fx = fy ->
(fx, add px py) :: loop rx ry
| (fx, px)::rx, ((fy, py)::ry as yy) when fx < fy ->
| (fx, px)::rx, ((fy, _)::_ as yy) when fx < fy ->
(fx, px) :: loop rx yy
| xx, (fy, py)::ry -> (* fx > fy *)
(fy, py) :: loop xx ry
Expand All @@ -66,15 +66,15 @@ let read
: string list -> runtime
= fun files ->
files
|> List.map B.read_runtime_data
|> List.map Bisect.Common.read_runtime_data
|> List.fold_left merge []

(** [popcount array] returns the number of non-zero entries in an array
* *)
let popcount counters =
let add pop = function
| 0 -> pop
| n -> pop + 1
| _ -> pop + 1
in
Array.fold_left add 0 counters

Expand All @@ -88,7 +88,7 @@ let report
let nonzero = popcount counters in
let ratio = match total with
| 0 -> 0.0
| n -> 100.0 *. float_of_int nonzero /. float_of_int total
| _ -> 100.0 *. float_of_int nonzero /. float_of_int total
in
Printf.printf "%5.1f%% [%4d/%-4d] %s\n" ratio nonzero total name

Expand All @@ -114,8 +114,8 @@ let main () =
let init name =
let (//) = Filename.concat in
let tmpdir = Filename.get_temp_dir_name () in
try
ignore (Sys.getenv "BISECT_FILE")
try
ignore (Sys.getenv "BISECT_FILE")
with Not_found ->
Unix.putenv "BISECT_FILE" (tmpdir // Printf.sprintf "bisect-%s-" name)

Expand Down

0 comments on commit 2926194

Please sign in to comment.