- add sources.
[platform/framework/web/crosswalk.git] / src / tools / code_coverage / example.croc
1 # -*- python -*-\r
2 \r
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.\r
4 # Use of this source code is governed by a BSD-style license that can be\r
5 # found in the LICENSE file.\r
6 \r
7 # Example configuration file for Croc\r
8 \r
9 # Basic formatting rules:\r
10 #   * It looks like JSON.\r
11 #   * It's really python.\r
12 #   * Dictionaries are wrapped in {}.  Order does not matter.  Entries are of\r
13 #     the form:\r
14 #         'key':value,\r
15 #     Note the trailing comma, which will help save you from python's built-in\r
16 #     string concatenation.\r
17 #   * Lists are wrapped in [].  Order does matter.  Entries should be followed\r
18 #     with a trailing comma, which will help save you from python's built-in\r
19 #     string concatenation.\r
20 #   * Comments start with # and extend to end of line.\r
21 #   * Strings are wrapped in ''.  Backslashes must be escaped ('foo\\bar', not\r
22 #     'foo\bar') - this is particularly important in rule regular expressions.\r
23 \r
24 \r
25 # What follows is the main configuration dictionary.\r
26 {\r
27   # List of root directories, applied in order.\r
28   #\r
29   # Typically, coverage data files contain absolute paths to the sources.\r
30   # What you care about is usually a relative path from the top of your source\r
31   # tree (referred to here as a 'source root') to the sources.\r
32   #\r
33   # Roots may also be specified on the command line via the --root option.\r
34   # Roots specified by --root are applied before those specified in config\r
35   # files.\r
36   'roots' : [\r
37     # Each entry is a dict.\r
38     #     * It must contain a 'root' entry, which is the start of a path.\r
39     #         * Root entries may be absolute paths\r
40     #         * Root entries starting with './' or '../' are relative paths, and\r
41     #           are taken relative to the current directory where you run croc.\r
42     #         * Root entries may start with previously defined altnames.\r
43     #         * Use '/' as a path separator, even on Windows.\r
44     #     * It may contain a 'altname' entry.  If the root matches the start of\r
45     #        a filename, that start is replaced with the 'altname', or with '_'\r
46     #        if no default is specified.\r
47     #     * Multiple root entries may share the same altname.  This is commonly\r
48     #       used when combining LCOV files from different platforms into one\r
49     #       coverage report, when each platform checks out source code into a\r
50     #       different source tree.\r
51     {'root' : 'c:/P4/EarthHammer'},\r
52     {'root' : 'd:/pulse/recipes/330137642/base'},\r
53     {'root' : '/Volumes/BuildData/PulseData/data/recipes/330137640/base'},\r
54     {'root' : '/usr/local/google/builder/.pulse-agent/data/recipes/330137641/base'},\r
55 \r
56     # Sub-paths we specifically care about and want to call out.  Note that\r
57     # these are relative to the default '_' altname.\r
58     {\r
59       'root' : '_/googleclient/third_party/software_construction_toolkit/files',\r
60       'altname' : 'SCT',\r
61     },\r
62     {\r
63       'root' : '_/googleclient/tools/hammer',\r
64       'altname' : 'HAMMER',\r
65     },\r
66   ],\r
67 \r
68   # List of rules, applied in order.\r
69   'rules' : [\r
70     # Each rule is a dict.\r
71     #   * It must contaihn a 'regexp' entry.  Filenames which match this\r
72     #     regular expression (after applying mappings from 'roots') are\r
73     #     affected by the rule.\r
74     #\r
75     #   * Other entries in the dict are attributes to apply to matching files.\r
76     #\r
77     # Allowed attributes:\r
78     #\r
79     #   'include' : If 1, the file will be included in coverage reports.  If 0,\r
80     #               it won't be included in coverage reports.\r
81     #\r
82     #   'group' : Name of the group the file belongs to.  The most common\r
83     #             group names are 'source' and 'test'.  Files must belong to\r
84     #             a group to be included in coverage reports.\r
85     #\r
86     #   'language' : Programming language for the file.  The most common\r
87     #                languages are 'C', 'C++', 'python', 'ObjC', 'ObjC++'.\r
88     #                Files must have a language to be included in coverage\r
89     #                reports.\r
90     #\r
91     #   'add_if_missing' : If 1, and the file was not referenced by any LCOV\r
92     #                      files, it will be be scanned for executable lines\r
93     #                      and added to the coverage report.  If 0, if the\r
94     #                      file is not referenced by any LCOV files, it will\r
95     #                      simply be ignored and not present in coverage\r
96     #                      reports.\r
97 \r
98     # Files/paths to include\r
99     {\r
100       'regexp' : '^(SCT|HAMMER)/',\r
101       'include' : 1,\r
102       'add_if_missing': 1,\r
103     },\r
104     {\r
105       'regexp' : '.*/(\\.svn|\\.hg)/',\r
106       'include' : 0,\r
107     },\r
108 \r
109     # Groups\r
110     {\r
111       'regexp' : '',\r
112       'group' : 'source',\r
113     },\r
114     {\r
115       'regexp' : '.*_(test|test_mac|unittest)\\.',\r
116       'group' : 'test',\r
117     },\r
118 \r
119     # Languages\r
120     {\r
121       'regexp' : '.*\\.py$',\r
122       'language' : 'python',\r
123     },\r
124   ],\r
125 \r
126   # List of paths to add source from.\r
127   #\r
128   # Each entry is a path.  It may be a local path, or one relative to a root\r
129   # altname (see 'roots' above).\r
130   #\r
131   # If more than one root's altname matches the start of this path, all matches\r
132   # will be attempted; matches where the candidate directory doesn't exist will\r
133   # be ignored.  For example, if you're combining data from multiple platforms'\r
134   # LCOV files, you probably defined at least one root per LCOV, but only have\r
135   # one copy of the source on your local platform.  That's fine; Croc will use\r
136   # the source it can find and not worry about the source it can't.\r
137   #\r
138   # Source files must be added via 'add_files' to generate line-by-line HTML\r
139   # output (via the --html option) and/or to scan for missing executable lines\r
140   # (if 'add_if_missing' is 1).\r
141   'add_files' : [\r
142     'SCT',\r
143     'HAMMER',\r
144   ],\r
145 \r
146   # Statistics to print.\r
147   #\r
148   'print_stats' : [\r
149     # Each entry is a dict.\r
150     #\r
151     # It must have a 'stat' entry, which is the statistic to print.  This may\r
152     # be one of the following stats:\r
153     #\r
154     #   * files_executable\r
155     #   * files_instrumented\r
156     #   * files_covered\r
157     #   * lines_executable\r
158     #   * lines_instrumented\r
159     #   * lines_covered\r
160     #\r
161     # or an expression using those stats.\r
162     #\r
163     # It may have a 'format' entry, which is a python formatting string (very\r
164     # printf-like) for the statistic.\r
165     #\r
166     # It may have a 'group' entry.  If this is specified, only files from the\r
167     # matching group will be included in the statistic.  If not specified, the\r
168     # group defaults to 'all', which means all groups.\r
169     {\r
170       'stat' : 'files_executable',\r
171       'format' : '*RESULT FilesKnown: files_executable= %d files',\r
172     },\r
173     {\r
174       'stat' : 'files_instrumented',\r
175       'format' : '*RESULT FilesInstrumented: files_instrumented= %d files',\r
176     },\r
177     {\r
178       'stat' : '100.0 * files_instrumented / files_executable',\r
179       'format' : '*RESULT FilesInstrumentedPercent: files_instrumented_percent= %g',\r
180     },\r
181     {\r
182       'stat' : 'lines_instrumented',\r
183       'format' : '*RESULT LinesInstrumented: lines_instrumented= %d lines',\r
184     },\r
185     {\r
186       'stat' : 'lines_covered',\r
187       'format' : '*RESULT LinesCoveredSource: lines_covered_source= %d lines',\r
188       'group' : 'source',\r
189     },\r
190     {\r
191       'stat' : 'lines_covered',\r
192       'format' : '*RESULT LinesCoveredTest: lines_covered_test= %d lines',\r
193       'group' : 'test',\r
194     },\r
195   ],\r
196 \r
197 }\r