Skip to content

Commit d513789

Browse files
committed
CP-17268 Integrate bisect_ppx for coverage profiling.
Bisect dumps it report by registering a function through at_exit. This wasn't called by xenopsd. We added a handler to catch the SIGTERM signal used by the systemd service framework to stop the service. This leads to the profiling data being dumped. Signed-off-by: Christian Lindig <[email protected]>
1 parent b2c07f6 commit d513789

File tree

5 files changed

+156
-16
lines changed

5 files changed

+156
-16
lines changed

_oasis

Lines changed: 111 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,53 @@ Library xenopsd
2929
Findlibname: xenopsd
3030
ByteOpt: -warn-error +a
3131
NativeOpt: -warn-error +a
32-
Modules: Suspend_image, Cancellable_subprocess, Bootloader, Ionice, Mac, Xenops_migrate, Xenops_hooks, Task_server, Xenops_task, Updates, Xenops_utils, Xenops_server, Xenopsd, Xenops_server_plugin, Xenops_server_skeleton, Scheduler, Path, Storage, Interface, Xenctrl_uuid, Xenstore, Version
33-
BuildDepends: threads, threads.posix, uuidm, xmlm, cohttp, uri, rpclib, rpclib.syntax, forkexec, fd-send-recv, xcp, xcp.xen, xcp.storage, sexplib, sexplib.syntax, xcp, uutf, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, oclock
32+
Modules:
33+
Suspend_image,
34+
Cancellable_subprocess,
35+
Bootloader,
36+
Ionice,
37+
Mac,
38+
Xenops_migrate,
39+
Xenops_hooks,
40+
Task_server,
41+
Xenops_task,
42+
Updates,
43+
Xenops_utils,
44+
Xenops_server,
45+
Xenopsd,
46+
Xenops_server_plugin,
47+
Xenops_server_skeleton,
48+
Scheduler,
49+
Path,
50+
Storage,
51+
Interface,
52+
Xenctrl_uuid,
53+
Xenstore,
54+
Version
55+
BuildDepends:
56+
bisect_ppx,
57+
threads,
58+
threads.posix,
59+
uuidm,
60+
xmlm,
61+
cohttp,
62+
uri,
63+
rpclib,
64+
rpclib.syntax,
65+
forkexec,
66+
fd-send-recv,
67+
xcp,
68+
xcp.xen,
69+
xcp.storage,
70+
sexplib,
71+
sexplib.syntax,
72+
xcp,
73+
uutf,
74+
xenstore,
75+
xenstore.unix,
76+
xenstore_transport,
77+
xenstore_transport.unix,
78+
oclock
3479
CSources: sockopt_stubs.c
3580

3681
Executable set_domain_uuid
@@ -40,7 +85,11 @@ Executable set_domain_uuid
4085
NativeOpt: -warn-error +a-3
4186
MainIs: set_domain_uuid.ml
4287
Install: false
43-
BuildDepends: xenctrl, uuidm, cmdliner
88+
BuildDepends:
89+
bisect_ppx,
90+
xenctrl,
91+
uuidm,
92+
cmdliner
4493

4594
Executable suspend_image_viewer
4695
CompiledObject: best
@@ -49,7 +98,10 @@ Executable suspend_image_viewer
4998
NativeOpt: -warn-error +a-3
5099
MainIs: suspend_image_viewer.ml
51100
Install: false
52-
BuildDepends: xenopsd, cmdliner
101+
BuildDepends:
102+
bisect_ppx,
103+
xenopsd,
104+
cmdliner
53105

54106
Executable xenopsd_xc_main
55107
CompiledObject: best
@@ -60,7 +112,23 @@ Executable xenopsd_xc_main
60112
Build$: flag(xen)
61113
Custom: true
62114
Install: false
63-
BuildDepends: xenctrl, xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, rpclib, forkexec, xcp, xcp.storage, xcp.memory, xcp.rrd, rrd, sexplib, xcp-inventory
115+
BuildDepends:
116+
bisect_ppx,
117+
xenctrl,
118+
xenopsd,
119+
xenstore,
120+
xenstore.unix,
121+
xenstore_transport,
122+
xenstore_transport.unix,
123+
rpclib,
124+
forkexec,
125+
xcp,
126+
xcp.storage,
127+
xcp.memory,
128+
xcp.rrd,
129+
rrd,
130+
sexplib,
131+
xcp-inventory
64132
CSources: fsync_stubs.c, xenctrlext_stubs.c
65133

66134
Executable watch_test
@@ -70,7 +138,14 @@ Executable watch_test
70138
NativeOpt: -warn-error +a-3
71139
MainIs: watch_test.ml
72140
Install: false
73-
BuildDepends: xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, threads
141+
BuildDepends:
142+
bisect_ppx,
143+
xenopsd,
144+
xenstore,
145+
xenstore.unix,
146+
xenstore_transport,
147+
xenstore_transport.unix,
148+
threads
74149

75150
Executable xenopsd_simulator
76151
CompiledObject: best
@@ -81,7 +156,9 @@ Executable xenopsd_simulator
81156
Build$: flag(simulator)
82157
Custom: true
83158
Install: false
84-
BuildDepends: xenopsd
159+
BuildDepends:
160+
bisect_ppx,
161+
xenopsd
85162

86163
Executable xenopsd_libvirt_main
87164
CompiledObject: best
@@ -92,7 +169,15 @@ Executable xenopsd_libvirt_main
92169
Build$: flag(libvirt)
93170
Custom: true
94171
Install: false
95-
BuildDepends: xenopsd, rpclib, forkexec, xcp, xcp.storage, sexplib, libvirt
172+
BuildDepends:
173+
bisect_ppx,
174+
xenopsd,
175+
rpclib,
176+
forkexec,
177+
xcp,
178+
xcp.storage,
179+
sexplib,
180+
libvirt
96181

97182
Executable xenopsd_xenlight_main
98183
CompiledObject: best
@@ -103,6 +188,23 @@ Executable xenopsd_xenlight_main
103188
Build$: flag(xenlight)
104189
Custom: true
105190
Install: false
106-
BuildDepends: xenlight, xentoollog, xenctrl, xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, rpclib, forkexec, xcp, xcp.storage, xcp.memory, sexplib, xcp-inventory, optcomp
191+
BuildDepends:
192+
bisect_ppx,
193+
xenlight,
194+
xentoollog,
195+
xenctrl,
196+
xenopsd,
197+
xenstore,
198+
xenstore.unix,
199+
xenstore_transport,
200+
xenstore_transport.unix,
201+
rpclib,
202+
forkexec,
203+
xcp,
204+
xcp.storage,
205+
xcp.memory,
206+
sexplib,
207+
xcp-inventory,
208+
optcomp
107209
CSources: fsync_stubs.c, poll_stubs.c
108210

_tags

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 76fa96e6edac33c29cf074bb5b0859c0)
2+
# DO NOT EDIT (digest: bc2d8703604b2841004d3d8041cc1775)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -23,6 +23,7 @@ true: annot, bin_annot
2323
<lib/*.ml{,i,y}>: oasis_library_xenopsd_native
2424
"lib/sockopt_stubs.c": oasis_library_xenopsd_native
2525
<lib/xenopsd.{cma,cmxa}>: use_libxenopsd_stubs
26+
"lib/sockopt_stubs.c": pkg_bisect_ppx
2627
"lib/sockopt_stubs.c": pkg_cohttp
2728
"lib/sockopt_stubs.c": pkg_fd-send-recv
2829
"lib/sockopt_stubs.c": pkg_forkexec
@@ -49,9 +50,11 @@ true: annot, bin_annot
4950
<tools/*.ml{,i,y}>: oasis_executable_set_domain_uuid_byte
5051
<tools/set_domain_uuid.{native,byte}>: oasis_executable_set_domain_uuid_native
5152
<tools/*.ml{,i,y}>: oasis_executable_set_domain_uuid_native
53+
<tools/set_domain_uuid.{native,byte}>: pkg_bisect_ppx
5254
<tools/set_domain_uuid.{native,byte}>: pkg_cmdliner
5355
<tools/set_domain_uuid.{native,byte}>: pkg_uuidm
5456
<tools/set_domain_uuid.{native,byte}>: pkg_xenctrl
57+
<tools/*.ml{,i,y}>: pkg_bisect_ppx
5558
<tools/*.ml{,i,y}>: pkg_cmdliner
5659
<tools/*.ml{,i,y}>: pkg_uuidm
5760
<tools/*.ml{,i,y}>: pkg_xenctrl
@@ -60,6 +63,7 @@ true: annot, bin_annot
6063
<lib/*.ml{,i,y}>: oasis_executable_suspend_image_viewer_byte
6164
<lib/suspend_image_viewer.{native,byte}>: oasis_executable_suspend_image_viewer_native
6265
<lib/*.ml{,i,y}>: oasis_executable_suspend_image_viewer_native
66+
<lib/suspend_image_viewer.{native,byte}>: pkg_bisect_ppx
6367
<lib/suspend_image_viewer.{native,byte}>: pkg_cmdliner
6468
<lib/suspend_image_viewer.{native,byte}>: pkg_cohttp
6569
<lib/suspend_image_viewer.{native,byte}>: pkg_fd-send-recv
@@ -83,6 +87,7 @@ true: annot, bin_annot
8387
<lib/suspend_image_viewer.{native,byte}>: pkg_xenstore_transport.unix
8488
<lib/suspend_image_viewer.{native,byte}>: pkg_xmlm
8589
<lib/suspend_image_viewer.{native,byte}>: use_xenopsd
90+
<lib/*.ml{,i,y}>: pkg_bisect_ppx
8691
<lib/*.ml{,i,y}>: pkg_cmdliner
8792
<lib/*.ml{,i,y}>: pkg_cohttp
8893
<lib/*.ml{,i,y}>: pkg_fd-send-recv
@@ -116,6 +121,7 @@ true: annot, bin_annot
116121
"xc/fsync_stubs.c": oasis_executable_xenopsd_xc_main_native
117122
"xc/xenctrlext_stubs.c": oasis_executable_xenopsd_xc_main_native
118123
<xc/xenops_xc_main.{native,byte}>: use_libxenopsd_xc_main_stubs
124+
<xc/xenops_xc_main.{native,byte}>: pkg_bisect_ppx
119125
<xc/xenops_xc_main.{native,byte}>: pkg_cohttp
120126
<xc/xenops_xc_main.{native,byte}>: pkg_fd-send-recv
121127
<xc/xenops_xc_main.{native,byte}>: pkg_forkexec
@@ -148,6 +154,7 @@ true: annot, bin_annot
148154
<xc/*.ml{,i,y}>: pkg_xcp.memory
149155
<xc/*.ml{,i,y}>: pkg_xcp.rrd
150156
<xc/*.ml{,i,y}>: pkg_xenctrl
157+
"xc/fsync_stubs.c": pkg_bisect_ppx
151158
"xc/fsync_stubs.c": pkg_cohttp
152159
"xc/fsync_stubs.c": pkg_fd-send-recv
153160
"xc/fsync_stubs.c": pkg_forkexec
@@ -175,6 +182,7 @@ true: annot, bin_annot
175182
"xc/fsync_stubs.c": pkg_xenstore_transport.unix
176183
"xc/fsync_stubs.c": pkg_xmlm
177184
"xc/fsync_stubs.c": use_xenopsd
185+
"xc/xenctrlext_stubs.c": pkg_bisect_ppx
178186
"xc/xenctrlext_stubs.c": pkg_cohttp
179187
"xc/xenctrlext_stubs.c": pkg_fd-send-recv
180188
"xc/xenctrlext_stubs.c": pkg_forkexec
@@ -208,6 +216,7 @@ true: annot, bin_annot
208216
<xc/*.ml{,i,y}>: oasis_executable_watch_test_byte
209217
<xc/watch_test.{native,byte}>: oasis_executable_watch_test_native
210218
<xc/*.ml{,i,y}>: oasis_executable_watch_test_native
219+
<xc/watch_test.{native,byte}>: pkg_bisect_ppx
211220
<xc/watch_test.{native,byte}>: pkg_cohttp
212221
<xc/watch_test.{native,byte}>: pkg_fd-send-recv
213222
<xc/watch_test.{native,byte}>: pkg_forkexec
@@ -230,6 +239,7 @@ true: annot, bin_annot
230239
<xc/watch_test.{native,byte}>: pkg_xenstore_transport.unix
231240
<xc/watch_test.{native,byte}>: pkg_xmlm
232241
<xc/watch_test.{native,byte}>: use_xenopsd
242+
<xc/*.ml{,i,y}>: pkg_bisect_ppx
233243
<xc/*.ml{,i,y}>: pkg_cohttp
234244
<xc/*.ml{,i,y}>: pkg_fd-send-recv
235245
<xc/*.ml{,i,y}>: pkg_forkexec
@@ -257,6 +267,7 @@ true: annot, bin_annot
257267
<simulator/*.ml{,i,y}>: oasis_executable_xenopsd_simulator_byte
258268
<simulator/xenops_simulator_main.{native,byte}>: oasis_executable_xenopsd_simulator_native
259269
<simulator/*.ml{,i,y}>: oasis_executable_xenopsd_simulator_native
270+
<simulator/xenops_simulator_main.{native,byte}>: pkg_bisect_ppx
260271
<simulator/xenops_simulator_main.{native,byte}>: pkg_cohttp
261272
<simulator/xenops_simulator_main.{native,byte}>: pkg_fd-send-recv
262273
<simulator/xenops_simulator_main.{native,byte}>: pkg_forkexec
@@ -279,6 +290,7 @@ true: annot, bin_annot
279290
<simulator/xenops_simulator_main.{native,byte}>: pkg_xenstore_transport.unix
280291
<simulator/xenops_simulator_main.{native,byte}>: pkg_xmlm
281292
<simulator/xenops_simulator_main.{native,byte}>: use_xenopsd
293+
<simulator/*.ml{,i,y}>: pkg_bisect_ppx
282294
<simulator/*.ml{,i,y}>: pkg_cohttp
283295
<simulator/*.ml{,i,y}>: pkg_fd-send-recv
284296
<simulator/*.ml{,i,y}>: pkg_forkexec
@@ -307,6 +319,7 @@ true: annot, bin_annot
307319
<libvirt/*.ml{,i,y}>: oasis_executable_xenopsd_libvirt_main_byte
308320
<libvirt/xenops_libvirt_main.{native,byte}>: oasis_executable_xenopsd_libvirt_main_native
309321
<libvirt/*.ml{,i,y}>: oasis_executable_xenopsd_libvirt_main_native
322+
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_bisect_ppx
310323
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_cohttp
311324
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_fd-send-recv
312325
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_forkexec
@@ -330,6 +343,7 @@ true: annot, bin_annot
330343
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_xenstore_transport.unix
331344
<libvirt/xenops_libvirt_main.{native,byte}>: pkg_xmlm
332345
<libvirt/xenops_libvirt_main.{native,byte}>: use_xenopsd
346+
<libvirt/*.ml{,i,y}>: pkg_bisect_ppx
333347
<libvirt/*.ml{,i,y}>: pkg_cohttp
334348
<libvirt/*.ml{,i,y}>: pkg_fd-send-recv
335349
<libvirt/*.ml{,i,y}>: pkg_forkexec
@@ -364,6 +378,7 @@ true: annot, bin_annot
364378
"xl/fsync_stubs.c": oasis_executable_xenopsd_xenlight_main_native
365379
"xl/poll_stubs.c": oasis_executable_xenopsd_xenlight_main_native
366380
<xl/xenops_xl_main.{native,byte}>: use_libxenopsd_xenlight_main_stubs
381+
<xl/xenops_xl_main.{native,byte}>: pkg_bisect_ppx
367382
<xl/xenops_xl_main.{native,byte}>: pkg_cohttp
368383
<xl/xenops_xl_main.{native,byte}>: pkg_fd-send-recv
369384
<xl/xenops_xl_main.{native,byte}>: pkg_forkexec
@@ -392,6 +407,7 @@ true: annot, bin_annot
392407
<xl/xenops_xl_main.{native,byte}>: pkg_xentoollog
393408
<xl/xenops_xl_main.{native,byte}>: pkg_xmlm
394409
<xl/xenops_xl_main.{native,byte}>: use_xenopsd
410+
<xl/*.ml{,i,y}>: pkg_bisect_ppx
395411
<xl/*.ml{,i,y}>: pkg_cohttp
396412
<xl/*.ml{,i,y}>: pkg_fd-send-recv
397413
<xl/*.ml{,i,y}>: pkg_forkexec
@@ -420,6 +436,7 @@ true: annot, bin_annot
420436
<xl/*.ml{,i,y}>: pkg_xentoollog
421437
<xl/*.ml{,i,y}>: pkg_xmlm
422438
<xl/*.ml{,i,y}>: use_xenopsd
439+
"xl/fsync_stubs.c": pkg_bisect_ppx
423440
"xl/fsync_stubs.c": pkg_cohttp
424441
"xl/fsync_stubs.c": pkg_fd-send-recv
425442
"xl/fsync_stubs.c": pkg_forkexec
@@ -448,6 +465,7 @@ true: annot, bin_annot
448465
"xl/fsync_stubs.c": pkg_xentoollog
449466
"xl/fsync_stubs.c": pkg_xmlm
450467
"xl/fsync_stubs.c": use_xenopsd
468+
"xl/poll_stubs.c": pkg_bisect_ppx
451469
"xl/poll_stubs.c": pkg_cohttp
452470
"xl/poll_stubs.c": pkg_fd-send-recv
453471
"xl/poll_stubs.c": pkg_forkexec

lib/META

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 5586ee166df30de6e433138bcd3d4222)
2+
# DO NOT EDIT (digest: 0a7a90b9f68d35d7f16b955e0a87a0b0)
33
version = "0.12.0"
44
description = "XenServer domain managers"
55
requires =
6-
"threads threads.posix uuidm xmlm cohttp uri rpclib rpclib.syntax forkexec fd-send-recv xcp xcp.xen xcp.storage sexplib sexplib.syntax xcp uutf xenstore xenstore.unix xenstore_transport xenstore_transport.unix oclock"
6+
"bisect_ppx threads threads.posix uuidm xmlm cohttp uri rpclib rpclib.syntax forkexec fd-send-recv xcp xcp.xen xcp.storage sexplib sexplib.syntax xcp uutf xenstore xenstore.unix xenstore_transport xenstore_transport.unix oclock"
77
archive(byte) = "xenopsd.cma"
88
archive(byte, plugin) = "xenopsd.cma"
99
archive(native) = "xenopsd.cmxa"

lib/xenopsd.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,17 @@ let main backend =
133133
~rpc_fn
134134
() in
135135

136+
(** we need to catch this to make sure at_exit handlers are
137+
* triggered. In particuar, triggers for the bisect_ppx coverage
138+
* profiling *)
139+
140+
let signal_handler n =
141+
debug "caught signal %d" n; exit 0 in
142+
136143
Xcp_service.maybe_daemonize ();
137144

138145
Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
146+
Sys.set_signal Sys.sigterm (Sys.Signal_handle signal_handler);
139147

140148
Xenops_utils.set_fs_backend
141149
(Some (if !persist

0 commit comments

Comments
 (0)