From 0f085772225f1abbaf89c05e35ed96e9bfc74e9b Mon Sep 17 00:00:00 2001 From: Federico Felici <federico.felici@epfl.ch> Date: Wed, 3 Jul 2019 09:57:09 +0200 Subject: [PATCH] Add skiplist + cosmetics --- matlab/run_gdat_tests.m | 1 - matlab/tests/test_requestnames.m | 148 ++------------------------- matlab/tests/test_requestnames_AUG.m | 4 +- matlab/tests/test_requestnames_TCV.m | 4 +- 4 files changed, 15 insertions(+), 142 deletions(-) diff --git a/matlab/run_gdat_tests.m b/matlab/run_gdat_tests.m index 1d865c43..facc81f4 100644 --- a/matlab/run_gdat_tests.m +++ b/matlab/run_gdat_tests.m @@ -23,7 +23,6 @@ switch test_case import matlab.unittest.selectors.HasParameter; import matlab.unittest.selectors.HasName; import matlab.unittest.selectors.HasTag; - import matlab.unittest.constraints.ContainsSubstring; s1 = HasName(ContainsSubstring('TCV')) & ... diff --git a/matlab/tests/test_requestnames.m b/matlab/tests/test_requestnames.m index b793dcd0..e64a4bc9 100644 --- a/matlab/tests/test_requestnames.m +++ b/matlab/tests/test_requestnames.m @@ -3,7 +3,8 @@ classdef (SharedTestFixtures={... test_requestnames < matlab.unittest.TestCase properties (Abstract) - machine; + Machine; + Skiplist; % tests to skip end properties(TestParameter,Abstract) @@ -17,151 +18,22 @@ classdef (SharedTestFixtures={... testCase.assertTrue(isnumeric(str2double(shot))); testCase.assertTrue(ischar(request)); - machine = testCase.machine; + testCase.assumeFalse(ismember(testCase.Skiplist,request),... + 'Skipped request %s since it is on the skiplist for %s',request,testCase.Machine); + % gdat call - gdat_call = sprintf(['gdat_' lower(machine) '(%s,''%s'')'],shot,request); + gdat_call = sprintf(['gdat_' lower(testCase.Machine) '(%s,''%s'')'],shot,request); % logging - testCase.log(sprintf('gdat_call: %s\n',gdat_call)); + fprintf('Testing gdat call: %s\n',gdat_call); - gdat_out = eval(gdat_call); + gdat_out = eval(gdat_call); %#ok<NASGU> % in some future: check for warnings - %gdat_out = verifyWarningFree(testCase,eval(gdat_call),... % 'Warning issued from gdat call:\n %s\n',gdat_call); - % add content checks of gdat_out here + % (add optional sanity checks of gdat_out here) end end - -end - - - -% methods(TestClassSetup) -% function getShot(testCase,machine) -% switch machine -% case 'AUG' -% testCase.shot = 30594; -% case 'TCV' -% testCase.shot = 48836; -% end -% end -% end -% -% end -% -% if nverbose>=2 && nverbose ~= 11 -% doplot = true; -% else -% doplot = false; -% end -% -% %% get request list -% if isempty(machine) -% [gd0,gp0] = gdat; -% else -% [gd0,gp0] = gdat('machine',machine); -% end -% if isempty(machine) -% machine = gp0.machine; -% end -% request_list = gd0.gdat_request; -% -% %% get default test shot for each machine -% -% -% %% possibly skip some since they take too long for a reduced test -% if iscell(testmode) -% skip = setdiff(request_list,testmode); -% testmode_not_in_list = setdiff(testmode,request_list); -% if ~isempty(testmode_not_in_list) -% if nverbose >= 1 -% disp('***********************************************************************') -% warning(['following input requests nt in request_list: ' testmode_not_in_list{:}]); -% disp('***********************************************************************') -% end -% end -% else -% switch testmode -% case 'reduced' -% skip = skip_list(machine); -% case 'full' -% skip = ''; % skip none -% otherwise -% error('invalid testmode, should be ''reduced'' or ''full'''); -% end -% end -% -% %% init -% Nreq = numel(gd0.gdat_request); -% err = zeros(Nreq,1); -% telaps = zeros(Nreq,1); -% skipped = false(Nreq,1); -% gdat_call = cell(Nreq,1); -% -% %% call gdat requests in a loop -% for ireq = 1:Nreq -% myrequest = request_list{ireq}; -% -% if ~ismember(myrequest,skip) -% % build request string -% if strcmp(myrequest,'transp') -% shotfile_user='PUETTI'; -% gdat_call{ireq} = sprintf(['gdat_' lower(machine) '(%d,''%s'',''doplot'',%d,''exp_name'',''%s'')'],shot,myrequest,doplot,shotfile_user); -% else -% gdat_call{ireq} = sprintf(['gdat_' lower(machine) '(%d,''%s'',''doplot'',%d)'],shot,myrequest,doplot); -% end -% -% % eval call -% [err(ireq),telaps(ireq),gdat_results{ireq}] = do_gdat_call(gdat_call{ireq},nverbose); -% skipped(ireq) = false; -% pause(0.1) -% else -% % skip -% err(ireq) = 0; -% telaps(ireq) = 0; -% skipped(ireq) = true; -% if nverbose>=11; fprintf('\n skipping gdat request ''%s''\n',myrequest); end -% end -% end -% -% pass = all(~err); -% -% -% function [machine,testmode,verbose] = parse_inputs(varargin) -% p = inputParser; -% p.addOptional('machine',''); -% p.addOptional('testmode','reduced'); -% p.addOptional('nverbose',1); -% p.parse(varargin{:}); -% -% machine = p.Results.machine; -% testmode = p.Results.testmode; -% verbose = p.Results.nverbose; -% -% function skip = skip_list(machine) -% switch upper(machine) -% case 'AUG' -% skip = {'cxrs','transp','te_rho','ne_rho','nete_rho','ece_rho','eced_rho','cxrs_rho','eqdsk','equil'}; -% otherwise -% warning('no list to skip defined for machine ''%s''',machine); -% skip = ''; -% end -% -% function [err,telaps,gdat_result] = do_gdat_call(gdat_call,nverbose) -% if nverbose >= 11 -% fprintf('\n calling %s...\n',gdat_call); -% end -% -% tic -% try -% [gdat_result,~,err] = eval(gdat_call); -% catch ME -% err = -1; -% gdat_result.data = []; -% getReport(ME); %,'extended'); -% end -% telaps = toc; % elapsed time -% end \ No newline at end of file +end \ No newline at end of file diff --git a/matlab/tests/test_requestnames_AUG.m b/matlab/tests/test_requestnames_AUG.m index 4ed042cd..7760847a 100644 --- a/matlab/tests/test_requestnames_AUG.m +++ b/matlab/tests/test_requestnames_AUG.m @@ -2,7 +2,9 @@ classdef test_requestnames_AUG < test_requestnames % everything implemented in superclass properties - machine = 'AUG'; + Machine = 'AUG'; + Skiplist = {'cxrs','transp','te_rho','ne_rho','nete_rho','ece_rho','eced_rho','cxrs_rho','eqdsk','equil'}; + % skip these equest names end properties(TestParameter) diff --git a/matlab/tests/test_requestnames_TCV.m b/matlab/tests/test_requestnames_TCV.m index 4eabc234..b1aaebfa 100644 --- a/matlab/tests/test_requestnames_TCV.m +++ b/matlab/tests/test_requestnames_TCV.m @@ -2,7 +2,8 @@ classdef test_requestnames_TCV < test_requestnames % everything is implemented in superclass! properties - machine = 'TCV'; + Machine = 'TCV'; + Skiplist = {''}; % skip these calls end properties(TestParameter) @@ -11,5 +12,4 @@ classdef test_requestnames_TCV < test_requestnames request = get_all_gdat_requests('TCV'); end - end \ No newline at end of file -- GitLab