/* * Test a set of privileged instructions. Returns: * -2 if fork() failed. * -1 if at least one test failed. (TEST FAILURE) * 0 if there were no tests for the compiled architecture. (Not Tested.) * n where n (> 0) is the number of tests done. (SUCCESS) */ int amt_priv(int verbose) { struct priv_test *ptp; int tcnt; for (tcnt = 0, ptp = &priv_tests[0]; ptp->pt_fp != NULL; ptp++) { if (verbose) printf("\tSubtest %d. %s (%s): ", tcnt + 1, ptp->pt_inst, ptp->pt_desc); if (fault_test(verbose, ptp->pt_fp, NULL, ptp->pt_result) == 1) tcnt++; else /* This test failed. No need to test more. */ return (-1); } /* Return the number of tests done. */ return (tcnt); }
int main(int argc, char **argv) { (void) printf("Congrats! You're running this executable.\n"); (void) printf("Now let's see how you handle the tests...\n"); mmap_test(); null_test(); zero_test(); brk_test(); fault_test(); wait_test(); cow_fork(); fork_test(); return 0; }