Reorganization of the code with respect to the production of the summary report.
parent
71e8cb569d
commit
89474d5e44
|
@ -1,4 +1,4 @@
|
||||||
function str = build_report_summary(report, printonscreen, mailreport)
|
function str = build_report_summary(reportfile, printonscreen, mailreport)
|
||||||
|
|
||||||
% Copyright (C) 2013 Dynare Team
|
% Copyright (C) 2013 Dynare Team
|
||||||
%
|
%
|
||||||
|
@ -19,6 +19,7 @@ function str = build_report_summary(report, printonscreen, mailreport)
|
||||||
|
|
||||||
if isequal(nargin,1)
|
if isequal(nargin,1)
|
||||||
printonscreen = 1;
|
printonscreen = 1;
|
||||||
|
mailreport = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
if nargin<3
|
if nargin<3
|
||||||
|
@ -28,22 +29,24 @@ else
|
||||||
mailto = mailreport;
|
mailto = mailreport;
|
||||||
mailreport = 1;
|
mailreport = 1;
|
||||||
else
|
else
|
||||||
error('build_report_summary:: Third argument must be an adress email!')
|
if ~isequal(mailreport,0)
|
||||||
|
error('build_report_summary:: Third argument must be an adress email!')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
system('git show --pretty=format:"Last commit %H by %an, %ar %n-> %s" HEAD > git.info');
|
reportfilecontent = load(reportfile);
|
||||||
|
reportcell = reportfilecontent.report;
|
||||||
|
gitinfo = reportfilecontent.gitinfo;
|
||||||
|
gitlastcommithash = reportfilecontent.gitlastcommithash;
|
||||||
|
|
||||||
str = 'Hi,';
|
str = 'Hi,';
|
||||||
str = char(str,'');
|
str = char(str,'');
|
||||||
str = char(str,'This is a summary report for the unitary tests in Dynare.');
|
str = char(str,'This is a summary report for the unitary tests in Dynare.');
|
||||||
str = char(str,'');
|
str = char(str,'');
|
||||||
|
|
||||||
fid = fopen('git.info');
|
str = char(str,gitinfo(1,:));
|
||||||
str = char(str,fgetl(fid));
|
str = char(str,gitinfo(2,:));
|
||||||
str = char(str,fgetl(fid));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
str = char(str,'');
|
str = char(str,'');
|
||||||
str = char(str,'');
|
str = char(str,'');
|
||||||
|
@ -51,14 +54,14 @@ str = char(str,'');
|
||||||
str = char(str,['===========================']);
|
str = char(str,['===========================']);
|
||||||
str = char(str,'DYNARE/MATLAB UNITARY TESTS');
|
str = char(str,'DYNARE/MATLAB UNITARY TESTS');
|
||||||
str = char(str,'===========================');
|
str = char(str,'===========================');
|
||||||
str = char(str,['| TOTAL: ' int2str(size(report,1))]);
|
str = char(str,['| TOTAL: ' int2str(size(reportcell,1))]);
|
||||||
str = char(str,['| PASS: ' int2str(length(find(cell2mat(report(:,3)))))]);
|
str = char(str,['| PASS: ' int2str(length(find(cell2mat(reportcell(:,3)))))]);
|
||||||
str = char(str,['| FAIL: ' int2str(length(find(~cell2mat(report(:,3)))))]);
|
str = char(str,['| FAIL: ' int2str(length(find(~cell2mat(reportcell(:,3)))))]);
|
||||||
str = char(str,'|');
|
str = char(str,'|');
|
||||||
str = char(str,'| LIST OF FAILED TESTS:');
|
str = char(str,'| LIST OF FAILED TESTS:');
|
||||||
for i=1:size(report,1)
|
for i=1:size(reportcell,1)
|
||||||
if ~report{i,3}
|
if ~reportcell{i,3}
|
||||||
str = char(str,['| * ' report{i,1} ' (test #' int2str(report{i,2}) '{' strrep(int2str(transpose(find(~report{i,4}))),' ',',') '})']);
|
str = char(str,['| * ' reportcell{i,1} ' (test #' int2str(reportcell{i,2}) '{' strrep(int2str(transpose(find(~reportcell{i,4}))),' ',',') '})']);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function report = run_unitary_tests_in_directory(dirname,savereport)
|
function report = run_unitary_tests_in_directory(dirname,savereport,printreport,sendreport)
|
||||||
|
|
||||||
% Copyright (C) 2013 Dynare Team
|
% Copyright (C) 2013 Dynare Team
|
||||||
%
|
%
|
||||||
|
@ -17,10 +17,25 @@ function report = run_unitary_tests_in_directory(dirname,savereport)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
system('git show --pretty=format:"Last commit %H by %an, %ar %n-> %s" HEAD > git.info');
|
||||||
|
system('git rev-parse HEAD > git.last-commit-hash');
|
||||||
|
|
||||||
|
fid = fopen('git.info');
|
||||||
|
gitinfo = fgetl(fid);
|
||||||
|
gitinfo = char(gitinfo,fgetl(fid));
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
|
fid = fopen('git.last-commit-hash');
|
||||||
|
gitlastcommithash = fgetl(fid);
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
listoffiles = get_directory_description(dirname);
|
listoffiles = get_directory_description(dirname);
|
||||||
report = run_unitary_tests(listoffiles);
|
[report, time] = run_unitary_tests(listoffiles);
|
||||||
|
|
||||||
if nargin>1 && savereport>0
|
if nargin>1 && savereport>0
|
||||||
d = clock;
|
save(['report-' gitlastcommithash '.mat'],'report','time','gitinfo','gitlastcommithash');
|
||||||
save(['report-' num2str(d(1)) '-' num2str(d(2)) '-' num2str(d(3)) '-' num2str(d(4)) '-' num2str(d(5)) '-' num2str(round(d(6))) '.mat' ],'report');
|
end
|
||||||
|
|
||||||
|
if nargin>2
|
||||||
|
build_report_summary(['report-' gitlastcommithash '.mat'], printreport, sendreport);
|
||||||
end
|
end
|
Loading…
Reference in New Issue