bootstrap: fix handling of various perl --version formats
[gnulib.git] / tests / test-open.c
index c9f3641..37109a5 100644 (file)
 
 #include <fcntl.h>
 
+#include <errno.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-
-#if GNULIB_FCNTL_SAFER
-# include "fcntl--.h"
-#endif
+#include <unistd.h>
 
 #define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
+  do                                                                         \
+    {                                                                        \
+      if (!(expr))                                                           \
+        {                                                                    \
           fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
+          fflush (stderr);                                                   \
+          abort ();                                                          \
+        }                                                                    \
+    }                                                                        \
   while (0)
 
-int
-main ()
-{
-  ASSERT (open ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) < 0);
-  ASSERT (open ("/dev/null/", O_RDONLY) < 0);
+#define BASE "test-open.t"
 
-  ASSERT (open ("/dev/null", O_RDONLY) >= 0);
+#include "test-open.h"
 
-  return 0;
+int
+main (void)
+{
+  return test_open (open, true);
 }