Mercurial > hg > camir-ismir2012
view core/tools/migrate_to_test_dir.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
line wrap: on
line source
function out = migrate_to_test_dir(varargin) % % out = migrate_to_test_dir('testname', 'this is a test description') % create test run directory, add current dir to path and move % into test run dir % % NOTE: the test directory is created in "globalvars.testdatadir" if set % global globalvars; [sTest,fixedtestdir, unused] = process_options(varargin, ... 'testname', '','fixedtestdir', ''); % use starting script name as description if none is given if isempty(sTest) [ST, I] = dbstack(); sTest = ST(end).name; end % switch to test directory, and add this or current dir to path if ~isempty(globalvars.tstoutputpath) && ~isempty(dir(globalvars.tstoutputpath)); addpath(globalvars.tstoutputpath); cd(globalvars.tstoutputpath); else addpath(pwd); end % get camir version [~,cv] = camirversion(); % get current date sDate = datestr(now,'yymmdd'); if isempty(fixedtestdir) newdir = sprintf('%s_%s_r%d',sDate,sTest,cv); else newdir = fixedtestdir; end % create dir if not existent if isempty(dir(newdir)); mkdir(newdir); end cd(newdir); if ~isempty(strfind(pwd, newdir)) out = newdir; else warning 'cannot migrate to specified test directory, Ill dump right here'; out = -1; end