diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df10a0df..19cbcca3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,21 +7,21 @@ jobs: fail-fast: false matrix: os: - - ubuntu-18.04 - - macos-10.15 + - ubuntu-18.04 + - macos-10.15 # Build binaries on older systems to require lower versions of libc and # other system libraries. runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 - - run: npm install esy - - run: echo PATH=$(pwd)/node_modules/.bin:$PATH >> $GITHUB_ENV - - run: make -C test/js full-test - - if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} - env: - DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} - run: bash ./test/ci/binaries.sh + - uses: actions/checkout@v2 + - run: npm install esy + - run: echo PATH=$(pwd)/node_modules/.bin:$PATH >> $GITHUB_ENV + - run: make -C test/js full-test + - if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} + env: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + run: bash ./test/ci/binaries.sh opam: if: ${{github.ref != 'refs/heads/binaries'}} @@ -30,92 +30,79 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + - ubuntu-latest ocaml: - - 4.13.1 - - 4.12.1 - - 4.11.2 - - 4.10.2 - - 4.09.1 - - 4.08.1 - - 4.07.1 - - 4.06.1 - - 4.05.0 - - 4.04.2 + - 4.14.0 include: - - os: macos-latest - ocaml: 4.12.1 - # ocamlformat 0.16.0, used in testing, doesn't support OCaml 4.13, and - # we are using a Linux binary of it. So, hold the Mac build back to - # 4.12 for now, and install ocamlformat from opam on Mac. - - os: windows-latest - ocaml: 4.12.1 + - os: macos-latest + ocaml: 4.14.0 + # ocamlformat 0.16.0, used in testing, doesn't support OCaml 4.13, and + # we are using a Linux binary of it. So, hold the Mac build back to + # 4.12 for now, and install ocamlformat from opam on Mac. + - os: windows-latest + ocaml: 4.14.0 runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 - - uses: avsm/setup-ocaml@v2 - with: - ocaml-compiler: ${{matrix.ocaml}} + - uses: actions/checkout@v2 + - uses: avsm/setup-ocaml@v2 + with: + ocaml-compiler: ${{matrix.ocaml}} - - name: Install opam dependencies - run: opam install --deps-only --yes . + - name: Install opam dependencies + run: opam install --deps-only --yes . + # - name: Install ocamlformat (Linux) + # if: ${{runner.os == 'Linux'}} + # run: | + # wget https://github.com/aantron/ocamlformat-binary/releases/download/0.24.1/ocamlformat + # sudo mv ocamlformat /usr/local/bin/ocamlformat + # sudo chmod a+x /usr/local/bin/ocamlformat + - name: Install ocamlformat (non-Linux) + # if: ${{runner.os != 'Linux'}} + run: opam install ocamlformat.0.24.1 --yes - - name: Install ocamlformat (Linux) - if: ${{runner.os == 'Linux'}} - run: | - wget https://github.com/aantron/ocamlformat-binary/releases/download/0.15.0/ocamlformat - sudo mv ocamlformat /usr/local/bin/ocamlformat - sudo chmod a+x /usr/local/bin/ocamlformat - - name: Install ocamlformat (non-Linux) - if: ${{runner.os != 'Linux'}} - run: opam install ocamlformat.0.16.0 --yes + - name: Install coreutils (Mac) + if: ${{runner.os == 'macOS'}} + run: brew install coreutils - - name: Install coreutils (Mac) - if: ${{runner.os == 'macOS'}} - run: brew install coreutils + - name: Version feedback + run: | + opam --version + opam exec -- ocaml -version + opam exec -- ocamlformat --version + truncate --version - - name: Version feedback - run: | - opam --version - opam exec -- ocaml -version - opam exec -- ocamlformat --version - truncate --version + - name: Build + run: opam exec -- make build - - name: Build - run: opam exec -- make build + - name: Test + if: ${{runner.os != 'Windows'}} + run: | + case `opam exec -- ocamlc -version` in + "4.07.1") TEST_ALIAS=@compatible;; + "4.06.1") TEST_ALIAS=@compatible;; + "4.05.0") TEST_ALIAS=@compatible;; + "4.04.2") TEST_ALIAS=@compatible;; + *) TEST_ALIAS=@runtest;; + esac + unset GITHUB_ACTIONS + unset GITHUB_RUN_NUMBER + opam exec -- make test TEST=$TEST_ALIAS - - name: Test - if: ${{runner.os != 'Windows'}} - run: | - case `opam exec -- ocamlc -version` in - "4.07.1") TEST_ALIAS=@compatible;; - "4.06.1") TEST_ALIAS=@compatible;; - "4.05.0") TEST_ALIAS=@compatible;; - "4.04.2") TEST_ALIAS=@compatible;; - *) TEST_ALIAS=@runtest;; - esac - unset GITHUB_ACTIONS - unset GITHUB_RUN_NUMBER - opam exec -- make test TEST=$TEST_ALIAS + - name: Usage test + run: | + opam install reason js_of_ocaml --yes + opam exec -- make clean-usage usage - # Reason requires OCaml <= 4.12. - - name: Usage test - if: ${{matrix.ocaml == '4.12.1' && runner.os == 'Linux'}} - run: | - opam install reason js_of_ocaml --yes - opam exec -- make clean-usage usage - - - name: Submit self-coverage to Coveralls - if: ${{matrix.ocaml == '4.12.1' && runner.os == 'Linux'}} - continue-on-error: true - env: - COVERALLS_REPO_TOKEN: ${{secrets.GITHUB_TOKEN}} - PULL_REQUEST_NUMBER: ${{github.event.number}} - run: | - (unset GITHUB_ACTIONS && unset GITHUB_RUN_NUMBER && \ - unset COVERALLS_REPO_TOKEN && unset PULL_REQUEST_NUMBER && \ - opam exec -- make clean self-coverage) - (cd _self && \ - _build/install/default/bin/meta-bisect-ppx-report \ - send-to Coveralls bisect*.meta) + - name: Submit self-coverage to Coveralls + continue-on-error: true + env: + COVERALLS_REPO_TOKEN: ${{secrets.GITHUB_TOKEN}} + PULL_REQUEST_NUMBER: ${{github.event.number}} + run: | + (unset GITHUB_ACTIONS && unset GITHUB_RUN_NUMBER && \ + unset COVERALLS_REPO_TOKEN && unset PULL_REQUEST_NUMBER && \ + opam exec -- make clean self-coverage) + (cd _self && \ + _build/install/default/bin/meta-bisect-ppx-report \ + send-to Coveralls bisect*.meta) diff --git a/.gitignore b/.gitignore index d4f5b3ef..19840cc1 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ lib/ _esy/ *.tgz package/ + +*.esy.lock +esy.lock +.DS_Store \ No newline at end of file diff --git a/bin/macos_m1/bisect-ppx-report b/bin/macos_m1/bisect-ppx-report new file mode 100755 index 00000000..7d219c97 Binary files /dev/null and b/bin/macos_m1/bisect-ppx-report differ diff --git a/bin/macos_m1/ppx b/bin/macos_m1/ppx new file mode 100755 index 00000000..9d796294 Binary files /dev/null and b/bin/macos_m1/ppx differ diff --git a/binaries.esy.json b/binaries.esy.json index 7cb24693..d0f3e8b1 100644 --- a/binaries.esy.json +++ b/binaries.esy.json @@ -1,9 +1,10 @@ { "dependencies": { - "ocaml": ">= 4.2.0", + "ocaml": ">= 4.14.0", "@opam/cmdliner": "^1.0.0", "@opam/dune": "^2.7.0", - "@opam/ppxlib": ">= 0.21.0" + "@opam/ppxlib": ">=0.26.0", + "@opam/ocaml-lsp-server": "1.11.6" }, "esy": { "build": "dune build -p bisect_ppx", diff --git a/bsconfig.json b/bsconfig.json index 1c4bc044..ccb8ef58 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -1,8 +1,7 @@ { - "name": "bisect_ppx", + "name": "@jfrolich/bisect_ppx", "namespace": "Bisect", "sources": [ - "src/common", "src/runtime/js" ] } diff --git a/package.json b/package.json index 204a0319..0052bb9d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "bisect_ppx", + "name": "@jfrolich/bisect_ppx", "description": "Code coverage for OCaml and Reason", - "version": "2.8.1", + "version": "2.8.3", "license": "MIT", "homepage": "https://github.com/aantron/bisect_ppx", "bugs": { @@ -35,5 +35,8 @@ "src", "bin", "bisect-ppx-report" - ] + ], + "dependencies": { + "rescript": "10.1.0" + } } diff --git a/src/npm-install.sh b/src/npm-install.sh index 27548fd1..8c630ea5 100644 --- a/src/npm-install.sh +++ b/src/npm-install.sh @@ -1,4 +1,15 @@ #!/usr/bin/env bash +UNAME=`uname -s` +ARCH=`uname -m` +case "$UNAME" in + "Linux") OS=linux;; + "Darwin") + case "$ARCH" in + "arm64") OS=macos_m1;; + *) OS=macos;; + esac;; + *) echo "Unknown OS '$UNAME'; falling back to a source build."; esy_build;; +esac esy_build() { set -e @@ -8,10 +19,11 @@ esy_build() { cp _build/default/src/ppx/js/ppx.exe ./ppx esy -P binaries.esy.json dune build -p bisect_ppx src/report/main.exe cp _build/default/src/report/main.exe ./bisect-ppx-report + # cp ./ppx bin/$OS/ppx + # cp ./bisect-ppx-report bin/$OS/bisect-ppx-report exit 0 } -UNAME=`uname -s` RESULT=$? if [ "$RESULT" != 0 ] then @@ -19,11 +31,6 @@ then esy_build fi -case "$UNAME" in - "Linux") OS=linux;; - "Darwin") OS=macos;; - *) echo "Unknown OS '$UNAME'; falling back to a source build."; esy_build;; -esac if [ ! -f bin/$OS/ppx ] then diff --git a/src/ppx/instrument.ml b/src/ppx/instrument.ml index 59c3c01e..98de701b 100644 --- a/src/ppx/instrument.ml +++ b/src/ppx/instrument.ml @@ -490,7 +490,7 @@ struct |> List.map (fun (location_trace, p'') -> (location_trace, Pat.alias ~loc ~attrs p'' x)) - | Ppat_construct (c, Some p') -> + | Ppat_construct (c, Some (_, p')) -> recur ~enclosing_loc p' |> List.map (fun (location_trace, p'') -> (location_trace, Pat.construct ~loc ~attrs c (Some p''))) @@ -708,7 +708,8 @@ struct List.map (fun (_, p') -> bound_variables p') fields |> List.flatten - | Ppat_construct (_, Some p') | Ppat_variant (_, Some p') + | Ppat_construct (_, Some (_, p')) + | Ppat_variant (_, Some p') | Ppat_constraint (p', _) | Ppat_lazy p' | Ppat_exception p' | Ppat_open (_, p') -> bound_variables p' @@ -725,7 +726,8 @@ struct | Ppat_type _ | Ppat_variant _ -> true - | Ppat_alias (p', _) | Ppat_construct (_, Some p') + | Ppat_alias (p', _) + | Ppat_construct (_, Some (_, p')) | Ppat_constraint (p', _) | Ppat_lazy p' | Ppat_exception p' | Ppat_open (_, p') -> has_polymorphic_variant p' @@ -1039,39 +1041,40 @@ class instrumenter = let instrument_cases = Generated_code.instrument_cases points in object (self) - inherit Ppxlib.Ast_traverse.map_with_expansion_context as super + inherit Ppxlib.Ast_traverse.map_with_expansion_context_and_errors as super method! class_expr ctxt ce = let loc = ce.pcl_loc in let attrs = ce.pcl_attributes in - let ce = super#class_expr ctxt ce in + let (ce,err) = super#class_expr ctxt ce in match ce.pcl_desc with | Pcl_fun (l, e, p, ce) -> - Cl.fun_ ~loc ~attrs l (Option.map instrument_expr e) p ce + (Cl.fun_ ~loc ~attrs l (Option.map instrument_expr e) p ce,err) | _ -> - ce + (ce,err) method! class_field ctxt cf = let loc = cf.pcf_loc in let attrs = cf.pcf_attributes in - let cf = super#class_field ctxt cf in + let (cf,err) = super#class_field ctxt cf in match cf.pcf_desc with | Pcf_method (name, private_, cf) -> - Cf.method_ ~loc ~attrs + (Cf.method_ ~loc ~attrs name private_ (match cf with | Cfk_virtual _ -> cf | Cfk_concrete (o, e) -> - Cf.concrete o (instrument_expr e)) + Cf.concrete o (instrument_expr e)),err) | Pcf_initializer e -> - Cf.initializer_ ~loc ~attrs (instrument_expr e) + (Cf.initializer_ ~loc ~attrs (instrument_expr e), err) | _ -> - cf + (cf, err) + method! expression ctxt e = let is_trivial_function = Parsetree.(function @@ -1496,7 +1499,7 @@ class instrumenter = | Pexp_letmodule (m, e, e') -> Exp.letmodule ~loc ~attrs m - (self#module_expr ctxt e) + (fst (self#module_expr ctxt e)) (traverse ~is_in_tail_position e') | Pexp_letexception (c, e) -> @@ -1504,7 +1507,7 @@ class instrumenter = | Pexp_open (m, e) -> Exp.open_ ~loc ~attrs - (self#open_declaration ctxt m) + (fst (self#open_declaration ctxt m)) (traverse ~is_in_tail_position e) | Pexp_newtype (t, e) -> @@ -1513,10 +1516,10 @@ class instrumenter = (* Expressions that don't need instrumentation, and where AST traversal leaves the expression language. *) | Pexp_object c -> - Exp.object_ ~loc ~attrs (self#class_structure ctxt c) + Exp.object_ ~loc ~attrs (fst (self#class_structure ctxt c)) | Pexp_pack m -> - Exp.pack ~loc ~attrs (self#module_expr ctxt m) + Exp.pack ~loc ~attrs (fst (self#module_expr ctxt m)) (* Expressions that are not recursively traversed at all. *) | Pexp_extension _ | Pexp_unreachable -> @@ -1536,7 +1539,7 @@ class instrumenter = in - traverse ~is_in_tail_position:false e + (traverse ~is_in_tail_position:false e, []) (* Set to [true] upon encountering [[@@@coverage.off]], and back to [false] again upon encountering [[@@@coverage.on]]. *) @@ -1548,7 +1551,7 @@ class instrumenter = match si.pstr_desc with | Pstr_value (rec_flag, bindings) -> if structure_instrumentation_suppressed then - si + (si, []) else let bindings = @@ -1580,16 +1583,16 @@ class instrumenter = if do_not_instrument then binding else - {binding with pvb_expr = self#expression ctxt binding.pvb_expr} + {binding with pvb_expr = fst (self#expression ctxt binding.pvb_expr)} end in - Str.value ~loc rec_flag bindings + (Str.value ~loc rec_flag bindings, []) | Pstr_eval (e, a) -> if structure_instrumentation_suppressed then - si + (si, []) else - Str.eval ~loc ~attrs:a (self#expression ctxt e) + (Str.eval ~loc ~attrs:a (fst (self#expression ctxt e)), []) | Pstr_attribute attribute -> let kind = Coverage_attributes.recognize attribute in @@ -1612,17 +1615,17 @@ class instrumenter = Location.raise_errorf ~loc:attribute.attr_loc "coverage exclude_file is not allowed here." end; - si + (si, []) | _ -> super#structure_item ctxt si (* Don't instrument payloads of extensions and attributes. *) method! extension _ e = - e + (e, []) method! attribute _ a = - a + (a, []) method! structure ctxt ast = let saved_structure_instrumentation_suppressed = @@ -1658,7 +1661,7 @@ class instrumenter = let instrumented_ast = super#structure ctxt ast in let runtime_initialization = Generated_code.runtime_initialization points path in - runtime_initialization @ instrumented_ast + runtime_initialization @ (fst instrumented_ast) end in diff --git a/src/ppx/instrument.mli b/src/ppx/instrument.mli index 83333434..927cf11a 100644 --- a/src/ppx/instrument.mli +++ b/src/ppx/instrument.mli @@ -5,7 +5,7 @@ class instrumenter : object - inherit Ppxlib.Ast_traverse.map_with_expansion_context + inherit Ppxlib.Ast_traverse.map_with_expansion_context_and_errors method transform_impl_file: Ppxlib.Expansion_context.Base.t -> diff --git a/src/runtime/js/runtime.ml b/src/runtime/js/runtime.ml index 23e7ac77..b72a5dee 100644 --- a/src/runtime/js/runtime.ml +++ b/src/runtime/js/runtime.ml @@ -2,10 +2,78 @@ LICENSE.md for details, or visit https://github.com/aantron/bisect_ppx/blob/master/LICENSE.md. *) +module Buffer = struct + type t = { + mutable contents : string; + } + let make () = {contents = ""} + let add t str = t.contents <- t.contents ^ str + let contents t = t.contents +end + +type instrumented_file = { + filename : string; + points : int array; + counts : int array; +} + +type coverage = (string, instrumented_file) Hashtbl.t + +let coverage_file_identifier = "BISECT-COVERAGE-4" + +let write_int buf i = + Buffer.add buf (" " ^ (string_of_int i)) + +let write_string buf s = + Buffer.add buf (" " ^ (string_of_int (String.length s)) ^ " " ^ s) + +let write_array write_element buf a = + Buffer.add buf (" " ^ (string_of_int (Array.length a))); + Array.iter (write_element buf) a + +let write_list write_element buf l = + Buffer.add buf (" " ^ (string_of_int (List.length l))); + List.iter (write_element buf) l + +let write_instrumented_file buf {filename; points; counts} = + write_string buf filename; + write_array write_int buf points; + write_array write_int buf counts + +let write_coverage buf coverage = + Buffer.add buf coverage_file_identifier; + write_list write_instrumented_file buf coverage + +(** Helpers for serializing the coverage data in {!coverage}. *) +let flatten_coverage coverage = + Hashtbl.fold (fun _ file acc -> file::acc) coverage [] + +let coverage : coverage Lazy.t = + lazy (Hashtbl.create 17) + +let flatten_data () = + flatten_coverage (Lazy.force coverage) + +let runtime_data_to_string () = + match flatten_data () with + | [] -> + None + | data -> + let buf = Buffer.make () in + write_coverage buf data; + Some (Buffer.contents buf) let get_coverage_data = - Bisect_common.runtime_data_to_string + runtime_data_to_string + +let prng = + Random.State.make_self_init () [@coverage off] + +let random_filename ~prefix = + let numStr = (string_of_int (abs (Random.State.int prng 1000000000))) in + let paddedStr = (Js.String2.repeat "0" (9 - String.length numStr)) ^ numStr in + prefix ^ paddedStr ^ ".coverage" let write_coverage_data () = match get_coverage_data () with @@ -13,7 +81,7 @@ let write_coverage_data () = () | Some data -> let rec create_file attempts = - let filename = Bisect_common.random_filename ~prefix:"bisect" in + let filename = random_filename ~prefix:"bisect" in match Node.Fs.openSync filename `Write_fail_if_exists with | exception exn -> if attempts = 0 then @@ -25,8 +93,16 @@ let write_coverage_data () = in create_file 100 +let reset_counters () = + Lazy.force coverage + |> Hashtbl.iter begin fun _ {counts; _} -> + match Array.length counts with + | 0 -> () + | n -> Array.fill counts 0 (n - 1) 0 + end + let reset_coverage_data = - Bisect_common.reset_counters + reset_counters let node_at_exit = [%bs.raw {| function (callback) { @@ -43,7 +119,18 @@ let write_coverage_data_on_exit () = exit_hook_added := true end +let register_file ~filename ~points = + let counts = Array.make (Array.length points) 0 in + let coverage = Lazy.force coverage in + if not (Hashtbl.mem coverage filename) then + Hashtbl.add coverage filename {filename; points; counts}; + `Visit (fun index -> + let current_count = counts.(index) in + if current_count < max_int then + counts.(index) <- current_count + 1) + + let register_file ~bisect_file:_ ~bisect_silent:_ ~bisect_sigterm:_ ~filename ~points = write_coverage_data_on_exit (); - Bisect_common.register_file ~filename ~points + register_file ~filename ~points diff --git a/test/ci/binaries.sh b/test/ci/binaries.sh index a8e7d5e1..e4c41642 100644 --- a/test/ci/binaries.sh +++ b/test/ci/binaries.sh @@ -2,9 +2,9 @@ set -e -git remote set-url origin git@github.com:aantron/bisect_ppx.git -git config user.name "Anton Bachin" -git config user.email "antonbachin@yahoo.com" +git remote set-url origin git@github.com:jfrolich/bisect_ppx.git +git config user.name "Jaap Frolich" +git config user.email "jfrolich@gmail.com" mkdir -p ~/.ssh chmod 700 ~/.ssh echo "$DEPLOY_KEY" | base64 --decode > ~/.ssh/binaries @@ -32,13 +32,13 @@ try_to_commit() { git reset --hard $GITHUB_SHA fi mkdir -p bin/$OS - cp test/js/node_modules/bisect_ppx/ppx bin/$OS/ + cp test/js/node_modules/@jfrolich/bisect_ppx/ppx bin/$OS/ cp test/js/node_modules/.bin/bisect-ppx-report bin/$OS/ strip bin/$OS/ppx strip bin/$OS/bisect-ppx-report git add bin/ cp src/report/dummy-binary ./bisect-ppx-report - git add bisect-ppx-report + # git add bisect-ppx-report echo "Binaries for '$OS'" > commit-message if [ `ls bin | wc -l` != 2 ] then diff --git a/test/instrument/apply/special.t b/test/instrument/apply/special.t index 6a11d013..08a57ec7 100644 --- a/test/instrument/apply/special.t +++ b/test/instrument/apply/special.t @@ -97,7 +97,6 @@ Subexpressions are still instrumented. > let _ = (:=) (ref (print_endline "foo")) (print_endline "bar") > EOF let _ = ref (___bisect_post_visit___ 0 (print_endline "foo")) - let _ = !(ref (___bisect_post_visit___ 1 (print_endline "foo"))) let _ = @@ -310,5 +309,4 @@ Subexpressions are still instrumented. "bar") let _ = ignore (___bisect_post_visit___ 3 (print_endline "foo")) - let _ = Obj.magic (___bisect_post_visit___ 4 (print_endline "foo")) diff --git a/test/instrument/attribute.t b/test/instrument/attribute.t index 2d542249..ab5d7c95 100644 --- a/test/instrument/attribute.t +++ b/test/instrument/attribute.t @@ -78,5 +78,4 @@ Non-coverage attributes are preserved uninstrumented. [@@@foo print_endline "bar"] let _ = () [@@foo print_endline "bar"] - let _ = () [@foo print_endline "bar"] diff --git a/test/instrument/class/class.t b/test/instrument/class/class.t index b09ce8c6..3acd4d59 100644 --- a/test/instrument/class/class.t +++ b/test/instrument/class/class.t @@ -22,9 +22,7 @@ Parameters are preserved. > end > EOF class foo_1 () = object end - class foo_2 ~l:_ = object end - class foo_3 ?l:_ () = object end diff --git a/test/instrument/control/lazy.t b/test/instrument/control/lazy.t index 9d4c0bf4..51bc036e 100644 --- a/test/instrument/control/lazy.t +++ b/test/instrument/control/lazy.t @@ -53,21 +53,13 @@ Trivial syntactic values are not instrumented. > let _ = lazy x > EOF let _ = lazy () - let _ = lazy false - let _ = lazy 0 - let _ = lazy 0. - let _ = lazy "" - let _ = lazy '0' - let _ = lazy [] - let _ = lazy None - let _ = lazy Exit let _ = @@ -84,9 +76,6 @@ Trivial syntactic values are not instrumented. ()) let _ = lazy (() : unit) - let _ = lazy (() :> unit) - let x = 1 + 1 - let _ = lazy x diff --git a/test/instrument/recent/exclusions.t b/test/instrument/recent/exclusions.t index 059b016c..e6e918b2 100644 --- a/test/instrument/recent/exclusions.t +++ b/test/instrument/recent/exclusions.t @@ -18,7 +18,6 @@ > let _f () = () > EOF $ dune build ./not_excluded.bc --instrument-with bisect_ppx 2>&1 | tail -n +2 - [@@@ocaml.ppx.context { tool_name = "ppx_driver"; include_dirs = []; @@ -52,7 +51,6 @@ let _f () = ___bisect_visit___ 0; () $ dune build ./excluded_1.bc --instrument-with bisect_ppx 2>&1 | tail -n +2 - [@@@ocaml.ppx.context { tool_name = "ppx_driver"; include_dirs = []; diff --git a/test/instrument/value.t b/test/instrument/value.t index 878f2674..ca1052d3 100644 --- a/test/instrument/value.t +++ b/test/instrument/value.t @@ -72,7 +72,6 @@ No instrumentation is inserted into expressions that are (syntactic) values. > let _ = Failure (String.concat "" []) > EOF let _ = Failure "foo" - let _ = Failure (___bisect_post_visit___ 0 (String.concat "" [])) @@ -87,7 +86,6 @@ No instrumentation is inserted into expressions that are (syntactic) values. > let _ = `Foo (print_endline "foo") > EOF let _ = `Foo "bar" - let _ = `Foo (___bisect_post_visit___ 0 (print_endline "foo")) @@ -96,7 +94,6 @@ No instrumentation is inserted into expressions that are (syntactic) values. > let _ = {contents = print_endline "foo"} > EOF let _ = { contents = 0 } - let _ = { contents = ___bisect_post_visit___ 0 (print_endline "foo") } @@ -171,7 +168,6 @@ No instrumentation is inserted into expressions that are (syntactic) values. > let _ = fun () -> (print_endline "foo" : unit) > EOF let _ = (0 : int) - let _ = (___bisect_post_visit___ 0 (print_endline "foo") : unit) let _ = @@ -194,7 +190,11 @@ No instrumentation is inserted into expressions that are (syntactic) values. let _ = (___bisect_post_visit___ 1 (f ()) :> [ `Foo | `Bar ]) - let _ = fun () -> (f () :> [ `Foo | `Bar ]) + let _ = + fun () -> + ___bisect_visit___ 2; + (f () :> [ `Foo | `Bar ]) + $ bash test.sh <<'EOF' diff --git a/test/js/bsconfig.json b/test/js/bsconfig.json index 26e9f647..e6361c34 100644 --- a/test/js/bsconfig.json +++ b/test/js/bsconfig.json @@ -1,10 +1,10 @@ { "name": "bisect_ppx-test", "bs-dependencies": [ - "bisect_ppx" + "@jfrolich/bisect_ppx" ], "ppx-flags": [ - "bisect_ppx/ppx" + "@jfrolich/bisect_ppx/ppx" ], "refmt": 3, "sources": ["."] diff --git a/test/js/package.json b/test/js/package.json index 736ae14a..4a668aa2 100644 --- a/test/js/package.json +++ b/test/js/package.json @@ -1,7 +1,7 @@ { "name": "bisect_ppx-test", "dependencies": { - "bisect_ppx": "file:package", + "@jfrolich/bisect_ppx": "file:package", "rescript": "^9.1.0", "esy": "^0.6.7" }, diff --git a/test/sigterm/sigterm.t b/test/sigterm/sigterm.t index 26ae763b..bbbe0a49 100644 --- a/test/sigterm/sigterm.t +++ b/test/sigterm/sigterm.t @@ -29,5 +29,5 @@ data when terminating normally: $ dune exec ./normal.exe $ bisect-ppx-report summary --verbose Info: found *.coverage files in './' - Coverage: 0/0 (0.00%) + Coverage: 0/0 (100.00%) $ rm bisect*.coverage