update from texinfo
[gnulib.git] / tests / test-stat-time.c
index 0f78886..907ba4b 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
 
 enum { NFILES = 4 };
 
@@ -84,12 +93,12 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes)
   sleep (2);
   create_file ("t-stt-stamp2");
   sleep (2);
-  ASSERT (rename ("t-stt-testfile", "t-stt-renamed") == 0);
+  ASSERT (chmod ("t-stt-testfile", 0400) == 0);
   sleep (2);
   create_file ("t-stt-stamp3");
 
   do_stat ("t-stt-stamp1",  &statinfo[0]);
-  do_stat ("t-stt-renamed", &statinfo[1]);
+  do_stat ("t-stt-testfile", &statinfo[1]);
   do_stat ("t-stt-stamp2",  &statinfo[2]);
   do_stat ("t-stt-stamp3",  &statinfo[3]);
 
@@ -164,6 +173,7 @@ main ()
   signal (SIGTERM, cleanup);
 #endif
 
+  cleanup (0);
   prepare_test (statinfo, modtimes);
   test_mtime (statinfo, modtimes);
   test_birthtime (statinfo, modtimes, birthtimes);