Skip to content

Commit e970a0b

Browse files
committed
CP-17268 simplify finding tmpdir, fix indentation
Signed-off-by: Christian Lindig <[email protected]>
1 parent 56d49e3 commit e970a0b

File tree

4 files changed

+18
-32
lines changed

4 files changed

+18
-32
lines changed

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,9 @@ release:
9898
mv _oasis.tmp _oasis
9999
oasis setup
100100

101-
# make coverage
102-
# prepares for building with coverage analysis
103-
#
104-
# make uncover
105-
# reverses the setup from "make coverage"
101+
# make coverage - prepares for building with coverage analysis
102+
# make uncover - reverses the setup from "make coverage"
103+
# make report - create coverage/index.html
106104

107105
coverage: _tags _tags.coverage
108106
test ! -f _tags.orig && mv _tags _tags.orig || true
@@ -111,5 +109,8 @@ coverage: _tags _tags.coverage
111109
uncover: _tags.orig
112110
mv _tags.orig _tags
113111

114-
.PHONY: default coverage uncover
112+
report:
113+
bisect-ppx-report -I _build -html coverage /tmp/bisect-xenops*out
114+
115+
.PHONY: report coverage uncover
115116

libvirt/xenops_libvirt_main.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ let specific_essential_paths = Path.hvm_guests @ Path.network_configuration
1616

1717
(* Start the program with the libvirt backend *)
1818
let _ =
19-
Coverage.init "xenopsd-libvirt";
19+
Coverage.init "xenopsd-libvirt";
2020
Xenops_interface.queue_name := !Xenops_interface.queue_name ^ ".libvirt";
2121
Xenops_utils.set_root "xenopsd/libvirt";
2222
Xenopsd.configure
2323
~specific_essential_paths
2424
();
2525
Xenopsd.main
2626
(module Xenops_server_libvirt: Xenops_server_plugin.S)
27+
28+
(* vim: ts=2 sw=2 noet *)

profiling/coverage.ml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,16 @@
33
* where log files are written.
44
*)
55

6-
let (//) = Filename.concat
7-
8-
let is_dir = function
9-
| "" -> false
10-
| path -> try Sys.is_directory path with Sys_error _ -> false
11-
12-
(* [tmpdir] points to a directory for temporary files *)
13-
let tmpdir =
14-
let getenv n = try Sys.getenv n with Not_found -> "" in
15-
let dirs =
16-
[ getenv "TMP"
17-
; getenv "TEMP"
18-
; "/tmp"
19-
; "/usr/tmp"
20-
; "/var/tmp"
21-
] in
22-
try
23-
List.find is_dir dirs
24-
with
25-
Not_found -> failwith "can't find temp directory "^__LOC__
266

277
(** [init name] sets up coverage profiling for binary [name]. You could
288
* use [Sys.argv.(0)] for [name].
299
*)
10+
3011
let init name =
31-
try
32-
ignore (Sys.getenv "BISECT_FILE")
33-
with Not_found ->
34-
Unix.putenv "BISECT_FILE" (tmpdir // Printf.sprintf "bisect-%s-" name)
12+
let (//) = Filename.concat in
13+
let tmpdir = Filename.get_temp_dir_name () in
14+
try
15+
ignore (Sys.getenv "BISECT_FILE")
16+
with Not_found ->
17+
Unix.putenv "BISECT_FILE" (tmpdir // Printf.sprintf "bisect-%s-" name)
3518

simulator/xenops_simulator_main.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
(* Start the program with the simulator backend *)
1616
let _ =
17-
Coverage.init "xenops-simulator";
17+
Coverage.init "xenops-simulator";
1818
Xenops_interface.queue_name := !Xenops_interface.queue_name ^ ".simulator";
1919
Xenops_utils.set_root "xenopsd/simulator";
2020
Xenopsd.configure ();

0 commit comments

Comments
 (0)