Fix some apmtest errors, and add a path parameter.

Review URL: http://webrtc-codereview.appspot.com/88007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@259 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
ajm@google.com 2011-07-26 21:02:24 +00:00
parent b3b87d7795
commit aace5b6bac

View File

@ -1,4 +1,4 @@
function apmtest(task, testname, casenumber, legacy) function apmtest(task, testname, filepath, casenumber, legacy)
%APMTEST is a tool to process APM file sets and easily display the output. %APMTEST is a tool to process APM file sets and easily display the output.
% APMTEST(TASK, TESTNAME, CASENUMBER) performs one of several TASKs: % APMTEST(TASK, TESTNAME, CASENUMBER) performs one of several TASKs:
% 'test' Processes the files to produce test output. % 'test' Processes the files to produce test output.
@ -17,27 +17,33 @@ function apmtest(task, testname, casenumber, legacy)
% 'ns' The NS test set. % 'ns' The NS test set.
% 'vad' The VAD test set. % 'vad' The VAD test set.
% %
% FILEPATH specifies the path to the test data files.
%
% CASENUMBER can be used to select a single test case. Omit CASENUMBER, % CASENUMBER can be used to select a single test case. Omit CASENUMBER,
% or set to zero, to use all test cases. % or set to zero, to use all test cases.
% %
if nargin < 4 if nargin < 5 || isempty(legacy)
% Set to true to run old VQE recordings. % Set to true to run old VQE recordings.
legacy = false; legacy = false;
end end
if nargin < 3 if nargin < 4 || isempty(casenumber)
casenumber = 0; casenumber = 0;
end end
if nargin < 2 if nargin < 3 || isempty(filepath)
task = 'test'; filepath = 'data/';
end end
if nargin < 1 if nargin < 2 || isempty(testname)
testname = 'all'; testname = 'all';
end end
if nargin < 1 || isempty(task)
task = 'test';
end
if ~strcmp(task, 'test') && ~strcmp(task, 'list') && ~strcmp(task, 'show') if ~strcmp(task, 'test') && ~strcmp(task, 'list') && ~strcmp(task, 'show')
error(['TASK ' task ' is not recognized']); error(['TASK ' task ' is not recognized']);
end end
@ -46,17 +52,10 @@ if casenumber == 0 && strcmp(task, 'show')
error(['CASENUMBER must be specified for TASK ' task]); error(['CASENUMBER must be specified for TASK ' task]);
end end
filepath = 'data/';
inpath = [filepath 'input/']; inpath = [filepath 'input/'];
outpath = [filepath 'output/']; outpath = [filepath 'output/'];
refpath = [filepath 'reference/']; refpath = [filepath 'reference/'];
% Temporary
if legacy
refpath = [filepath 'output/'];
outpath = [filepath 'reference/'];
end
if strcmp(testname, 'all') if strcmp(testname, 'all')
tests = {'apm','apmm','aec','aecm','agc','ns','vad'}; tests = {'apm','apmm','aec','aecm','agc','ns','vad'};
else else
@ -64,7 +63,7 @@ else
end end
if legacy if legacy
progname = '/usr/local/google/p4/dev/depot/test'; progname = './test';
else else
progname = './process_test'; progname = './process_test';
end end
@ -127,24 +126,24 @@ for i=1:length(tests)
error(['TESTNAME ' tests{i} ' is not recognized']); error(['TESTNAME ' tests{i} ' is not recognized']);
end end
inpath = [inpath testdir]; inpathtest = [inpath testdir];
outpath = [outpath testdir]; outpathtest = [outpath testdir];
refpath = [refpath testdir]; refpathtest = [refpath testdir];
if ~exist(inpath,'dir') if ~exist(inpathtest,'dir')
error(['Input directory ' inpath ' does not exist']); error(['Input directory ' inpathtest ' does not exist']);
end end
if ~exist(refpath,'dir') if ~exist(refpathtest,'dir')
warning(['Reference directory ' refpath ' does not exist']); warning(['Reference directory ' refpathtest ' does not exist']);
end end
[status, errMsg] = mkdir(outpath); [status, errMsg] = mkdir(outpathtest);
if (status == 0) if (status == 0)
error(errMsg); error(errMsg);
end end
[nErr, nCases] = recurseDir(inpath, outpath, refpath, outfile, ... [nErr, nCases] = recurseDir(inpathtest, outpathtest, refpathtest, outfile, ...
progname, opt, simulateMode, nErr, nCases, task, casenumber, legacy); progname, opt, simulateMode, nErr, nCases, task, casenumber, legacy);
if strcmp(task, 'test') || strcmp(task, 'show') if strcmp(task, 'test') || strcmp(task, 'show')
@ -221,13 +220,13 @@ if nDirs == 0
if exist([inpath 'vqeEvent.dat']) if exist([inpath 'vqeEvent.dat'])
system(['ln -s -f ' inpath 'vqeEvent.dat ' eventFile]); system(['ln -s -f ' inpath 'vqeEvent.dat ' eventFile]);
elseif exist([inpath 'apm_event.day']) elseif exist([inpath 'apm_event.dat'])
system(['ln -s -f ' inpath 'apm_event.dat ' eventFile]); system(['ln -s -f ' inpath 'apm_event.dat ' eventFile]);
end end
if exist([inpath 'vqeBuf.dat']) if exist([inpath 'vqeBuf.dat'])
system(['ln -s -f ' inpath 'vqeBuf.dat ' delayFile]); system(['ln -s -f ' inpath 'vqeBuf.dat ' delayFile]);
elseif exist([inpath 'apm_delay.day']) elseif exist([inpath 'apm_delay.dat'])
system(['ln -s -f ' inpath 'apm_delay.dat ' delayFile]); system(['ln -s -f ' inpath 'apm_delay.dat ' delayFile]);
end end
@ -296,10 +295,6 @@ if nDirs == 0
diffvector); diffvector);
%spclab(fs, diffvector); %spclab(fs, diffvector);
end end
if vadTest == 1
spclab([refpath vadoutfile], [outpath vadoutfile]);
end
end end
end end
end end