strace/tests/skip_unavailable.c
Dmitry V. Levin 9f93fd094f tests: add skip_if_unavailable function to libtests
* tests/skip_unavailable.c: New file.
* tests/tests.h (skip_if_unavailable): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add skip_unavailable.c.
2017-04-19 02:16:31 +00:00

14 lines
197 B
C

#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);
}