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

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

CHG: added 25834-26739

File size: 6.3 KB
  • ../trunk-jpl/test/NightlyRun/runme.m

     
    11function varargout=runme(varargin)
    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,
    106%
     7%      >> runme
     8%
     9%   To run tests 101 and 102,
     10%
     11%      >> runme('id',[101 102])
     12%
    1113%   Available options:
    1214%      'id'            followed by the list of ids requested
    1315%      'exclude'       ids to be excluded from the test
     
    2325%                      'slc'         : validation of slc tests
    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
    2930%                      'valgrind': check for memory leaks (default value of md.debug.valgrind needs to be changed manually)
     
    3637%      runme;
    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
    4351% {{{
     
    8189flist=dir;%use dir, as it seems to act OS independent
    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
    98110test_ids=getfieldvalue(options,'id',list_ids);
  • ../trunk-jpl/test/NightlyRun/runme.py

     
    22import argparse
    33from glob import glob
    44import os
     5import re
    56from sys import float_info
    67from traceback import format_exc
    78
     
    2122def runme(id=None, exclude=None, benchmark='nightly', procedure='check', output='none', rank=1, numprocs=1):
    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]
    3233
     
    3334    Options:
    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)
    4241                            'validation'    : (validation)
     
    4948                            'slc'           : validation of slc tests
    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
    5553
     
    6462        ./runme.py -e 'Dakota' --benchmark 'all'
    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
    7380    #Get ISSM_DIR variable
     
    95102    # }}}
    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
    101108    list_ids = list_ids[i1:i2 + 1]
Note: See TracBrowser for help on using the repository browser.