driver - #include #include #include #include #include...

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 DocumentRight Arrow Icon
warnx("------: %s (unimplemented)", desc); } else {
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.

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Page1 / 5

driver - #include #include #include #include #include...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online