Index: ../trunk-jpl/test/NightlyRun/runme.m =================================================================== --- ../trunk-jpl/test/NightlyRun/runme.m (revision 26349) +++ ../trunk-jpl/test/NightlyRun/runme.m (revision 26350) @@ -1,13 +1,15 @@ function varargout=runme(varargin) %RUNME - test deck for ISSM nightly runs % -% In a test deck directory (test/Vertification/NightlyRun for example) -% The following command will launch all the existing tests: -% >> runme -% To run the tests 101 and 102: -% >> runme('id',[101 102]) -% etc... +% In a test deck directory (for example, test/NightlyRun) the following +% command will launch all existing tests, % +% >> runme +% +% To run tests 101 and 102, +% +% >> runme('id',[101 102]) +% % Available options: % 'id' followed by the list of ids requested % 'exclude' ids to be excluded from the test @@ -23,7 +25,6 @@ % 'slc' : validation of slc tests % 'thermal' : validation of thermal tests % 'tranforcing' : validation of transient forcing tests -% ... % 'procedure' 'check' : run the test (default) % 'update': update the archive % 'valgrind': check for memory leaks (default value of md.debug.valgrind needs to be changed manually) @@ -36,8 +37,15 @@ % runme; % runme('exclude',101); % runme('id',102,'procedure','update'); - % runme('procedure','valgrind','stoponerror',1,'exclude','IdFromString('Dak')); +% +% NOTE: +% - Will only run test scripts whose names explicitly follow the convention, +% +% test.m +% +% where is any integer. +% %Check inputs % {{{ @@ -81,18 +89,22 @@ flist=dir;%use dir, as it seems to act OS independent list_ids=[]; for i=1:numel(flist), - if ( strncmp(flist(i).name,'test',4) &... %File name must start with 'test' - strncmp(fliplr(flist(i).name),fliplr('.m'),2)&... %File name must end by '.m' - ~strcmp(flist(i).name,'test.m')) %File name must be different than 'test.m' - id=str2num(flist(i).name(5:end-2)); - if isempty(id), - disp(['WARNING: ignore file ' flist(i).name ]); - else - list_ids(end+1)=eval(flist(i).name(5:end-2)); %Keep test id only (skip 'test' and '.m') + fname=flist(i).name; + if (contains(fname,'.')), %Before split, check that file name contains '.' + ftokens=string(split(fname,'.')); %Tokenize file name on '.' + if (regexp(ftokens{1},'^test[0-9]+$') &... %Basename must start with 'test' and end with a number + strcmp(ftokens{end},'m') ... %Extension (less '.') must be 'm' + ), + id=sscanf(ftokens{1},'test%d'); + if isempty(id), + disp(['WARNING: ignore file ' flist(i).name]); + else + list_ids(end+1)=id;%Keep test id only (strip 'test' and '.m') + end end end end -[i1,i2]=parallelrange(rank,numprocs,length(list_ids)); %Get tests for this cpu only +[i1,i2]=parallelrange(rank,numprocs,length(list_ids)); %Get tests for this cpu only list_ids=list_ids(i1:i2); test_ids=getfieldvalue(options,'id',list_ids); Index: ../trunk-jpl/test/NightlyRun/runme.py =================================================================== --- ../trunk-jpl/test/NightlyRun/runme.py (revision 26349) +++ ../trunk-jpl/test/NightlyRun/runme.py (revision 26350) @@ -2,6 +2,7 @@ import argparse from glob import glob import os +import re from sys import float_info from traceback import format_exc @@ -21,12 +22,12 @@ def runme(id=None, exclude=None, benchmark='nightly', procedure='check', output='none', rank=1, numprocs=1): """RUNME - test deck for ISSM nightly runs - In a test deck directory (test/NightlyRun for example), the following - command will launch all the existing tests, + In a test deck directory (for example, test/NightlyRun) the following + command will launch all existing tests, ./runme.py - To run tests 101 and 102: + To run tests 101 and 102, ./runme.py -i [101, 102] @@ -33,10 +34,8 @@ Options: -i/--id followed by the list of ids or (parts of) test names requested NOTE: runs all tests by default - -e/--exclude ids or (parts of) test names to be excluded (same format as id) NOTE: exclude does nothing if 'id' is specified with different values - -b/--benchmark 'all' : (all of the tests) 'nightly' : (nightly run/daily run) 'validation' : (validation) @@ -49,7 +48,6 @@ 'slc' : validation of slc tests 'thermal' : validation of thermal tests 'tranforcing' : validation of transient forcing tests - -p/--procedure 'check' : run the test (default) 'update' : update the archive @@ -64,10 +62,19 @@ ./runme.py -e 'Dakota' --benchmark 'all' ./runme.py -i [[101, 102], ['Dakota', 'Slc']] + NOTE: + - Will only run test scripts whose names explicitly follow the convention, + + test.py + + where is any integer. + TODO: - At '#disp test result', make sure precision of output matches that of - MATLAB. - - Check for failures that do not raise exceptions (for example, 'Standard exception'; see also jenkins/jenkins.sh). These should be counted as failures. + MATLAB. + - Check for failures that do not raise exceptions (for example, 'Standard + exception'; see also jenkins/jenkins.sh). These should be counted as + failures. """ #Get ISSM_DIR variable @@ -95,7 +102,7 @@ # }}} #GET ids {{{ flist = glob('test*.py') #File name must start with 'test' and must end by '.py' and must be different than 'test.py' - list_ids = [int(file[4:-3]) for file in flist if not file == 'test.py'] #Keep test id only (skip 'test' and '.py') + list_ids = [int(re.search(r'\d+',file.split('.')[0]).group()) for file in flist if not file == 'test.py'] #Keep test id only (skip 'test' and '.py') i1, i2 = parallelrange(rank, numprocs, len(list_ids)) #Get tests for this cpu only list_ids = list_ids[i1:i2 + 1]