| 1 | /* a file to start prob_cli with coverage/profiling info enabled (for SICStus 4.2 and later) */ | |
| 2 | ||
| 3 | %:- set_prolog_flag(compiling,debugcode). % debugcode leads to crash in coverage_data/1 in SICStus 4.6 | |
| 4 | % e.g., crash occurs for coverage_group_data('PROB-369'). See ticket SPRM-21038 | |
| 5 | :- set_prolog_flag(source_info,on). | |
| 6 | :- set_prolog_flag(profiling,on). | |
| 7 | ||
| 8 | :- use_module('../src/pathes', []). % set up library search paths | |
| 9 | ||
| 10 | %:- include(covsrc(coverage_term_expander)). | |
| 11 | ||
| 12 | :- use_module(probsrc(prob_cli)). | |
| 13 | ||
| 14 | :- use_module(covsrc(coverage_tools)). | |
| 15 | :- use_module(test_runner). | |
| 16 | :- use_module(probsrc(tools_strings),[ajoin/2]). | |
| 17 | :- use_module(probsrc(version)). | |
| 18 | ||
| 19 | :- use_module(library(file_systems)). | |
| 20 | ||
| 21 | % use module_info/3 because we are not in a module here | |
| 22 | :- use_module(probsrc(module_information),[module_info/3]). | |
| 23 | :- module_info(prob_cov_runner,group,coverage_analysis). | |
| 24 | :- module_info(prob_cov_runner,description,'ProB start file with coverage tests activated. Includes predicates to execute certain tests. Used by to generate coverage reports.'). | |
| 25 | ||
| 26 | :- use_module(testcases, [set_generating_coverage/0]). | |
| 27 | % compute coverage for a testcase category (see testcases.pl for categories) | |
| 28 | coverage_group_data(Category) :- | |
| 29 | % ids_in_category(Category,IDs), | |
| 30 | % load_coverage_files(IDs,CoverageData), | |
| 31 | set_generating_coverage, | |
| 32 | run_silently, | |
| 33 | run_tests_by_category(Category,all), | |
| 34 | format('Obtaining coverage data for category ~w~n',[Category]), flush_output, | |
| 35 | coverage_data(CoverageData), | |
| 36 | write_coverage_data(Category,CoverageData). | |
| 37 | ||
| 38 | % write collected coverage information to a Datafile | |
| 39 | write_coverage_data(FileName,Data) :- | |
| 40 | ajoin(['./temp_coverage_data/', FileName],Path), | |
| 41 | format('Writing coverage data to ~w~n',[Path]), flush_output, | |
| 42 | open(Path,write,Stream), | |
| 43 | Out=cov(Data), | |
| 44 | write_canonical(Stream,Out), | |
| 45 | write(Stream,'.'), | |
| 46 | close(Stream). | |
| 47 |