|
5 | 5 | <header> |
6 | 6 | <copyright> |
7 | 7 | <year>2001</year> |
8 | | - <year>2013</year> |
| 8 | + <year>2015</year> |
9 | 9 | <holder>Ericsson AB, All Rights Reserved</holder> |
10 | 10 | </copyright> |
11 | 11 | <legalnotice> |
|
138 | 138 | </desc> |
139 | 139 | </func> |
140 | 140 | <func> |
141 | | - <name>compile(ModFile) -> Result</name> |
142 | | - <name>compile(ModFile, Options) -> Result</name> |
143 | | - <name>compile_module(ModFile) -> Result</name> |
144 | | - <name>compile_module(ModFile, Options) -> Result</name> |
145 | | - <fsummary>Compile a module for Cover analysis.</fsummary> |
| 141 | + <name>compile(ModFiles) -> Result | [Result]</name> |
| 142 | + <name>compile(ModFiles, Options) -> Result | [Result]</name> |
| 143 | + <name>compile_module(ModFiles) -> Result | [Result]</name> |
| 144 | + <name>compile_module(ModFiles, Options) -> Result | [Result]</name> |
| 145 | + <fsummary>Compile one or more modules for Cover analysis.</fsummary> |
146 | 146 | <type> |
| 147 | + <v>ModFiles = ModFile | [ModFile]</v> |
147 | 148 | <v>ModFile = Module | File</v> |
148 | 149 | <v> Module = atom()</v> |
149 | 150 | <v> File = string()</v> |
150 | 151 | <v>Options = [Option]</v> |
151 | | - <v> Option = {i,Dir} | {d,Macro} | {d,Macro,Value}</v> |
| 152 | + <v> Option = {i,Dir} | {d,Macro} | {d,Macro,Value} | export_all</v> |
152 | 153 | <d>See <c>compile:file/2.</c></d> |
153 | 154 | <v>Result = {ok,Module} | {error,File} | {error,not_main_node}</v> |
154 | 155 | </type> |
|
165 | 166 | returns <c>{ok,Module}</c>. Otherwise the function returns |
166 | 167 | <c>{error,File}</c>. Errors and warnings are printed as they |
167 | 168 | occur.</p> |
| 169 | + <p>If a list of <c>ModFiles</c> is given as input, a list |
| 170 | + of <c>Result</c> will be returned. The order of the returned |
| 171 | + list is undefined.</p> |
168 | 172 | <p>Note that the internal database is (re-)initiated during |
169 | 173 | the compilation, meaning any previously collected coverage data |
170 | 174 | for the module will be lost.</p> |
|
194 | 198 | </desc> |
195 | 199 | </func> |
196 | 200 | <func> |
197 | | - <name>compile_beam(ModFile) -> Result</name> |
198 | | - <fsummary>Compile a module for Cover analysis, using an existing beam.</fsummary> |
| 201 | + <name>compile_beam(ModFiles) -> Result | [Result]</name> |
| 202 | + <fsummary>Compile one or more modules for Cover analysis, using existing beam(s).</fsummary> |
199 | 203 | <type> |
| 204 | + <v>ModFiles = ModFile | [ModFile]</v> |
200 | 205 | <v>ModFile = Module | BeamFile</v> |
201 | 206 | <v> Module = atom()</v> |
202 | 207 | <v> BeamFile = string()</v> |
|
229 | 234 | returned.</p> |
230 | 235 | <p><c>{error,BeamFile}</c> is returned if the compiled code |
231 | 236 | can not be loaded on the node.</p> |
| 237 | + <p>If a list of <c>ModFiles</c> is given as input, a list |
| 238 | + of <c>Result</c> will be returned. The order of the returned |
| 239 | + list is undefined.</p> |
232 | 240 | </desc> |
233 | 241 | </func> |
234 | 242 | <func> |
|
251 | 259 | </desc> |
252 | 260 | </func> |
253 | 261 | <func> |
254 | | - <name>analyse(Module) -> {ok,Answer} | {error,Error}</name> |
255 | | - <name>analyse(Module, Analysis) -> {ok,Answer} | {error,Error}</name> |
256 | | - <name>analyse(Module, Level) -> {ok,Answer} | {error,Error}</name> |
257 | | - <name>analyse(Module, Analysis, Level) -> {ok,Answer} | {error,Error}</name> |
258 | | - <fsummary>Analyse a Cover compiled module.</fsummary> |
| 262 | + <name>analyse() -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 263 | + <name>analyse(Modules) -> OneResult | {result,Ok,Fail} | {error,not_main_node}</name> |
| 264 | + <name>analyse(Analysis) -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 265 | + <name>analyse(Level) -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 266 | + <name>analyse(Modules, Analysis) -> OneResult | {result,Ok,Fail} | {error,not_main_node}</name> |
| 267 | + <name>analyse(Modules, Level) -> OneResult | {result,Ok,Fail} | {error,not_main_node}</name> |
| 268 | + <name>analyse(Analysis, Level) -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 269 | + <name>analyse(Modules, Analysis, Level) -> OneResult | {result,Ok,Fail} | {error,not_main_node}</name> |
| 270 | + <fsummary>Analyse one or more Cover compiled modules.</fsummary> |
259 | 271 | <type> |
260 | | - <v>Module = atom()</v> |
| 272 | + <v>Modules = Module | [Module]</v> |
| 273 | + <v>Module = atom() </v> |
261 | 274 | <v>Analysis = coverage | calls</v> |
262 | 275 | <v>Level = line | clause | function | module</v> |
263 | | - <v>Answer = {Module,Value} | [{Item,Value}]</v> |
| 276 | + <v>OneResult = {ok,{Module,Value}} | {ok,[{Item,Value}]} | {error, Error}</v> |
264 | 277 | <v> Item = Line | Clause | Function</v> |
265 | 278 | <v> Line = {M,N}</v> |
266 | 279 | <v> Clause = {M,F,A,C}</v> |
|
269 | 282 | <v> N = A = C = integer()</v> |
270 | 283 | <v> Value = {Cov,NotCov} | Calls</v> |
271 | 284 | <v> Cov = NotCov = Calls = integer()</v> |
272 | | - <v>Error = {not_cover_compiled,Module} | not_main_node</v> |
| 285 | + <v> Error = {not_cover_compiled,Module}</v> |
| 286 | + <v>Ok = [{Module,Value}] | [{Item,Value}]</v> |
| 287 | + <v>Fail = [Error]</v> |
273 | 288 | </type> |
274 | 289 | <desc> |
275 | | - <p>Performs analysis of a Cover compiled module <c>Module</c>, as |
| 290 | + <p>Performs analysis of one or more Cover compiled modules, as |
276 | 291 | specified by <c>Analysis</c> and <c>Level</c> (see above), by |
277 | 292 | examining the contents of the internal database.</p> |
278 | 293 | <p><c>Analysis</c> defaults to <c>coverage</c> and <c>Level</c> |
279 | 294 | defaults to <c>function</c>.</p> |
280 | | - <p>If <c>Module</c> is not Cover compiled, the function returns |
281 | | - <c>{error,{not_cover_compiled,Module}}</c>.</p> |
282 | | - <p>HINT: It is possible to issue multiple analyse_to_file commands at |
283 | | - the same time. </p> |
| 295 | + <p>If <c>Modules</c> is an atom (one module), the return will |
| 296 | + be <c>OneResult</c>, else the return will be |
| 297 | + <c>{result,Ok,Fail}</c>.</p> |
| 298 | + <p>If <c>Modules</c> is not given, all modules that have data |
| 299 | + in the cover data table, are analysed. Note that this |
| 300 | + includes both cover compiled modules and imported |
| 301 | + modules.</p> |
| 302 | + <p>If a given module is not Cover compiled, this is indicated |
| 303 | + by the error reason <c>{not_cover_compiled,Module}</c>.</p> |
284 | 304 | </desc> |
285 | 305 | </func> |
286 | 306 | <func> |
287 | | - <name>analyse_to_file(Module) -> </name> |
288 | | - <name>analyse_to_file(Module,Options) -> </name> |
289 | | - <name>analyse_to_file(Module, OutFile) -> </name> |
290 | | - <name>analyse_to_file(Module, OutFile, Options) -> {ok,OutFile} | {error,Error}</name> |
291 | | - <fsummary>Detailed coverage analysis of a Cover compiled module.</fsummary> |
| 307 | + <name>analyse_to_file() -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 308 | + <name>analyse_to_file(Modules) -> Answer | {result,Ok,Fail} | {error,not_main_node}</name> |
| 309 | + <name>analyse_to_file(Options) -> {result,Ok,Fail} | {error,not_main_node}</name> |
| 310 | + <name>analyse_to_file(Modules,Options) -> Answer | {result,Ok,Fail} | {error,not_main_node}</name> |
| 311 | + <fsummary>Detailed coverage analysis of one or more Cover compiled modules.</fsummary> |
292 | 312 | <type> |
| 313 | + <v>Modules = Module | [Module]</v> |
293 | 314 | <v>Module = atom()</v> |
294 | | - <v>OutFile = string()</v> |
| 315 | + <v>OutFile = OutDir = string()</v> |
295 | 316 | <v>Options = [Option]</v> |
296 | | - <v>Option = html</v> |
297 | | - <v>Error = {not_cover_compiled,Module} | {file,File,Reason} | no_source_code_found | not_main_node</v> |
| 317 | + <v>Option = html | {outfile,OutFile} | {outdir,OutDir}</v> |
| 318 | + <v>Answer = {ok,OutFile} | {error,Error}</v> |
| 319 | + <v>Ok = [OutFile]</v> |
| 320 | + <v>Fail = [Error]</v> |
| 321 | + <v>Error = {not_cover_compiled,Module} | {file,File,Reason} | {no_source_code_found,Module}</v> |
298 | 322 | <v> File = string()</v> |
299 | 323 | <v> Reason = term()</v> |
300 | 324 | </type> |
301 | 325 | <desc> |
302 | | - <p>Makes a copy <c>OutFile</c> of the source file for a module |
303 | | - <c>Module</c>, where it for each executable line is specified |
| 326 | + <p>Makes copies of the source file for the given modules, |
| 327 | + where it for each executable line is specified |
304 | 328 | how many times it has been executed.</p> |
305 | 329 | <p>The output file <c>OutFile</c> defaults to |
306 | 330 | <c>Module.COVER.out</c>, or <c>Module.COVER.html</c> if the |
307 | 331 | option <c>html</c> was used.</p> |
308 | | - <p>If <c>Module</c> is not Cover compiled, the function returns |
309 | | - <c>{error,{not_cover_compiled,Module}}</c>.</p> |
| 332 | + <p>If <c>Modules</c> is an atom (one module), the return will |
| 333 | + be <c>Answer</c>, else the return will be a |
| 334 | + list, <c>{result,Ok,Fail}</c>.</p> |
| 335 | + <p>If <c>Modules</c> is not given, all modules that have data |
| 336 | + in the cover data table, are analysed. Note that this |
| 337 | + includes both cover compiled modules and imported |
| 338 | + modules.</p> |
| 339 | + <p>If a module is not Cover compiled, this is indicated by the |
| 340 | + error reason <c>{not_cover_compiled,Module}</c>.</p> |
310 | 341 | <p>If the source file and/or the output file cannot be opened using |
311 | 342 | <c>file:open/2</c>, the function returns |
312 | 343 | <c>{error,{file,File,Reason}}</c> where <c>File</c> is the file |
313 | 344 | name and <c>Reason</c> is the error reason.</p> |
314 | | - <p>If the module was cover compiled from the <c>.beam</c> |
| 345 | + <p>If a module was cover compiled from the <c>.beam</c> |
315 | 346 | file, i.e. using <c>compile_beam/1</c> or |
316 | 347 | <c>compile_beam_directory/0,1</c>, it is assumed that the |
317 | 348 | source code can be found in the same directory as the |
|
322 | 353 | joining <c>../src</c> and the tail of the compiled path |
323 | 354 | below a trailing <c>src</c> component, then the compiled |
324 | 355 | path itself. |
325 | | - If no source code is found, |
326 | | - <c>{error,no_source_code_found}</c> is returned.</p> |
327 | | - <p>HINT: It is possible to issue multiple analyse_to_file commands at |
328 | | - the same time. </p> |
| 356 | + If no source code is found, this is indicated by the error reason |
| 357 | + <c>{no_source_code_found,Module}</c>.</p> |
329 | 358 | </desc> |
330 | 359 | </func> |
331 | 360 | <func> |
|
339 | 368 | <v>OutFile = string()</v> |
340 | 369 | <v>Options = [Option]</v> |
341 | 370 | <v>Option = html</v> |
342 | | - <v>Error = {not_cover_compiled,Module} | {file,File,Reason} | no_source_code_found | not_main_node</v> |
| 371 | + <v>Error = {not_cover_compiled,Module} | {file,File,Reason} | {no_source_code_found,Module} | not_main_node</v> |
343 | 372 | <v> File = string()</v> |
344 | 373 | <v> Reason = term()</v> |
345 | 374 | </type> |
|
0 commit comments