test suite: add timing, report 10 slowest tests. #298

time-shift
Houtan Bastani 2015-09-08 16:05:14 +02:00
parent 268384572b
commit 5c006a4370
8 changed files with 48 additions and 5 deletions

View File

@ -8,6 +8,7 @@ declare -a failed_tests=("");
declare -a xpassed_tests=("");
# Parse TRS Files
tosort=""
for file in $1 ; do
# Find number of tests run in trs file
((total += `grep number-tests $file | cut -d: -f3`))
@ -20,6 +21,9 @@ for file in $1 ; do
failed_tests=("${failed_tests[@]}" "$failedfile");
done
fi
time=`grep cputime $file | cut -d: -f3`
tosort=`echo $tosort\| $file ' - ' $time:`
done
((passed=$total-$failed));
@ -37,10 +41,15 @@ for file in $2 ; do
xpassed_tests=("${xpassed_tests[@]}" "$xpassedfile");
done
fi
time=`grep cputime $file | cut -d: -f3`
tosort=`echo $tosort\| $file ' - ' $time:`
done
((xfailed=$total_xfail-$xpassed));
((total+=$total_xfail));
timing=`echo $tosort | tr ":" "\n" | sort -rn -k4 | sed -e 's/$/:/' | head -n10`
# Determine if we are parsing Matlab or Octave trs files
if [ `grep -c '.m.trs' <<< $1` -eq 0 ]; then
prg='OCTAVE';
@ -81,4 +90,12 @@ if [ $xpassed -gt 0 ] ; then
echo '| * '$modfile >> $outfile
done
fi
echo '|' >> $outfile
echo '| LIST OF 10 SLOWEST TESTS:' >> $outfile
if [ "$prg" == "MATLAB" ]; then
timing=`sed 's/\.m\.trs/\.mod/g' <<< $timing`
else
timing=`sed 's/\.o\.trs/\.mod/g' <<< $timing`
fi
echo $timing | tr ':' '\n' | sed -e 's/^[ \t]*//' | sed '/^$/d' >> $outfile
echo >> $outfile

View File

@ -43,5 +43,6 @@ else
fprintf(fid,':number-tests: %d\n', counter);
fprintf(fid,':number-failed-tests: 0\n');
end
fprintf(fid,':cputime: %f\n',0.0);
fclose(fid);
exit

View File

@ -38,6 +38,7 @@ failedBlock = {};
num_block_tests = 0;
cd([top_test_dir filesep 'block_bytecode']);
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
cput = cputime;
for blockFlag = 0:1
for bytecodeFlag = 0:1
default_solve_algo = 2;
@ -128,6 +129,7 @@ for blockFlag = 0:1
end
end
end
ecput = cputime - cput;
delete('wsMat.mat')
cd(getenv('TOP_TEST_DIR'));
fid = fopen('run_block_byte_tests_matlab.m.trs', 'w+');
@ -141,5 +143,6 @@ else
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: 0\n');
end
fprintf(fid,':cputime: %f\n', ecput);
fclose(fid);
exit;

View File

@ -40,6 +40,7 @@ putenv("GNUTERM", "dumb")
failedBlock = {};
num_block_tests = 0;
cd([top_test_dir filesep 'block_bytecode']);
cput = cputime;
for blockFlag = 0:1
for bytecodeFlag = 0:1
## Recall that solve_algo=7 and stack_solve_algo=2 are not supported
@ -130,8 +131,8 @@ for blockFlag = 0:1
endfor
endfor
endfor
ecput = cputime - cput;
delete('wsOct');
cd(getenv('TOP_TEST_DIR'));
fid = fopen('run_block_byte_tests_octave.o.trs', 'w+');
if size(failedBlock,2) > 0
@ -144,6 +145,7 @@ else
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: 0\n');
end
fprintf(fid,':cputime: %f\n', ecput);
fclose(fid);
## Local variables:
## mode: Octave

View File

@ -57,5 +57,6 @@ else
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-passed-tests: run_reporting_test_matlab.m\n');
end
fprintf(fid,':cputime: %f\n',0.0);
fclose(fid);
exit;
exit;

View File

@ -61,6 +61,7 @@ else
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-passed-tests: run_reporting_test_octave.m\n');
end
fprintf(fid,':cputime: %f\n',0.0);
fclose(fid);
## Local variables:

View File

@ -31,6 +31,9 @@ cd(directory);
disp('');
disp(['*** TESTING: ' modfile ' ***']);
cput = cputime;
save(['wsMat' testfile '.mat']);
try
dynare([testfile ext], 'console')
testFailed = false;
@ -38,8 +41,14 @@ catch exception
printMakeCheckMatlabErrMsg(strtok(getenv('FILESTEM')), exception);
testFailed = true;
end
top_test_dir = getenv('TOP_TEST_DIR');
[modfile, name] = strtok(getenv('FILESTEM'));
[directory, testfile, ext] = fileparts([top_test_dir '/' modfile]);
load(['wsMat' testfile '.mat']);
ecput = cputime - cput;
delete(['wsMat' testfile '.mat']);
cd(getenv('TOP_TEST_DIR'));
cd(top_test_dir);
name = strtok(getenv('FILESTEM'));
fid = fopen([name '.m.trs'], 'w');
if fid < 0
@ -58,5 +67,6 @@ else
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-passed-tests: %s\n', [name '.mod']);
end
fprintf(fid,':cputime: %f\n', ecput);
fclose(fid);
exit;

View File

@ -38,8 +38,11 @@ setenv("GNUTERM", "dumb");
name = getenv("FILESTEM");
[directory, testfile, ext] = fileparts([top_test_dir '/' name]);
cd(directory);
printf("\n*** TESTING: %s ***\n", name);
cput = cputime;
save(['wsOct' testfile '.mat']);
try
dynare([testfile ext])
testFailed = false;
@ -47,10 +50,14 @@ catch
printMakeCheckOctaveErrMsg(getenv("FILESTEM"), lasterror);
testFailed = true;
end_try_catch
top_test_dir = getenv('TOP_TEST_DIR');
cd(top_test_dir);
name = getenv("FILESTEM");
[directory, testfile, ext] = fileparts([top_test_dir '/' name]);
load(['wsOct' testfile '.mat']);
ecput = cputime - cput;
delete(['wsOct' testfile '.mat']);
cd(top_test_dir);
fid = fopen([name '.o.trs'], 'w+');
if testFailed
fprintf(fid,':test-result: FAIL\n');
@ -63,6 +70,7 @@ else
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-passed-tests: %s\n', [name '.mod']);
end
fprintf(fid,':cputime: %f\n', ecput);
fclose(fid);
## Local variables: