Mercurial > octave
diff libinterp/corefcn/help.cc @ 27361:a7d21a6a7922 stable
BIST should not rely on the current directory to be writable.
* libinterp/corefcn/help.cc: Change to "tempdir" before executing the test
to ensure a writable directory. Change to previous directory on cleanup.
Determine the function name using "fileparts" rather than hard coded truncation.
* libinterp/corefcn/variables.cc: Change to "tempdir" before executing the test
to ensure a writable directory. Change to previous directory on cleanup.
Two tests in the modified files are failing in a Linux distribution installed
version of GNU Octave when running "__run_test_suite__". "__run_test_suite__"
changes the current directory "pwd" to those owned by root usually, e.g.
"/usr/share/...". Therefore, a non-root Octave session is not able to create
files in those directories.
These errors do not occur, if the test suite directory is owned by the user of
the octave session or the test file is called directly from some writeable
directory. Which is usually the case for custom or development builds.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Sat, 31 Aug 2019 15:00:42 +0900 |
parents | 088b8a2dcb06 |
children | 682695bd0e98 7db34a40cd23 |
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc Thu Aug 29 17:17:13 2019 +0900 +++ b/libinterp/corefcn/help.cc Sat Aug 31 15:00:42 2019 +0900 @@ -841,8 +841,9 @@ /* %!test +%! old_dir = cd (tempdir ()); %! f = tempname (".", "oct_"); -%! fcn_name = f(3:end); +%! [~, fcn_name] = fileparts (f); %! f = [f ".m"]; %! unwind_protect %! fid = fopen (f, "w+"); @@ -856,6 +857,7 @@ %! assert (d{2} (3), 6); %! unwind_protect_cleanup %! unlink (f); +%! cd (old_dir); %! end_unwind_protect */