source: issm/oecreview/Archive/25834-26739/ISSM-26349-26350.diff@ 26740

Last change on this file since 26740 was 26740, checked in by Mathieu Morlighem, 3 years ago

CHG: added 25834-26739

File size: 6.3 KB
RevLine 
[26740]1Index: ../trunk-jpl/test/NightlyRun/runme.m
2===================================================================
3--- ../trunk-jpl/test/NightlyRun/runme.m (revision 26349)
4+++ ../trunk-jpl/test/NightlyRun/runme.m (revision 26350)
5@@ -1,13 +1,15 @@
6 function varargout=runme(varargin)
7 %RUNME - test deck for ISSM nightly runs
8 %
9-% In a test deck directory (test/Vertification/NightlyRun for example)
10-% The following command will launch all the existing tests:
11-% >> runme
12-% To run the tests 101 and 102:
13-% >> runme('id',[101 102])
14-% etc...
15+% In a test deck directory (for example, test/NightlyRun) the following
16+% command will launch all existing tests,
17 %
18+% >> runme
19+%
20+% To run tests 101 and 102,
21+%
22+% >> runme('id',[101 102])
23+%
24 % Available options:
25 % 'id' followed by the list of ids requested
26 % 'exclude' ids to be excluded from the test
27@@ -23,7 +25,6 @@
28 % 'slc' : validation of slc tests
29 % 'thermal' : validation of thermal tests
30 % 'tranforcing' : validation of transient forcing tests
31-% ...
32 % 'procedure' 'check' : run the test (default)
33 % 'update': update the archive
34 % 'valgrind': check for memory leaks (default value of md.debug.valgrind needs to be changed manually)
35@@ -36,8 +37,15 @@
36 % runme;
37 % runme('exclude',101);
38 % runme('id',102,'procedure','update');
39-
40 % runme('procedure','valgrind','stoponerror',1,'exclude','IdFromString('Dak'));
41+%
42+% NOTE:
43+% - Will only run test scripts whose names explicitly follow the convention,
44+%
45+% test<id>.m
46+%
47+% where <id> is any integer.
48+%
49
50 %Check inputs
51 % {{{
52@@ -81,18 +89,22 @@
53 flist=dir;%use dir, as it seems to act OS independent
54 list_ids=[];
55 for i=1:numel(flist),
56- if ( strncmp(flist(i).name,'test',4) &... %File name must start with 'test'
57- strncmp(fliplr(flist(i).name),fliplr('.m'),2)&... %File name must end by '.m'
58- ~strcmp(flist(i).name,'test.m')) %File name must be different than 'test.m'
59- id=str2num(flist(i).name(5:end-2));
60- if isempty(id),
61- disp(['WARNING: ignore file ' flist(i).name ]);
62- else
63- list_ids(end+1)=eval(flist(i).name(5:end-2)); %Keep test id only (skip 'test' and '.m')
64+ fname=flist(i).name;
65+ if (contains(fname,'.')), %Before split, check that file name contains '.'
66+ ftokens=string(split(fname,'.')); %Tokenize file name on '.'
67+ if (regexp(ftokens{1},'^test[0-9]+$') &... %Basename must start with 'test' and end with a number
68+ strcmp(ftokens{end},'m') ... %Extension (less '.') must be 'm'
69+ ),
70+ id=sscanf(ftokens{1},'test%d');
71+ if isempty(id),
72+ disp(['WARNING: ignore file ' flist(i).name]);
73+ else
74+ list_ids(end+1)=id;%Keep test id only (strip 'test' and '.m')
75+ end
76 end
77 end
78 end
79-[i1,i2]=parallelrange(rank,numprocs,length(list_ids)); %Get tests for this cpu only
80+[i1,i2]=parallelrange(rank,numprocs,length(list_ids)); %Get tests for this cpu only
81 list_ids=list_ids(i1:i2);
82
83 test_ids=getfieldvalue(options,'id',list_ids);
84Index: ../trunk-jpl/test/NightlyRun/runme.py
85===================================================================
86--- ../trunk-jpl/test/NightlyRun/runme.py (revision 26349)
87+++ ../trunk-jpl/test/NightlyRun/runme.py (revision 26350)
88@@ -2,6 +2,7 @@
89 import argparse
90 from glob import glob
91 import os
92+import re
93 from sys import float_info
94 from traceback import format_exc
95
96@@ -21,12 +22,12 @@
97 def runme(id=None, exclude=None, benchmark='nightly', procedure='check', output='none', rank=1, numprocs=1):
98 """RUNME - test deck for ISSM nightly runs
99
100- In a test deck directory (test/NightlyRun for example), the following
101- command will launch all the existing tests,
102+ In a test deck directory (for example, test/NightlyRun) the following
103+ command will launch all existing tests,
104
105 ./runme.py
106
107- To run tests 101 and 102:
108+ To run tests 101 and 102,
109
110 ./runme.py -i [101, 102]
111
112@@ -33,10 +34,8 @@
113 Options:
114 -i/--id followed by the list of ids or (parts of) test names requested
115 NOTE: runs all tests by default
116-
117 -e/--exclude ids or (parts of) test names to be excluded (same format as id)
118 NOTE: exclude does nothing if 'id' is specified with different values
119-
120 -b/--benchmark 'all' : (all of the tests)
121 'nightly' : (nightly run/daily run)
122 'validation' : (validation)
123@@ -49,7 +48,6 @@
124 'slc' : validation of slc tests
125 'thermal' : validation of thermal tests
126 'tranforcing' : validation of transient forcing tests
127-
128 -p/--procedure 'check' : run the test (default)
129 'update' : update the archive
130
131@@ -64,10 +62,19 @@
132 ./runme.py -e 'Dakota' --benchmark 'all'
133 ./runme.py -i [[101, 102], ['Dakota', 'Slc']]
134
135+ NOTE:
136+ - Will only run test scripts whose names explicitly follow the convention,
137+
138+ test<id>.py
139+
140+ where <id> is any integer.
141+
142 TODO:
143 - At '#disp test result', make sure precision of output matches that of
144- MATLAB.
145- - Check for failures that do not raise exceptions (for example, 'Standard exception'; see also jenkins/jenkins.sh). These should be counted as failures.
146+ MATLAB.
147+ - Check for failures that do not raise exceptions (for example, 'Standard
148+ exception'; see also jenkins/jenkins.sh). These should be counted as
149+ failures.
150 """
151
152 #Get ISSM_DIR variable
153@@ -95,7 +102,7 @@
154 # }}}
155 #GET ids {{{
156 flist = glob('test*.py') #File name must start with 'test' and must end by '.py' and must be different than 'test.py'
157- list_ids = [int(file[4:-3]) for file in flist if not file == 'test.py'] #Keep test id only (skip 'test' and '.py')
158+ 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')
159
160 i1, i2 = parallelrange(rank, numprocs, len(list_ids)) #Get tests for this cpu only
161 list_ids = list_ids[i1:i2 + 1]
Note: See TracBrowser for help on using the repository browser.