diff libinterp/dldfcn/gzip.cc @ 22365:119f408f2dd1

Remove temporary directories and files used by BIST. * textread.m: reenable BIST (lines were commented) which allows reaching code that removes temporary files. * gzip.cc, unpack.m: remove directories after BIST. * zip.m: remove zip files, generated by zip(), after BIST. * savepath.m: remove temporary file at the end of test. Also, do not just check for octaverc on P_tmpdir and remove it, actually make a whole new directory for testing purposes.
author Carnë Draug <carandraug@octave.org>
date Tue, 23 Aug 2016 15:37:21 +0100
parents d71ae2cd510b
children 34ce5be04942
line wrap: on
line diff
--- a/libinterp/dldfcn/gzip.cc	Tue Aug 23 12:19:12 2016 +0100
+++ b/libinterp/dldfcn/gzip.cc	Tue Aug 23 15:37:21 2016 +0100
@@ -763,20 +763,27 @@
 %!  if (! mkdir (out_dirs{1}))
 %!    error ("unable to create directory for test");
 %!  endif
-%!  for idx = 1:numel(out_dirs)
-%!    out_dir = out_dirs{idx};
-%!    uz_file = fullfile (out_dir, filename);
-%!    z_file = [uz_file z.ext];
+%!  unwind_protect
+%!    for idx = 1:numel(out_dirs)
+%!      out_dir = out_dirs{idx};
+%!      uz_file = fullfile (out_dir, filename);
+%!      z_file = [uz_file z.ext];
+%!
+%!      z_filelist = z.zip (filepath, out_dir);
+%!      assert (z_filelist, {z_file})
+%!      assert (exist (z_file, "file"), 2)
 %!
-%!    z_filelist = z.zip (filepath, out_dir);
-%!    assert (z_filelist, {z_file})
-%!    assert (exist (z_file, "file"), 2)
+%!      uz_filelist = z.unzip (z_file);
+%!      assert (uz_filelist, {uz_file}) # bug #48598
 %!
-%!    uz_filelist = z.unzip (z_file);
-%!    assert (uz_filelist, {uz_file}) # bug #48598
-%!
-%!    assert (hash ("md5", fileread (uz_file)), md5)
-%!  endfor
+%!      assert (hash ("md5", fileread (uz_file)), md5)
+%!    endfor
+%!  unwind_protect_cleanup
+%!    confirm_recursive_rmdir (false, "local");
+%!    for idx = 1:numel(out_dirs)
+%!      rmdir (out_dirs{idx}, "s");
+%!    endfor
+%!  end_unwind_protect
 %!endfunction
 %!test run_test_function (@test_save_to_dir)
 */