bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

access tests: Fix test failure on native Windows


From: Bruno Haible
Subject: access tests: Fix test failure on native Windows
Date: Mon, 30 Nov 2020 23:35:57 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

On native Windows, the first run of 'test-access.exe' succeeds, but the
second and subsequent runs fail. The cause is a left-over file
'test-access.tf2' with mode 'r-xr-xr-x'.

The original mistake is that we did not check the success of one of the cleanup
statements. This patch fixes it.


2020-11-30  Bruno Haible  <bruno@clisp.org>

        access tests: Fix test failure on native Windows.
        * tests/test-access.c (main): Change permissions of f2 file before
        attempting to remove it.

diff --git a/tests/test-access.c b/tests/test-access.c
index 76d1455..1c23892 100644
--- a/tests/test-access.c
+++ b/tests/test-access.c
@@ -40,6 +40,7 @@ main ()
   /* Remove anything from prior partial run.  */
   unlink (BASE "f");
   unlink (BASE "f1");
+  chmod (BASE "f2", 0600);
   unlink (BASE "f2");
 
   {
@@ -86,8 +87,9 @@ main ()
   }
 
   /* Cleanup.  */
-  unlink (BASE "f1");
-  unlink (BASE "f2");
+  ASSERT (unlink (BASE "f1") == 0);
+  ASSERT (chmod (BASE "f2", 0600) == 0);
+  ASSERT (unlink (BASE "f2") == 0);
 
   return 0;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]