Mercurial > octave
changeset 30908:87de38eb52d9 stable
addpref.m: Recode BIST test to work with multiple running instances of Octave.
When running multiple instances of the Octave test suit (such as on the build
bots) there can be conflict over the file /tmp/.octave_prefs. Avoid that
conflict by having a per-Octave-instance directory.
* addpref.m: Use tempname() and mkdir() to create a per-Octave-instance
directory used for BIST test. Delete the temporary directory at the end
of the test.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 06 Apr 2022 14:54:05 -0700 |
parents | e4e7942cb8b7 |
children | a6eabdc177bc 1325f0c66460 |
files | scripts/prefs/addpref.m |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/prefs/addpref.m Wed Apr 06 10:29:27 2022 -0400 +++ b/scripts/prefs/addpref.m Wed Apr 06 14:54:05 2022 -0700 @@ -82,9 +82,11 @@ %!test %! HOME = getenv ("HOME"); +%! tmpdir = tempname (); %! save_default_options ("-binary", "local"); %! unwind_protect -%! setenv ("HOME", P_tmpdir ()); +%! mkdir (tmpdir); +%! setenv ("HOME", tmpdir); %! %! addpref ("group1", "pref1", [1 2 3]); %! assert (getpref ("group1", "pref1"), [1 2 3]); @@ -101,7 +103,8 @@ %! "preference prefA already exists in GROUP group2"); %! %! unwind_protect_cleanup -%! unlink (fullfile (P_tmpdir (), ".octave_prefs")); +%! unlink (fullfile (tmpdir, ".octave_prefs")); +%! rmdir (tmpdir); %! if (isempty (HOME)) %! unsetenv ("HOME"); %! else