OLD | NEW |
(Empty) | |
| 1 # -*- python -*- |
| 2 |
| 3 # Copyright 2009, Google Inc. |
| 4 # All rights reserved. |
| 5 # |
| 6 # Redistribution and use in source and binary forms, with or without |
| 7 # modification, are permitted provided that the following conditions are |
| 8 # met: |
| 9 # |
| 10 # * Redistributions of source code must retain the above copyright |
| 11 # notice, this list of conditions and the following disclaimer. |
| 12 # * Redistributions in binary form must reproduce the above |
| 13 # copyright notice, this list of conditions and the following disclaimer |
| 14 # in the documentation and/or other materials provided with the |
| 15 # distribution. |
| 16 # * Neither the name of Google Inc. nor the names of its |
| 17 # contributors may be used to endorse or promote products derived from |
| 18 # this software without specific prior written permission. |
| 19 # |
| 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 |
| 32 # Example configuration file for Croc |
| 33 |
| 34 # Basic formatting rules: |
| 35 # * It looks like JSON. |
| 36 # * It's really python. |
| 37 # * Dictionaries are wrapped in {}. Order does not matter. Entries are of |
| 38 # the form: |
| 39 # 'key':value, |
| 40 # Note the trailing comma, which will help save you from python's built-in |
| 41 # string concatenation. |
| 42 # * Lists are wrapped in []. Order does matter. Entries should be followed |
| 43 # with a trailing comma, which will help save you from python's built-in |
| 44 # string concatenation. |
| 45 # * Comments start with # and extend to end of line. |
| 46 # * Strings are wrapped in ''. Backslashes must be escaped ('foo\\bar', not |
| 47 # 'foo\bar') - this is particularly important in rule regular expressions. |
| 48 |
| 49 |
| 50 # What follows is the main configuration dictionary. |
| 51 { |
| 52 # List of root directories, applied in order. |
| 53 # |
| 54 # Typically, coverage data files contain absolute paths to the sources. |
| 55 # What you care about is usually a relative path from the top of your source |
| 56 # tree (referred to here as a 'source root') to the sources. |
| 57 # |
| 58 # Roots may also be specified on the command line via the --root option. |
| 59 # Roots specified by --root are applied before those specified in config |
| 60 # files. |
| 61 'roots' : [ |
| 62 # Each entry is a dict. |
| 63 # * It must contain a 'root' entry, which is the start of a path. |
| 64 # * Root entries may be absolute paths |
| 65 # * Root entries starting with './' or '../' are relative paths, and |
| 66 # are taken relative to the current directory where you run croc. |
| 67 # * Root entries may start with previously defined altnames. |
| 68 # * Use '/' as a path separator, even on Windows. |
| 69 # * It may contain a 'altname' entry. If the root matches the start of |
| 70 # a filename, that start is replaced with the 'altname', or with '_' |
| 71 # if no default is specified. |
| 72 # * Multiple root entries may share the same altname. This is commonly |
| 73 # used when combining LCOV files from different platforms into one |
| 74 # coverage report, when each platform checks out source code into a |
| 75 # different source tree. |
| 76 {'root' : 'c:/P4/EarthHammer'}, |
| 77 {'root' : 'd:/pulse/recipes/330137642/base'}, |
| 78 {'root' : '/Volumes/BuildData/PulseData/data/recipes/330137640/base'}, |
| 79 {'root' : '/usr/local/google/builder/.pulse-agent/data/recipes/330137641/bas
e'}, |
| 80 |
| 81 # Sub-paths we specifically care about and want to call out. Note that |
| 82 # these are relative to the default '_' altname. |
| 83 { |
| 84 'root' : '_/googleclient/third_party/software_construction_toolkit/files', |
| 85 'altname' : 'SCT', |
| 86 }, |
| 87 { |
| 88 'root' : '_/googleclient/tools/hammer', |
| 89 'altname' : 'HAMMER', |
| 90 }, |
| 91 ], |
| 92 |
| 93 # List of rules, applied in order. |
| 94 'rules' : [ |
| 95 # Each rule is a dict. |
| 96 # * It must contaihn a 'regexp' entry. Filenames which match this |
| 97 # regular expression (after applying mappings from 'roots') are |
| 98 # affected by the rule. |
| 99 # |
| 100 # * Other entries in the dict are attributes to apply to matching files. |
| 101 # |
| 102 # Allowed attributes: |
| 103 # |
| 104 # 'include' : If 1, the file will be included in coverage reports. If 0, |
| 105 # it won't be included in coverage reports. |
| 106 # |
| 107 # 'group' : Name of the group the file belongs to. The most common |
| 108 # group names are 'source' and 'test'. Files must belong to |
| 109 # a group to be included in coverage reports. |
| 110 # |
| 111 # 'language' : Programming language for the file. The most common |
| 112 # languages are 'C', 'C++', 'python', 'ObjC', 'ObjC++'. |
| 113 # Files must have a language to be included in coverage |
| 114 # reports. |
| 115 # |
| 116 # 'add_if_missing' : If 1, and the file was not referenced by any LCOV |
| 117 # files, it will be be scanned for executable lines |
| 118 # and added to the coverage report. If 0, if the |
| 119 # file is not referenced by any LCOV files, it will |
| 120 # simply be ignored and not present in coverage |
| 121 # reports. |
| 122 |
| 123 # Files/paths to include |
| 124 { |
| 125 'regexp' : '^(SCT|HAMMER)/', |
| 126 'include' : 1, |
| 127 'add_if_missing': 1, |
| 128 }, |
| 129 { |
| 130 'regexp' : '.*/(\\.svn|\\.hg)/', |
| 131 'include' : 0, |
| 132 }, |
| 133 |
| 134 # Groups |
| 135 { |
| 136 'regexp' : '', |
| 137 'group' : 'source', |
| 138 }, |
| 139 { |
| 140 'regexp' : '.*_(test|test_mac|unittest)\\.', |
| 141 'group' : 'test', |
| 142 }, |
| 143 |
| 144 # Languages |
| 145 { |
| 146 'regexp' : '.*\\.py$', |
| 147 'language' : 'python', |
| 148 }, |
| 149 ], |
| 150 |
| 151 # List of paths to add source from. |
| 152 # |
| 153 # Each entry is a path. It may be a local path, or one relative to a root |
| 154 # altname (see 'roots' above). |
| 155 # |
| 156 # If more than one root's altname matches the start of this path, all matches |
| 157 # will be attempted; matches where the candidate directory doesn't exist will |
| 158 # be ignored. For example, if you're combining data from multiple platforms' |
| 159 # LCOV files, you probably defined at least one root per LCOV, but only have |
| 160 # one copy of the source on your local platform. That's fine; Croc will use |
| 161 # the source it can find and not worry about the source it can't. |
| 162 # |
| 163 # Source files must be added via 'add_files' to generate line-by-line HTML |
| 164 # output (via the --html option) and/or to scan for missing executable lines |
| 165 # (if 'add_if_missing' is 1). |
| 166 'add_files' : [ |
| 167 'SCT', |
| 168 'HAMMER', |
| 169 ], |
| 170 |
| 171 # Statistics to print. |
| 172 # |
| 173 'print_stats' : [ |
| 174 # Each entry is a dict. |
| 175 # |
| 176 # It must have a 'stat' entry, which is the statistic to print. This may |
| 177 # be one of the following stats: |
| 178 # |
| 179 # * files_executable |
| 180 # * files_instrumented |
| 181 # * files_covered |
| 182 # * lines_executable |
| 183 # * lines_instrumented |
| 184 # * lines_covered |
| 185 # |
| 186 # or an expression using those stats. |
| 187 # |
| 188 # It may have a 'format' entry, which is a python formatting string (very |
| 189 # printf-like) for the statistic. |
| 190 # |
| 191 # It may have a 'group' entry. If this is specified, only files from the |
| 192 # matching group will be included in the statistic. If not specified, the |
| 193 # group defaults to 'all', which means all groups. |
| 194 { |
| 195 'stat' : 'files_executable', |
| 196 'format' : '*RESULT FilesKnown: files_executable= %d files', |
| 197 }, |
| 198 { |
| 199 'stat' : 'files_instrumented', |
| 200 'format' : '*RESULT FilesInstrumented: files_instrumented= %d files', |
| 201 }, |
| 202 { |
| 203 'stat' : '100.0 * files_instrumented / files_executable', |
| 204 'format' : '*RESULT FilesInstrumentedPercent: files_instrumented_percent=
%g', |
| 205 }, |
| 206 { |
| 207 'stat' : 'lines_instrumented', |
| 208 'format' : '*RESULT LinesInstrumented: lines_instrumented= %d lines', |
| 209 }, |
| 210 { |
| 211 'stat' : 'lines_covered', |
| 212 'format' : '*RESULT LinesCoveredSource: lines_covered_source= %d lines', |
| 213 'group' : 'source', |
| 214 }, |
| 215 { |
| 216 'stat' : 'lines_covered', |
| 217 'format' : '*RESULT LinesCoveredTest: lines_covered_test= %d lines', |
| 218 'group' : 'test', |
| 219 }, |
| 220 ], |
| 221 |
| 222 } |
OLD | NEW |