コード例 #1
0
ファイル: report.c プロジェクト: SidhantDuggal/os161hack
static
int
report_checkN(int rv, int error, int *right_errors, int right_num)
{
	int i, goterror;
	int result = 1;

	if (rv==-1) {
		goterror = error;
	}
	else {
		goterror = 0;
	}

	for (i=0; i<right_num; i++) {
		if (goterror == right_errors[i]) {
			report_result(rv, error);
			report_passed(&result);
			return result;
		}
	}

	if (goterror == ENOSYS) {
		report_saw_enosys();
		say("(unimplemented) ");
		report_skipped(&result);
	}
	else {
		report_result(rv, error);
		report_failure(&result);
	}
	return result;
}
コード例 #2
0
ファイル: driver.c プロジェクト: MartinoMensio/os161
/*
 * Note: unlike everything else this calls skipped/aborted, because
 * otherwise it has to communicate to the caller which to call and
 * that's a pain.
 */
int
create_testdir(void)
{
	int rv;
	rv = mkdir(TESTDIR, 0775);
	if (rv<0) {
		if (errno == ENOSYS) {
			report_saw_enosys();
			report_warnx("mkdir unimplemented; cannot run test");
			report_skipped();
		}
		else {
			report_warn("mkdir %s failed", TESTDIR);
			report_aborted();
		}
		return -1;
	}
	return 0;
}
コード例 #3
0
ファイル: bad_waitpid.c プロジェクト: SidhantDuggal/os161hack
static
int
wait_badpid(pid_t pid, const char *desc)
{
	pid_t rv;
	int x;
	int err;

	report_begin(desc);
	rv = waitpid(pid, &x, 0);
	err = errno;
	/* Allow ENOSYS for 0 or negative values of pid only */
	if (pid <= 0 && rv == -1 && err == ENOSYS) {
		err = ESRCH;
	}
	else if (err == ENOSYS) {
		report_saw_enosys();
	}
	return report_check2(rv, err, ESRCH, ECHILD);
}