* tests/skip_unavailable.c: New file.
* tests/tests.h (skip_if_unavailable): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add skip_unavailable.c.
printflags.c \
printxval.c \
signal2name.c \
+ skip_unavailable.c \
sprintrc.c \
tail_alloc.c \
tests.h \
--- /dev/null
+#include "tests.h"
+
+#include <sys/stat.h>
+#include <unistd.h>
+
+void
+skip_if_unavailable(const char *const path)
+{
+ struct stat st;
+
+ if (stat(path, &st))
+ perror_msg_and_skip("stat: %s", path);
+}
void perror_msg_and_skip(const char *, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
+/* Stat the specified file and skip the test if the stat call failed. */
+void skip_if_unavailable(const char *);
+
/*
* Allocate memory that ends on the page boundary.
* Pages allocated by this call are preceeded by an unmapped page