{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

driver -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <err.h> #include "config.h" #include "test.h" //////////////////////////////////////////////////////////// static int finderror(int rv, int error) { if (rv==-1) { return error; } else { return 0; } } void report_survival(int rv, int error, const char *desc) { /* allow any error as long as we survive */ errno = finderror(rv, error); warn("passed: %s", desc); } void report_test(int rv, int error, int right_error, const char *desc) { int goterror = finderror(rv, error); if (goterror == right_error) { warnx("passed: %s", desc); } else if (goterror == EUNIMP || goterror == ENOSYS) { warnx("------: %s (unimplemented)", desc); } else { errno = goterror; warn("FAILURE: %s", desc); } } void report_test2(int rv, int error, int okerr1, int okerr2, const char *desc) { int goterror = finderror(rv, error); if (goterror == okerr1 || goterror == okerr2) { warnx("passed: %s", desc); } else if (goterror == EUNIMP || goterror == ENOSYS) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
warnx("------: %s (unimplemented)", desc); } else { errno = goterror; warn("FAILURE: %s", desc); } } //////////////////////////////////////////////////////////// int open_testfile(const char *string) { int fd, rv; size_t len; fd = open(TESTFILE, O_RDWR|O_CREAT|O_TRUNC); if (fd<0) {
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}