function varargout=runme(varargin) %RUNME - test deck for ISSM nightly runs % % In a test deck directory (tests/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... % % Available options: % 'id' followed by the list of ids requested % 'exclude' ids to be excluded from the test % 'benchmark' 'nightly' (nightly run/ daily run) % 'ismip' : validation of ismip-hom tests % 'eismint': validation of eismint tests % 'thermal': validation of thermal tests % 'mesh' : validation of mesh tests % ... % 'procedure' 'check' : run the test (default) % 'update': update the archive % 'model' : prepare the model but no test is run % % Usage: % md=runme(varargin); % % Examples: % runme; % runme('exclude',101); % md=runme('id',102,'procedure','model'); %Get ISSM_DIR variable ISSM_DIR=issmdir(); %Check inputs % {{{1 if nargout>1 help runme error('runme error message: bad usage'); end %recover options options=pairoptions(varargin{:}); % }}} %Process options %GET benchmark {{{1 benchmark=getfieldvalue(options,'benchmark','nightly'); if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing'}) disp('runme warning: benchmark not supported, defaulting to test ''nightly''') benchmark='nightly'; end % }}} %GET procedure {{{1 procedure=getfieldvalue(options,'procedure','check'); if ~ismember(procedure,{'check','update'}) disp('runme warning: procedure not supported, defaulting to test ''check''') procedure='check'; end % }}} %GET output {{{1 output=getfieldvalue(options,'output','none'); if ~ismember(output,{'nightly','daily','none'}) disp('runme warning: output not supported, defaulting to test ''none''') output='none'; end % }}} %GET RANK and NUMPROCS for mutlithreaded runs {{{1 rank=getfieldvalue(options,'rank',1); numprocs=getfieldvalue(options,'numprocs',1); if (numprocstolerance); disp(sprintf(['ERROR difference: %-7.2g > %7.2g test id: %i test name: %s field: %s'],... error_diff,tolerance,id,id_string,fieldname)); else disp(sprintf(['SUCCESS difference: %-7.2g < %7.2g test id: %i test name: %s field: %s'],... error_diff,tolerance,id,id_string,fieldname)); end catch me2 %something went wrong, print failure message: directory=strsplit(pwd,'/'); message=getReport(me2); if strcmpi(output,'nightly') fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at'); fprintf(fid,'%s',message); fprintf(fid,'\n------------------------------------------------------------------\n'); fclose(fid); disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname)); elseif strcmpi(output,'daily'); fid=fopen([ISSM_DIR '/dailylog/matlaberror.log'], 'at'); fprintf(fid,'%s',message); fprintf(fid,'\n------------------------------------------------------------------\n'); fclose(fid); disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname)); else disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname)); rethrow(me2); end end end end catch me, %something went wrong, print failure message: directory=strsplit(pwd,'/'); message=getReport(me); if strcmpi(output,'nightly') fid=fopen([ISSM_DIR '/nightlylog/matlaberror.log'], 'at'); fprintf(fid,'%s',message); fprintf(fid,'\n------------------------------------------------------------------\n'); fclose(fid); disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A')); elseif strcmpi(output,'daily'); fid=fopen([ISSM_DIR '/dailylog/matlaberror.log'], 'at'); fprintf(fid,'%s',message); fprintf(fid,'\n------------------------------------------------------------------\n'); fclose(fid); disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A')); else disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A')); rethrow(me); end end end %output md if requested if nargout==1 varargout{1}=md; end