Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions COVERAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Coverage Analysis

This project can be compiled for coverage analysis using [bisect_ppx]. By
default, this is not done. To compile for coverage analysis, do:

make coverage
make

The `coverage` target adds the rules in `_tags.coverage` to the `_tags`
file, which in turn causes all code to be compiled for coverage
analysis. The `_tags.coverage` file could be tweaked to control which
files get instrumented.

## Support Files

See [profiling/coverage.ml](./profiling/coverage.ml) for the run-time
setup of coverage profiling. This code has no effect when not profiling
during execution. Once [bixect_ppx] has better defaults we could get rid
of it.

## Execution and Logging

During program execution, a binary writes coverage data to

/tmp/bisect-<binary>-*.out

This can be overridden by setting the `BISECT_FILE` environment
variable, which is otherwise set at startup using the code in
`profiling/coverage.ml`;

## Analysis

See the [bisect_ppx] documentation for details but try from the
top-level directory:

bisect-ppx-report -I _build -html coverage /tmp/bisect-*.out

This creates an HTML document in [coverage/](./coverage].

[bisect_ppx]: https://github.com/aantron/bisect_ppx




17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,20 @@ release:
grep -v 'warn-error' _oasis > _oasis.tmp
mv _oasis.tmp _oasis
oasis setup

# make coverage - prepares for building with coverage analysis
# make uncover - reverses the setup from "make coverage"
# make report - create coverage/index.html

coverage: _tags _tags.coverage
test ! -f _tags.orig && mv _tags _tags.orig || true
cat _tags.coverage _tags.orig > _tags

uncover: _tags.orig
mv _tags.orig _tags

report:
bisect-ppx-report -I _build -html coverage /tmp/bisect-xenops*out

.PHONY: report coverage uncover

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ xenopsd manages VMs running

and provides a simple RPC control interface to the layer above (typically xapi).

## Coverage Profiling

This code can be profiled for coverage. See [COVERAGE.md].


[COVERAGE.md]: ./COVERAGE.md

129 changes: 120 additions & 9 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,68 @@ Flag simulator
Description: Build server with simulator support
Default: true


# Support files for profiling
Library profiling
CompiledObject: best
Path: profiling
Install: false
Findlibname: profiling
Modules: Coverage
BuildDepends:

Library xenopsd
CompiledObject: best
Path: lib
Findlibname: xenopsd
ByteOpt: -warn-error +a
NativeOpt: -warn-error +a
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
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
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
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you have split these out onto separate lines! Much better for resolving merges. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to move to oasis setup -setup-update dynamic in a separate step. It is not in all projects straight forward but I have tested that the proposed method works in that context, too. It's done here: https://github.com/lindig/luna-rossa.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine. Let's make sure we come back to it before we wrap this work up.

CSources: sockopt_stubs.c

Executable set_domain_uuid
Expand All @@ -40,7 +94,11 @@ Executable set_domain_uuid
NativeOpt: -warn-error +a-3
MainIs: set_domain_uuid.ml
Install: false
BuildDepends: xenctrl, uuidm, cmdliner
BuildDepends:
xenctrl,
uuidm,
cmdliner,
profiling

Executable suspend_image_viewer
CompiledObject: best
Expand All @@ -49,7 +107,10 @@ Executable suspend_image_viewer
NativeOpt: -warn-error +a-3
MainIs: suspend_image_viewer.ml
Install: false
BuildDepends: xenopsd, cmdliner
BuildDepends:
xenopsd,
cmdliner,
profiling

Executable xenopsd_xc_main
CompiledObject: best
Expand All @@ -60,7 +121,23 @@ Executable xenopsd_xc_main
Build$: flag(xen)
Custom: true
Install: false
BuildDepends: xenctrl, xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, rpclib, forkexec, xcp, xcp.storage, xcp.memory, xcp.rrd, rrd, sexplib, xcp-inventory
BuildDepends:
xenctrl,
xenopsd,
xenstore,
xenstore.unix,
xenstore_transport,
xenstore_transport.unix,
rpclib,
forkexec,
xcp,
xcp.storage,
xcp.memory,
xcp.rrd,
rrd,
sexplib,
xcp-inventory,
profiling
CSources: fsync_stubs.c, xenctrlext_stubs.c

Executable watch_test
Expand All @@ -70,7 +147,14 @@ Executable watch_test
NativeOpt: -warn-error +a-3
MainIs: watch_test.ml
Install: false
BuildDepends: xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, threads
BuildDepends:
xenopsd,
xenstore,
xenstore.unix,
xenstore_transport,
xenstore_transport.unix,
threads,
profiling

Executable xenopsd_simulator
CompiledObject: best
Expand All @@ -81,7 +165,9 @@ Executable xenopsd_simulator
Build$: flag(simulator)
Custom: true
Install: false
BuildDepends: xenopsd
BuildDepends:
xenopsd,
profiling

Executable xenopsd_libvirt_main
CompiledObject: best
Expand All @@ -92,7 +178,15 @@ Executable xenopsd_libvirt_main
Build$: flag(libvirt)
Custom: true
Install: false
BuildDepends: xenopsd, rpclib, forkexec, xcp, xcp.storage, sexplib, libvirt
BuildDepends:
xenopsd,
rpclib,
forkexec,
xcp,
xcp.storage,
sexplib,
libvirt,
profiling

Executable xenopsd_xenlight_main
CompiledObject: best
Expand All @@ -103,6 +197,23 @@ Executable xenopsd_xenlight_main
Build$: flag(xenlight)
Custom: true
Install: false
BuildDepends: xenlight, xentoollog, xenctrl, xenopsd, xenstore, xenstore.unix, xenstore_transport, xenstore_transport.unix, rpclib, forkexec, xcp, xcp.storage, xcp.memory, sexplib, xcp-inventory, optcomp
BuildDepends:
xenlight,
xentoollog,
xenctrl,
xenopsd,
xenstore,
xenstore.unix,
xenstore_transport,
xenstore_transport.unix,
rpclib,
forkexec,
xcp,
xcp.storage,
xcp.memory,
sexplib,
xcp-inventory,
optcomp,
profiling
CSources: fsync_stubs.c, poll_stubs.c

Loading