diff --git a/matlab/run_gdat_tests.m b/matlab/run_gdat_tests.m index c2250befd2190018ab32402d794739dc4379473d..f7679fdce296b4d564e2bb161864e2a2386139cf 100644 --- a/matlab/run_gdat_tests.m +++ b/matlab/run_gdat_tests.m @@ -1,16 +1,13 @@ function [passed,results] = run_gdat_tests(test_case,coverage_report) % Test runner for generic toolbox tests -if nargin==0 || isempty(test_case) - test_case = 'all'; % default +if nargin==0 + test_case = ''; % default end - if nargin < 2 coverage_report = false; % default end -assert(~(coverage_report && strcmpi(test_case,'coverage')),'coverage_report=true should only be used with test_case=''coverage'''); - needXML=~isempty(getenv('GITLAB_CI')) && ~verLessThan('matlab','8.6.0'); needCOV=~isempty(getenv('GITLAB_CI')) && ~verLessThan('matlab','9.6.0') || coverage_report; @@ -50,8 +47,14 @@ testspath = fullfile(tbxpath,'tests'); lastwarn('',''); -suite_all = [matlab.unittest.TestSuite.fromFile(fullfile(testspath,'test_requestnames_tcv.m')),... - matlab.unittest.TestSuite.fromFile(fullfile(testspath,'test_tcv_get_ids.m'))]; +suite_all = matlab.unittest.TestSuite.fromFolder(testspath); +if isempty(test_case) + % list all tags + fprintf('Available (possibly overlapping) test_case tags:\n') + disp([{'all'};unique([suite_all.Tags])']); + return +end +assert(~(coverage_report && strcmpi(test_case,'coverage')),'coverage_report=true should only be used with test_case=''coverage'''); [~,s] = lastwarn(); if isequal(s,'MATLAB:unittest:TestSuite:FileExcluded') @@ -62,12 +65,6 @@ end switch lower(test_case) case 'all' suite = suite_all; % run all - case 'tcv' - s = HasName(ContainsSubstring('tcv')); - suite = suite_all.selectIf(s); - case 'aug' - s = HasName(ContainsSubstring('aug')); - suite = suite_all.selectIf(s); otherwise s = HasTag(test_case); suite = suite_all.selectIf(s); diff --git a/matlab/tests/get_all_gdat_requests.m b/matlab/tests/get_all_gdat_requests.m index 2783e3390689807df83d4e508a73094db2787c2a..45cf84933ad22c2c2687e2b6bf3b92d4a25c145d 100644 --- a/matlab/tests/get_all_gdat_requests.m +++ b/matlab/tests/get_all_gdat_requests.m @@ -6,11 +6,16 @@ switch machine % list of calls that take some time, to be skipped for fast tests case 'TCV' slowlist = {'rtc','mpx','sxr','psi'}; + excludelist = {'scd'}; % cases to skip for good reason case 'AUG' slowlist = {'sxr','cxrs','transp','te_rho','ne_rho','nete_rho',... - 'ece_rho','eced_rho','cxrs_rho','eqdsk','equil'}; + 'ece_rho','eced_rho','cxrs_rho','eqdsk','equil'}; + excludelist = {}; end +% filter requests +requests = requests(~ismember(requests,excludelist)); + switch testcase case 'fast' requests = requests(~ismember(requests,slowlist)); diff --git a/matlab/tests/test_requestnames.m b/matlab/tests/test_requestnames.m index 3c8986c1abc3626e59b0feacedeb6daee7a1c58c..01527a0707adf72f6beea5f1d56396a8d8d34a8c 100644 --- a/matlab/tests/test_requestnames.m +++ b/matlab/tests/test_requestnames.m @@ -12,22 +12,9 @@ classdef (SharedTestFixtures={... requests_fast; % placeholders requests_slow; end - - methods(Test,TestTags = {'fast'}) - function test_gdat_call_fast(testCase,shot,requests_fast) - test_gdat_call(testCase,shot,requests_fast); - end - end - - methods(Test,TestTags = {'slow'}) - function test_gdat_call_slow(testCase,shot,requests_slow) - test_gdat_call(testCase,shot,requests_slow); - end - end - end -function test_gdat_call(testCase,shot,request) +function test_gdat_call(testCase,shot,request) %#ok<DEFNU> % actual function to test gdat call testCase.assertTrue(isnumeric(str2double(shot))); testCase.assertTrue(ischar(request)); @@ -39,15 +26,8 @@ do_gdat_call = 1; switch request case 'eqdsk' % avoid writing files in /tmp, may not be allowed - gdat_call = sprintf(['gdat_' lower(testCase.Machine) '(%s,''%s'',''write'',0)'],shot,request); - case 'scd' - % scd dummy call with error information in gdat, do not do test (done with rtc) - do_gdat_call = 0; - case 'rtc' - if exist('erase') ~= 2 - do_gdat_call = 0; % get_scd_mems works with newer versions which contains erase function - end -end + gdat_call = sprintf(['gdat_%s(%s,''%s'',''write'',0)'],lower(testCase.Machine),shot,request); + end % logging fprintf('Testing gdat call: %s\n',gdat_call); diff --git a/matlab/tests/test_requestnames_aug.m b/matlab/tests/test_requestnames_aug.m index 383093a0f1bd209a8104d67507c3d605d34ff853..7521b34b605033988ea1089e526161e15d24b5f5 100644 --- a/matlab/tests/test_requestnames_aug.m +++ b/matlab/tests/test_requestnames_aug.m @@ -1,4 +1,4 @@ -classdef test_requestnames_aug < test_requestnames +classdef (TestTags={'aug'})test_requestnames_aug < test_requestnames % everything implemented in superclass properties @@ -12,4 +12,15 @@ classdef test_requestnames_aug < test_requestnames requests_slow = get_all_gdat_requests('AUG','slow'); end + methods(Test,TestTags = {'fast'}) + function test_gdat_call_fast(testCase,shot,requests_fast) + test_gdat_call(testCase,shot,requests_fast); + end + end + + methods(Test,TestTags = {'slow'}) + function test_gdat_call_slow(testCase,shot,requests_slow) + test_gdat_call(testCase,shot,requests_slow); + end + end end \ No newline at end of file diff --git a/matlab/tests/test_requestnames_tcv.m b/matlab/tests/test_requestnames_tcv.m index 4799d2a2aa24da00e4a73e70d719d1a00f27076b..e625ba60b47cbe6567639027455b0df97246967f 100644 --- a/matlab/tests/test_requestnames_tcv.m +++ b/matlab/tests/test_requestnames_tcv.m @@ -1,4 +1,4 @@ -classdef test_requestnames_tcv < test_requestnames +classdef (TestTags={'tcv'})test_requestnames_tcv < test_requestnames % everything is implemented in superclass! properties @@ -11,5 +11,17 @@ classdef test_requestnames_tcv < test_requestnames requests_fast = get_all_gdat_requests('TCV','fast'); requests_slow = get_all_gdat_requests('TCV','slow'); end - + + methods(Test,TestTags = {'fast'}) + function test_gdat_call_fast(testCase,shot,requests_fast) + test_gdat_call(testCase,shot,requests_fast); + end + end + + methods(Test,TestTags = {'slow'}) + function test_gdat_call_slow(testCase,shot,requests_slow) + test_gdat_call(testCase,shot,requests_slow); + end + end + end diff --git a/matlab/tests/test_tcv_get_ids.m b/matlab/tests/test_tcv_get_ids.m index 9b3065794ce6c82cd995b9afe8bbd309b6914ff0..f48f925088fc74fc8ad678dcd52853bdc324935c 100644 --- a/matlab/tests/test_tcv_get_ids.m +++ b/matlab/tests/test_tcv_get_ids.m @@ -1,4 +1,4 @@ -classdef (SharedTestFixtures={... +classdef (TestTags={'imas'},SharedTestFixtures={... check_mds,check_gdatpaths})... test_tcv_get_ids < matlab.unittest.TestCase @@ -7,7 +7,7 @@ classdef (SharedTestFixtures={... ids_name = {'pf_active','wall'}; end - methods(Test,TestTags = {'imas'}) + methods(Test) function test_get_ids_list(testCase,shot) gg = testCase.assertWarning(@() gdat(shot,'ids'),'gdat:EmptyIDSName');