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' 'all' (all of them) % 'nightly' (nightly run) % 'ismip' : validation of ismip-hom tests % 'eismint': validation of eismint tests % 'thermal': validation of thermal tests % 'mesh' : validation of mesh tests % 'adolc' : validation of adolc tests % 'slr' : validation of slr tests % 'qmu' : validation of dakota 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) % 'stoponerror' 1 or 0 % % Usage: % runme(varargin); % % Examples: % runme; % runme('exclude',101); % runme('id',102,'procedure','update'); % runme('procedure','valgrind','stoponerror',1,'exclude','IdFromString('Dak')); %Check inputs % {{{ if nargout>1 help runme error('runme error message: bad usage'); end %recover options options=pairoptions(varargin{:}); % }}} %Process options %GET benchmark {{{ benchmark=getfieldvalue(options,'benchmark','nightly'); if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','slr','qmu'}) disp('runme warning: benchmark not supported, defaulting to test ''nightly''') benchmark='nightly'; end % }}} %GET procedure {{{ procedure=getfieldvalue(options,'procedure','check'); if ~ismember(procedure,{'check','update','valgrind'}) disp('runme warning: procedure not supported, defaulting to test ''check''') procedure='check'; end % }}} %GET output {{{ output=getfieldvalue(options,'output','none'); if ~ismember(output,{'nightly','none'}) disp('runme warning: output not supported, defaulting to test ''none''') output='none'; end % }}} %GET RANK and NUMPROCS for multithreaded runs {{{ rank=getfieldvalue(options,'rank',1); numprocs=getfieldvalue(options,'numprocs',1); if (numprocs 0 test id: %i test name: %s field: valgrind mem. leaks'],leaks,id,id_string)); disp('STOP'); return; end if jumps==0, disp(sprintf(['SUCCESS difference: 0 < 0 test id: %i test name: %s field: valgrind cond. jumps'],id,id_string)); else disp(sprintf(['ERROR difference: %i > 0 test id: %i test name: %s field: valgrind cond. jumps'],jumps,id,id_string)); disp('STOP'); return; end if inval==0, disp(sprintf(['SUCCESS difference: 0 < 0 test id: %i test name: %s field: valgrind invalid read/write'],id,id_string)); else disp(sprintf(['ERROR difference: %i > 0 test id: %i test name: %s field: valgrind invalid read/write'],inval,id,id_string)); disp('STOP'); return; end end %ELSE: CHECK TEST else, for k=1:length(field_names), try, %Get field and tolerance field=field_values{k}; fieldname=field_names{k}; tolerance=field_tolerances{k}; %compare to archive %our output is in the correct order (n,1) or (1,1), so we do not need to transpose again archive_cell=archread(['../Archives/' archive_name '.arch'],[archive_name '_field' num2str(k)]); archive=archive_cell{1}; error_diff=full(max(abs(archive(:)-field(:)))/(max(abs(archive(:)))+eps)); %disp test result if (error_diff>tolerance | isnan(error_diff)); disp(sprintf(['ERROR difference: %-7.2g > %7.2g test id: %i test name: %s field: %s'],... error_diff,tolerance,id,id_string,fieldname)); if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end 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: message=getReport(me2); fprintf('%s',message); if strcmpi(output,'nightly') fid=fopen([issmdir() '/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)); else disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,fieldname)); fprintf('%s',message); if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end end continue; end end end catch me, %something went wrong, print failure message: message=getReport(me); fprintf('%s',message); if strcmpi(output,'nightly') fid=fopen([issmdir() '/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')); else disp(sprintf(['FAILURE difference: N/A test id: %i test name: %s field: %s'],id,id_string,'N/A')); rethrow(me); if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end end end disp(sprintf('%s%i%s','----------------finished:',id,'-----------------------')); end