summaryrefslogtreecommitdiffstats
path: root/tools/coverage/README.md
blob: a825a08e514b4a77a60bf7fb9717bd1226372959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Domain coverage report

## Introduction

During the PFW's life cycle, criteria states are changed and configurations are
applied.

This report gives the coverage for :

- Criterion: detect easily which criterion state aren't used.
- Configuration: detect configuration that are never applied.
- Configuration rule: part of the rules that are useless and could be removed.
- Total average coverage

Two things are needed to generate a coverage report:

1. The Settings file
2. parameter-framework logs

## How to get the Settings file

Usually, you have this file at hand.  But if getting the Settings file is
painful, you may use remote-process to print it:

    remote-process <host> <port> getDomainsWithSettingsXML > domains.xml

## How to get PFW logs

You must get the logs from the start of the parameter-framework.

On Android, you should stop the process instantiating the parameter-framework,
clear the logs, start the process and get the logs using logcat.  E.g:

    $ adb shell stop your_process
    $ adb logcat -c
    $ adb logcat > coverage.log &
    $ adb shell start your_process
    ... do your testing ...
    kill the background logcat started above

## How to generate the report

Then execute :

    $ aplog2coverage.sh -d domains.xml -e<some_regex> coverage.log -o coverageReport.html

You may pass several log files.

The regex (-e argument) is used to match relevant log lines: If you have
several PFW instances running, you need to have a way to tell which instance is
logging each line.  Besides, if accelerates the parsing by eliminating
irrelevant log lines.

You may pass the optional `-f` argument to ignore some parse errors.

### Limitations

- Having more than one dot (".") in log paths is not supported (see the sort
  implementation (sort -rn -k2 -t.) in aplog2coverage.sh).
- A PFW start log line must be at the head of the oldest log: no
  applyconfiguration or set criterion log should be found before the PFW start.