Changeset 26350


Ignore:
Timestamp:
07/16/21 12:48:00 (4 years ago)
Author:
jdquinn
Message:

BUG: Corrected parsing of test number from file name

Location:
issm/trunk-jpl/test/NightlyRun
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/test/NightlyRun/runme.m

    r25956 r26350  
    22%RUNME - test deck for ISSM nightly runs
    33%
    4 %   In a test deck directory (test/Vertification/NightlyRun for example)
    5 %   The following command will launch all the existing tests:
    6 %   >> runme
    7 %   To run the tests 101 and 102:
    8 %   >> runme('id',[101 102])
    9 %   etc...
     4%   In a test deck directory (for example, test/NightlyRun) the following
     5%   command will launch all existing tests,
     6%
     7%      >> runme
     8%
     9%   To run tests 101 and 102,
     10%
     11%      >> runme('id',[101 102])
    1012%
    1113%   Available options:
     
    2426%                      'thermal'     : validation of thermal tests
    2527%                      'tranforcing' : validation of transient forcing tests
    26 %                      ...
    2728%      'procedure'     'check' :   run the test (default)
    2829%                      'update':   update the archive
     
    3738%      runme('exclude',101);
    3839%      runme('id',102,'procedure','update');
    39 
    4040%      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%
    4149
    4250%Check inputs
     
    8290list_ids=[];
    8391for i=1:numel(flist),
    84         if ( strncmp(flist(i).name,'test',4) &...                         %File name must start with 'test'
    85                         strncmp(fliplr(flist(i).name),fliplr('.m'),2)&...           %File name must end by '.m'
    86                         ~strcmp(flist(i).name,'test.m'))                            %File name must be different than 'test.m'
    87                 id=str2num(flist(i).name(5:end-2));
    88                 if isempty(id),
    89                         disp(['WARNING: ignore file ' flist(i).name ]);
    90                 else
    91                         list_ids(end+1)=eval(flist(i).name(5:end-2));                  %Keep test id only (skip 'test' and '.m')
     92        fname=flist(i).name;
     93        if (contains(fname,'.')), %Before split, check that file name contains '.'
     94                ftokens=string(split(fname,'.')); %Tokenize file name on '.'
     95                if (regexp(ftokens{1},'^test[0-9]+$') &... %Basename must start with 'test' and end with a number
     96                        strcmp(ftokens{end},'m') ... %Extension (less '.') must be 'm'
     97                ),
     98                        id=sscanf(ftokens{1},'test%d');
     99                        if isempty(id),
     100                                disp(['WARNING: ignore file ' flist(i).name]);
     101                        else
     102                                list_ids(end+1)=id;%Keep test id only (strip 'test' and '.m')
     103                        end
    92104                end
    93105        end
    94106end
    95 [i1,i2]=parallelrange(rank,numprocs,length(list_ids));               %Get tests for this cpu only
     107[i1,i2]=parallelrange(rank,numprocs,length(list_ids)); %Get tests for this cpu only
    96108list_ids=list_ids(i1:i2);
    97109
  • issm/trunk-jpl/test/NightlyRun/runme.py

    r25956 r26350  
    33from glob import glob
    44import os
     5import re
    56from sys import float_info
    67from traceback import format_exc
     
    2223    """RUNME - test deck for ISSM nightly runs
    2324
    24     In a test deck directory (test/NightlyRun for example), the following
    25     command will launch all the existing tests,
     25    In a test deck directory (for example, test/NightlyRun) the following
     26    command will launch all existing tests,
    2627
    2728        ./runme.py
    2829
    29     To run tests 101 and 102:
     30    To run tests 101 and 102,
    3031
    3132        ./runme.py -i [101, 102]
     
    3435        -i/--id             followed by the list of ids or (parts of) test names requested
    3536                            NOTE: runs all tests by default
    36 
    3737        -e/--exclude        ids or (parts of) test names to be excluded (same format as id)
    3838                            NOTE: exclude does nothing if 'id' is specified with different values
    39 
    4039        -b/--benchmark      'all'           : (all of the tests)
    4140                            'nightly'       : (nightly run/daily run)
     
    5049                            'thermal'       : validation of thermal tests
    5150                            'tranforcing'   : validation of transient forcing tests
    52 
    5351        -p/--procedure      'check'         : run the test (default)
    5452                            'update'        : update the archive
     
    6563        ./runme.py -i [[101, 102], ['Dakota', 'Slc']]
    6664
     65    NOTE:
     66    - Will only run test scripts whose names explicitly follow the convention,
     67
     68        test<id>.py
     69
     70    where <id> is any integer.
     71
    6772    TODO:
    6873    - At '#disp test result', make sure precision of output matches that of
    69         MATLAB.
    70     - Check for failures that do not raise exceptions (for example, 'Standard exception'; see also jenkins/jenkins.sh). These should be counted as failures.
     74    MATLAB.
     75    - Check for failures that do not raise exceptions (for example, 'Standard
     76    exception'; see also jenkins/jenkins.sh). These should be counted as
     77    failures.
    7178    """
    7279
     
    96103    #GET ids  {{{
    97104    flist = glob('test*.py')  #File name must start with 'test' and must end by '.py' and must be different than 'test.py'
    98     list_ids = [int(file[4:-3]) for file in flist if not file == 'test.py'] #Keep test id only (skip 'test' and '.py')
     105    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')
    99106
    100107    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  #Get tests for this cpu only
Note: See TracChangeset for help on using the changeset viewer.