Mercurial > octave
changeset 25007:2f695cf8af6f stable
test: reduce relative file names in test suite output
* __run_test_suite__.m: Reduce relative file names to eliminate build directory
name and "scripts" prefix from file names in test suite output.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Mon, 26 Mar 2018 15:16:07 -0700 |
parents | ddb4bc5fccaa |
children | 11ab997e76ce |
files | scripts/testfun/__run_test_suite__.m |
diffstat | 1 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/__run_test_suite__.m Mon Mar 26 14:55:43 2018 -0700 +++ b/scripts/testfun/__run_test_suite__.m Mon Mar 26 15:16:07 2018 -0700 @@ -231,8 +231,7 @@ p = n = xf = xb = 0; ## Only run if contains %!test, %!assert, %!error, %!fail, or %!warning if (has_tests (f)) - tmp = strrep (f, [topsrcdir, filesep], ""); - tmp = strrep (tmp, [topbuilddir, filesep], ""); + tmp = reduce_test_file_name (f, topbuilddir, topsrcdir); print_test_file_name (tmp); [p, n, xf, xb, sk, rtsk, rgrs] = test (f, "quiet", fid); print_pass_fail (p, n, xf, xb, sk, rtsk, rgrs); @@ -290,6 +289,25 @@ endfunction +function retval = reduce_test_file_name (nm, builddir, srcdir) + + ## Reduce the given absolute file name to a relative path by removing one + ## of the likely root directory prefixes. + + prefix = { builddir, fullfile(builddir, "scripts"), ... + srcdir, fullfile(srcdir, "scripts") }; + + retval = nm; + + for i = 1:length (prefix) + tmp = strrep (nm, [prefix{i}, filesep], ""); + if (length (tmp) < length (retval)) + retval = tmp; + endif + endfor + +endfunction + function retval = has_functions (f) n = length (f);