[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp f
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files |
Date: |
Thu, 11 Jan 2024 12:53:45 -0500 (EST) |
Follow-up Comment #2, bug#65150 (group octave):
What do you think about this alternative change? It avoids a new global
variable:
diff -r d970ec60aa64 test/io.tst
--- a/test/io.tst Wed Jan 10 17:54:55 2024 -0500
+++ b/test/io.tst Thu Jan 11 18:51:16 2024 +0100
@@ -27,7 +27,7 @@
## saving sparse matrices to MAT files when using 64-bit indexing since
## that is not implemented yet.
-%!function [ret, files] = testls (input)
+%!function [ret, files] = testls (input, t_pfix)
%! ## flag a1 global so as to test the storage of global flags
%! global a1;
%!
@@ -81,9 +81,7 @@
%!
%! ret = 0;
%!
-%! files = cellfun (@fullfile, {P_tmpdir},
-%! {"text.mat", "binary.mat", "mat5.mat", "mat7.mat"},
-%! "UniformOutput", false);
+%! files = fullfile (t_pfix, {"text.mat", "binary.mat", "mat5.mat",
"mat7.mat"});
%! opts = {"-z -text", "-z -binary", "-z -mat", "-v7"};
%! tols = {2*eps, 0, 0, 0};
%!
@@ -192,15 +190,21 @@
%!testif HAVE_ZLIB
%!
-%! [save_status, save_files] = testls (0);
-%! [load_status, load_files] = testls (1);
+%! ## Random prefix for files
+%! t_pfix = tempname ();
+%! mkdir (t_pfix);
%!
-%! for f = [save_files, load_files]
-%! sts = unlink (f{1});
-%! endfor
+%! unwind_protect
+%! [save_status, save_files] = testls (0, t_pfix);
+%! [load_status, load_files] = testls (1, t_pfix);
+%! unwind_protect_cleanup
+%! ## cleanup after test
+%! confirm_recursive_rmdir (false, "local");
+%! rmdir (t_pfix, "s");
+%! clear -global a1;
+%! end_unwind_protect
%!
%! assert (save_status && load_status);
-%! clear -global a1; # cleanup after test
%!testif HAVE_HDF5
%!
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65150>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Dmitri A. Sergatskov, 2024/01/10
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Dmitri A. Sergatskov, 2024/01/11
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files,
Markus Mützel <=
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Rik, 2024/01/11
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Dmitri A. Sergatskov, 2024/01/11
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Markus Mützel, 2024/01/13
- [Octave-bug-tracker] [bug #65150] io.tst uses non-unique names for tmp files, Rik, 2024/01/15