From a379209f6d750f3890202341ddf7464dc9375219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= <stephane.adjemian@univ-lemans.fr> Date: Fri, 14 Sep 2018 15:17:03 +0200 Subject: [PATCH] Cosmetic changes. --- src/build_report_summary.m | 18 ++++++++---------- src/run_unitary_tests_in_directory.m | 11 +++++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/build_report_summary.m b/src/build_report_summary.m index bb48ee5..15cff46 100644 --- a/src/build_report_summary.m +++ b/src/build_report_summary.m @@ -10,7 +10,7 @@ function str = build_report_summary(reportfile, printonscreen, mailreport) % OUTPUTS % - str [string] Report summary. -% Copyright (C) 2013-2017 Dynare Team +% Copyright (C) 2013-2018 Dynare Team % % This file is part of Dynare (m-unit-tests module). % @@ -27,17 +27,17 @@ function str = build_report_summary(reportfile, printonscreen, mailreport) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -if isequal(nargin,1) +if nargin<2 printonscreen = true; - mailreport = false; + mailreport = ''; end if nargin<3 - mailreport = false; + mailreport = ''; else - if ischar(mailreport) + if ischar(mailreport) && ~isempty(mailreport) mailto = mailreport; - mailreport = 1; + sendmail = true; fid = fopen('~/.matlab-send-report'); server = fgetl(fid); fclose(fid); @@ -46,9 +46,7 @@ else system(['scp ' reportfile ' ' server]); system(['scp ' reportfile(1:end-3) 'log ' server]); else - if ~isequal(mailreport,false) - error('build_report_summary:: Third argument must be an adress email!') - end + sendmail = false; end end @@ -90,7 +88,7 @@ if printonscreen skipline(2); end -if mailreport +if sendmail if exist('~/.matlab-send-mail-info','file') fid = fopen('~/.matlab-send-mail-info','r'); else diff --git a/src/run_unitary_tests_in_directory.m b/src/run_unitary_tests_in_directory.m index a3df36e..90d6abf 100644 --- a/src/run_unitary_tests_in_directory.m +++ b/src/run_unitary_tests_in_directory.m @@ -4,9 +4,9 @@ function report = run_unitary_tests_in_directory(dirname, savereport, printrepor % % INPUTS % - dirname [string], name of the directory where -% - savereport [integer], scalar equal to 0 or 1. If equal to 1 the report is saved in a mat file. -% - printreport [integer], scalar equal to 0 or 1. If equal to 1 the report is printed on screen. -% - sendreport [integer], scalar equal to 0 or 1. If equal to 1 the report is sent by email. +% - savereport [logical], scalar equal to false or true. If equal to true the report is saved in a mat file. +% - printreport [logical], scalar equal to false or true. If equal to true the report is printed on screen. +% - sendreport [string], email address. If not empty the report is sent by email. % % OUTPUTS % - report [cell], first output argument of run_unitary_test routine. @@ -69,10 +69,13 @@ disp(sstr) [report, time] = run_unitary_tests(listoffiles); diary off -if nargin>1 && savereport>0 +if nargin>1 && savereport save(['report-' gitlastcommithash '.mat'],'report','time','gitinfo','gitlastcommithash','matlabverion','platform'); end if nargin>2 + if nargin<4 + sendreport = ''; + end build_report_summary(['report-' gitlastcommithash '.mat'], printreport, sendreport); end \ No newline at end of file -- GitLab