• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ATF_REQUIRE_MSG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ATF_REQUIRE_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ ATF_REQUIRE_MSG函数的具体用法?C++ ATF_REQUIRE_MSG怎么用?C++ ATF_REQUIRE_MSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ATF_REQUIRE_MSG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: print_shmid_ds

void
print_shmid_ds(struct shmid_ds *sp, mode_t mode)
{
	uid_t uid = geteuid();
	gid_t gid = getegid();

	printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n",
	    sp->shm_perm.uid, sp->shm_perm.gid,
	    sp->shm_perm.cuid, sp->shm_perm.cgid,
	    sp->shm_perm.mode & 0777);

	printf("segsz %lu, lpid %d, cpid %d, nattch %u\n",
	    (u_long)sp->shm_segsz, sp->shm_lpid, sp->shm_cpid,
	    sp->shm_nattch);

	printf("atime: %s", ctime(&sp->shm_atime));
	printf("dtime: %s", ctime(&sp->shm_dtime));
	printf("ctime: %s", ctime(&sp->shm_ctime));

	/*
	 * Sanity check a few things.
	 */

	ATF_REQUIRE_MSG(sp->shm_perm.uid == uid && sp->shm_perm.cuid == uid,
	    "uid mismatch");

	ATF_REQUIRE_MSG(sp->shm_perm.gid == gid && sp->shm_perm.cgid == gid,
	    "gid mismatch");

	ATF_REQUIRE_MSG((sp->shm_perm.mode & 0777) == mode, "mode mismatch");
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:31,代码来源:t_sysv.c


示例2: ATF_TC_BODY

ATF_TC_BODY(symbol_lookup_fail, tc)
{
	char symname[32];
	GElf_Sym sym;
	struct proc_handle *phdl;
	prmap_t *map;
	int error;

	phdl = start_prog(tc, false);

	/* Initialize the rtld_db handle. */
	(void)proc_rdagent(phdl);

	map = proc_name2map(phdl, target_prog_file);
	ATF_REQUIRE_MSG(map != NULL, "failed to look up map for '%s'",
	    target_prog_file);

	/*
	 * We shouldn't be able to find symbols at the beginning of a mapped
	 * file.
	 */
	error = proc_addr2sym(phdl, map->pr_vaddr, symname, sizeof(symname),
	    &sym);
	ATF_REQUIRE_MSG(error != 0, "unexpectedly found a symbol");

	ATF_CHECK_EQ_MSG(proc_continue(phdl), 0, "failed to resume execution");

	proc_free(phdl);
}
开发者ID:mulichao,项目名称:freebsd,代码行数:29,代码来源:proc_test.c


示例3: print_msqid_ds

void
print_msqid_ds(struct msqid_ds *mp, mode_t mode)
{
	uid_t uid = geteuid();
	gid_t gid = getegid();

	printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n",
	    mp->msg_perm.uid, mp->msg_perm.gid,
	    mp->msg_perm.cuid, mp->msg_perm.cgid,
	    mp->msg_perm.mode & 0777);

	printf("qnum %lu, qbytes %lu, lspid %d, lrpid %d\n",
	    mp->msg_qnum, (u_long)mp->msg_qbytes, mp->msg_lspid,
	    mp->msg_lrpid);

	printf("stime: %s", ctime(&mp->msg_stime));
	printf("rtime: %s", ctime(&mp->msg_rtime));
	printf("ctime: %s", ctime(&mp->msg_ctime));

	/*
	 * Sanity check a few things.
	 */

	ATF_REQUIRE_MSG(mp->msg_perm.uid == uid && mp->msg_perm.cuid == uid,
	    "uid mismatch");

	ATF_REQUIRE_MSG(mp->msg_perm.gid == gid && mp->msg_perm.cgid == gid,
	    "gid mismatch");

	ATF_REQUIRE_MSG((mp->msg_perm.mode & 0777) == mode, "mode mismatch");
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:31,代码来源:t_sysv.c


示例4: print_semid_ds

void
print_semid_ds(struct semid_ds *sp, mode_t mode)
{
	uid_t uid = geteuid();
	gid_t gid = getegid();

	printf("PERM: uid %d, gid %d, cuid %d, cgid %d, mode 0%o\n",
	    sp->sem_perm.uid, sp->sem_perm.gid,
	    sp->sem_perm.cuid, sp->sem_perm.cgid,
	    sp->sem_perm.mode & 0777);

	printf("nsems %u\n", sp->sem_nsems);

	printf("otime: %s", ctime(&sp->sem_otime));
	printf("ctime: %s", ctime(&sp->sem_ctime));

	/*
	 * Sanity check a few things.
	 */

	ATF_REQUIRE_MSG(sp->sem_perm.uid == uid && sp->sem_perm.cuid == uid,
	    "uid mismatch");

	ATF_REQUIRE_MSG(sp->sem_perm.gid == gid && sp->sem_perm.cgid == gid,
	    "gid mismatch");

	ATF_REQUIRE_MSG((sp->sem_perm.mode & 0777) == mode,
	    "mode mismatch %o != %o", (sp->sem_perm.mode & 0777), mode);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:29,代码来源:t_sysv.c


示例5: ATF_TC_BODY

ATF_TC_BODY(fork_wait__signals, tc)
{
    ATF_REQUIRE_MSG(LAST_SIGNO > 10, "LAST_SIGNO as detected by configure is "
                    "suspiciously low");

    int signo;
    for (signo = 1; signo <= LAST_SIGNO; signo++) {
        if (signo == SIGKILL || signo == SIGSTOP) {
            // Ignore immutable signals.
            continue;
        }
        if (signo == SIGCHLD) {
            // If we were to reset SIGCHLD to SIG_IGN (which is different than
            // not touching the signal at all, leaving it at its default value),
            // our child process will not become a zombie and the call to
            // kyua_run_wait will fail.  Avoid this.
            continue;
        }

        struct sigaction sa;
        sa.sa_handler = SIG_IGN;
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = 0;
        printf("Ignoring signal %d\n", signo);
        ATF_REQUIRE(sigaction(signo, &sa, NULL) != -1);
    }

    ATF_REQUIRE_MSG(fork_check(NULL, check_signals, NULL),
                    "Signals not reset to their default state");
}
开发者ID:s5unty,项目名称:kyua,代码行数:30,代码来源:run_test.c


示例6: ATF_TC_BODY

ATF_TC_BODY(fork, tc)
{
	pthread_t p;
	pid_t fork_pid;

	parent = getpid();

	PTHREAD_REQUIRE(pthread_create(&p, NULL, print_pid, NULL));

	fork_pid = fork();
	ATF_REQUIRE(fork_pid != -1);

	if (fork_pid) {
		int status;

		PTHREAD_REQUIRE(pthread_join(p, NULL));
		ATF_REQUIRE_MSG(thread_survived, "thread did not survive in parent");

		waitpid(fork_pid, &status, 0);
		ATF_REQUIRE_MSG(WIFEXITED(status), "child died wrongly");
		ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), 0, "thread survived in child");
	} else {
		sleep(5);
#ifdef __FreeBSD__
		_exit(thread_survived ? 1 : 0);
#else
		exit(thread_survived ? 1 : 0);
#endif
	}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:30,代码来源:t_fork.c


示例7: get_ftok

key_t get_ftok(int id)
{
    int fd;
    char token_key[64], token_dir[64];
    char *tmpdir;
    key_t key;

    strlcpy(token_key, "/tmp/t_sysv.XXXXXX", sizeof(token_key));
    tmpdir = mkdtemp(token_key);
    ATF_REQUIRE_MSG(tmpdir != NULL, "mkdtemp() failed: %d", errno);

    strlcpy(token_dir, tmpdir, sizeof(token_dir));
    strlcpy(token_key, tmpdir, sizeof(token_key));
    strlcat(token_key, "/token_key", sizeof(token_key));

    /* Create the file, since ftok() requires it to exist! */

    fd = open(token_key, O_RDWR | O_CREAT | O_EXCL);
    if (fd == -1) {
        rmdir(tmpdir);
        atf_tc_fail("open() of temp file failed: %d", errno);
        return (key_t)-1;
    } else
        close(fd);

    key = ftok(token_key, id);

    ATF_REQUIRE_MSG(unlink(token_key) != -1, "unlink() failed: %d", errno);
    ATF_REQUIRE_MSG(rmdir(token_dir) != -1, "rmdir() failed: %d", errno);

    return key;
}
开发者ID:wieck,项目名称:minix,代码行数:32,代码来源:t_sysv.c


示例8: h_check

static void
h_check(int test)
{
	struct sigaction sa;
	jmp_buf jb;
	sigjmp_buf sjb;
	sigset_t ss;
	int i, x;

	myself = pthread_self();
	i = getpid();

	if (test == TEST_SETJMP || test == TEST_SIGSETJMP_SAVE)
		expectsignal = 0;
	else if (test == TEST_U_SETJMP || test == TEST_SIGSETJMP_NOSAVE)
		expectsignal = 1;
	else
		atf_tc_fail("unknown test");

	sa.sa_handler = aborthandler;
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = 0;
	REQUIRE_ERRNO(sigaction(SIGABRT, &sa, NULL) != -1);
	REQUIRE_ERRNO(sigemptyset(&ss) != -1);
	REQUIRE_ERRNO(sigaddset(&ss, SIGABRT) != -1);
	REQUIRE_ERRNO(sigprocmask(SIG_BLOCK, &ss, NULL) != -1);
	ATF_REQUIRE(myself == pthread_self());

	if (test == TEST_SETJMP)
		x = setjmp(jb);
	else if (test == TEST_U_SETJMP)
		x = _setjmp(jb);
	else 
		x = sigsetjmp(sjb, !expectsignal);

	if (x != 0) {
		ATF_REQUIRE(myself == pthread_self());
		ATF_REQUIRE_MSG(x == i, "setjmp returned wrong value");
		kill(i, SIGABRT);
		ATF_REQUIRE_MSG(!expectsignal, "kill(SIGABRT) failed");
		ATF_REQUIRE(myself == pthread_self());
		atf_tc_pass();
	}

	ATF_REQUIRE(myself == pthread_self());
	REQUIRE_ERRNO(sigprocmask(SIG_UNBLOCK, &ss, NULL) != -1);

	if (test == TEST_SETJMP)
		longjmp(jb, i);
	else if (test == TEST_U_SETJMP)
		_longjmp(jb, i);
	else 
		siglongjmp(sjb, i);

	atf_tc_fail("jmp failed");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:56,代码来源:t_threadjmp.c


示例9: run

static void *
run(void *param)
{
	struct timespec ts, to, te;
	clockid_t clck;
	pthread_condattr_t attr;
	pthread_cond_t cond;
	pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
	int ret = 0;


	clck = *(clockid_t *)param;
	pthread_condattr_init(&attr);
	pthread_condattr_setclock(&attr, clck); /* MONOTONIC or MONOTONIC */
	pthread_cond_init(&cond, &attr);

	ATF_REQUIRE_EQ((ret = pthread_mutex_lock(&m)), 0);

	ATF_REQUIRE_EQ(clock_gettime(clck, &ts), 0);
	to = ts;

	if (debug)
		printf("started: %lld.%09ld sec\n", (long long)to.tv_sec,
		    to.tv_nsec);

	ts.tv_sec += WAITTIME;	/* Timeout wait */

	switch (ret = pthread_cond_timedwait(&cond, &m, &ts)) {
	case ETIMEDOUT:
		/* Timeout */
		ATF_REQUIRE_EQ(clock_gettime(clck, &te), 0);
		timespecsub(&te, &to, &to);
		if (debug) {
			printf("timeout: %lld.%09ld sec\n",
			    (long long)te.tv_sec, te.tv_nsec);
			printf("elapsed: %lld.%09ld sec\n",
			    (long long)to.tv_sec, to.tv_nsec);
		}
		if (isQEMU()) {
			double to_seconds = to.tv_sec + 1e-9 * to.tv_nsec;
			ATF_REQUIRE(to_seconds >= WAITTIME * 0.9);
			/* Loose upper limit because of qemu timing bugs */
			ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
		} else {
			ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
		}
		break;
	default:
		ATF_REQUIRE_MSG(0, "pthread_cond_timedwait: %s", strerror(ret));
	}

	ATF_REQUIRE_MSG(!(ret = pthread_mutex_unlock(&m)),
	    "pthread_mutex_unlock: %s", strerror(ret));
	pthread_exit(&ret);
}
开发者ID:Hooman3,项目名称:minix,代码行数:55,代码来源:t_condwait.c


示例10: ATF_TC_BODY

ATF_TC_BODY(aio_fifo_test, tc)
{
	int error, read_fd = -1, write_fd = -1;
	struct aio_fifo_arg arg;
	char pathname[PATH_MAX];
	struct aio_context ac;

	ATF_REQUIRE_KERNEL_MODULE("aio");
	ATF_REQUIRE_UNSAFE_AIO();

	/*
	 * In theory, mkstemp() can return a name that is then collided with.
	 * Because this is a regression test, we treat that as a test failure
	 * rather than retrying.
	 */
	strcpy(pathname, PATH_TEMPLATE);
	ATF_REQUIRE_MSG(mkstemp(pathname) != -1,
	    "mkstemp failed: %s", strerror(errno));
	ATF_REQUIRE_MSG(unlink(pathname) == 0,
	    "unlink failed: %s", strerror(errno));
	ATF_REQUIRE_MSG(mkfifo(pathname, 0600) != -1,
	    "mkfifo failed: %s", strerror(errno));
	arg.afa_pathname = pathname;
	arg.afa_read_fd = -1;
	arg.afa_write_fd = -1;

	read_fd = open(pathname, O_RDONLY | O_NONBLOCK);
	if (read_fd == -1) {
		error = errno;
		aio_fifo_cleanup(&arg);
		errno = error;
		atf_tc_fail("read_fd open failed: %s",
		    strerror(errno));
	}
	arg.afa_read_fd = read_fd;

	write_fd = open(pathname, O_WRONLY);
	if (write_fd == -1) {
		error = errno;
		aio_fifo_cleanup(&arg);
		errno = error;
		atf_tc_fail("write_fd open failed: %s",
		    strerror(errno));
	}
	arg.afa_write_fd = write_fd;

	aio_context_init(&ac, read_fd, write_fd, FIFO_LEN,
	    FIFO_TIMEOUT, aio_fifo_cleanup, &arg);
	aio_write_test(&ac);
	aio_read_test(&ac);

	aio_fifo_cleanup(&arg);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:53,代码来源:aio_test.c


示例11: ATF_TC_BODY

ATF_TC_BODY(perror_test, tc)
{
	char buf[512], lbuf[512];
	int i;
	char *s;

	strcpy(tmpfil, "perror.XXXXXXXX");
	ATF_REQUIRE(mkstemp(tmpfil) >= 0);
	/* Reopen stderr on a file descriptor other than 2. */
	fclose(stderr);
	for (i = 0; i < 3; i++)
		dup(0);
	ATF_REQUIRE(freopen(tmpfil, "r+", stderr) != NULL);

	/*
	 * Test that perror() doesn't call strerror() (4.4BSD bug),
	 * the two ways of omitting a program name, and the formatting when
	 * a program name is specified.
	 */
	s = strerror(ENOENT);
	ATF_REQUIRE_MSG(strcmp(s, "No such file or directory") == 0,
	    "message obtained was: %s", s);
	errno = EPERM;
	perror(NULL);
	perror("");
	perror("perror_test");
	ATF_REQUIRE_MSG(strcmp(s, "No such file or directory") == 0,
	    "message obtained was: %s", s);

	/*
	 * Read it back to check...
	 */
	rewind(stderr);
	s = fgets(lbuf, sizeof(lbuf), stderr);
	ATF_REQUIRE(s != NULL);
	ATF_REQUIRE_MSG(strcmp(s, "Operation not permitted\n") == 0,
	    "message obtained was: %s", s);
	s = fgets(lbuf, sizeof(lbuf), stderr);
	ATF_REQUIRE(s != NULL);
	ATF_REQUIRE_MSG(strcmp(s, "Operation not permitted\n") == 0,
	    "message obtained was: %s", s);
	s = fgets(lbuf, sizeof(lbuf), stderr);
	ATF_REQUIRE(s != NULL);
	ATF_REQUIRE_MSG(
	    strcmp(s, "perror_test: Operation not permitted\n") == 0,
	    "message obtained was: %s", s);
	s = fgets(lbuf, sizeof(lbuf), stderr);
	ATF_REQUIRE(s == NULL);
	fclose(stderr);

}
开发者ID:hbsciw,项目名称:freebsd,代码行数:51,代码来源:perror_test.c


示例12: ATF_TC_BODY

ATF_TC_BODY(data_string_new, tc) {
    struct data_string new_string;
    const char *src = "Really? Latin? ... geeks";
    int len_arg = 0;
    const char *error;

    /* Case 1: Call with an invalid data_string pointer, should fail */
    if (data_string_new(NULL, src, len_arg, MDL)) {
        atf_tc_fail("case 1: call should have failed");
    }

    /* Case 2: Passing in NULL src should fail */
    if (data_string_new(&new_string, NULL, 10, MDL)) {
        atf_tc_fail("case 2: did not return success");
    }

    /* Case 3: Call with valid params, length includes NULL */
    len_arg = strlen(src) + 1;
    if (data_string_new(&new_string, src, len_arg, MDL) == 0) {
        atf_tc_fail("case 3: did not return success");
    }

    error = checkString(&new_string, src);
    ATF_REQUIRE_MSG((error == NULL), "case 3: %s", error);
    data_string_forget(&new_string, MDL);


    /* Case 4: Call with valid params, length does not include NULL */
    len_arg = 7;
    if (data_string_new(&new_string, src, len_arg, MDL) == 0) {
        atf_tc_fail("case 4: did not return success");
    }

    error = checkString(&new_string, "Really?");
    ATF_REQUIRE_MSG((error == NULL), "case 4: %s", error);
    data_string_forget(&new_string, MDL);


    /* Case 5: Call with valid params, source string is "" */
    len_arg = 0;
    if (data_string_new(&new_string, "", len_arg, MDL) == 0) {
        atf_tc_fail("case 5: did not return success");
    }

    error = checkString(&new_string, "");
    ATF_REQUIRE_MSG((error == NULL), "case 4: %s", error);
    data_string_forget(&new_string, MDL);


}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:50,代码来源:test_alloc.c


示例13: ATF_TC_BODY

ATF_TC_BODY(positional_normal, tc)
{

	/* Test positional arguments */
	snprintf(buf, sizeof buf,
	    "|xx %1$s %2$s %3$s %4$s\n"
	    "|xx %5$s %6$s %7$s %8$s\n"
	    "|xx %9$s %10$s %11$s %12$s\n"
	    "|xx %13$s %14$s %15$s %16$s\n"
	    "|xx %17$s %18$s %19$s %20$s\n"
	    "|xx %21$s %22$s %23$s %24$s\n"
	    "|xx %25$s %26$s %27$s %28$s\n"
	    "|xx %29$s %30$s %31$s %32$s\n"
	    "|xx %33$s %34$s %35$s %36$s\n"
	    "|xx %37$s %38$s %39$s %40$s\n"
	    "|xx %41$s %42$s %43$s %44$s\n"
	    "|xx %45$d %46$ld %47$lld %48$d %49$lld\n",
	    "01", "02", "03", "04", "05", "06",
	    "07", "08", "09", "10", "11", "12",
	    "13", "14", "15", "16", "17", "18",
	    "19", "20", "21", "22", "23", "24",
	    "25", "26", "27", "28", "29", "30",
	    "31", "32", "33", "34", "35", "36",
	    "37", "38", "39", "40", "41", "42",
	    "43", "44", 45, -1L, 1LL, -1, 1LL
	    );
	ATF_REQUIRE_MSG(wcscmp(wbuf1, wbuf2) == 0,
	    "buffers didn't match");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:29,代码来源:print_positional_test.c


示例14: h_pass

static void
h_pass(const char *buf, const char *fmt, int len,
    int tm_sec, int tm_min, int tm_hour, int tm_mday,
    int tm_mon, int tm_year, int tm_wday, int tm_yday)
{
	struct tm tm = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, NULL };
	const char *ret, *exp;

	exp = buf + len;
	ret = strptime(buf, fmt, &tm);

	ATF_REQUIRE_MSG(ret == exp,
	    "strptime(\"%s\", \"%s\", tm): incorrect return code: "
	    "expected: %p, got: %p", buf, fmt, exp, ret);

#define H_REQUIRE_FIELD(field)						\
		ATF_REQUIRE_MSG(tm.field == field,			\
		    "strptime(\"%s\", \"%s\", tm): incorrect %s: "	\
		    "expected: %d, but got: %d", buf, fmt,		\
		    ___STRING(field), field, tm.field)

	H_REQUIRE_FIELD(tm_sec);
	H_REQUIRE_FIELD(tm_min);
	H_REQUIRE_FIELD(tm_hour);
	H_REQUIRE_FIELD(tm_mday);
	H_REQUIRE_FIELD(tm_mon);
	H_REQUIRE_FIELD(tm_year);
	H_REQUIRE_FIELD(tm_wday);
	H_REQUIRE_FIELD(tm_yday);

#undef H_REQUIRE_FIELD
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:32,代码来源:t_strptime.c


示例15: ztest1

static void
ztest1(const char *name, const char *fmt, long value)
{
	struct tm tm;
	char *rv;

	memset(&tm, 0, sizeof(tm));
	if ((rv = strptime(name, fmt, &tm)) == NULL) 
		tm.tm_gmtoff = -1;
	else if (rv == name && fmt[1] == 'Z')
		value = 0;

	switch (value) {
	case -2:
		value = -timezone;
		break;
	case -1:
		if (fmt[1] == 'Z')
			value = 0;
		break;
	default:
		break;
	}

	ATF_REQUIRE_MSG(tm.tm_gmtoff == value,
	    "strptime(\"%s\", \"%s\", &tm): "
	    "expected: tm.tm_gmtoff=%ld, got: tm.tm_gmtoff=%ld",
	    name, fmt, value, tm.tm_gmtoff);
	printf("%s %s %ld\n", name, fmt, tm.tm_gmtoff);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:30,代码来源:t_strptime.c


示例16: ATF_TC_BODY

ATF_TC_BODY(regcomp_too_big, tc)
{
	regex_t re;
	struct rlimit limit;
	int e;

	limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
	ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
	for (size_t i = 0; i < __arraycount(tests); i++) {
		char *d = (*tests[i].pattern)(REGEX_MAXSIZE);
		e = regcomp(&re, d, tests[i].type);
		if (e) {
			char ebuf[1024];
			(void)regerror(e, &re, ebuf, sizeof(ebuf));
			ATF_REQUIRE_MSG(e == REG_ESPACE,
			    "regcomp returned %d (%s) for pattern %zu [%s]", e, ebuf,
			    i, d);
			free(d);
			continue;
		}
		free(d);
		(void)regexec(&re, "aaaaaaaaaaa", 0, NULL, 0);
		regfree(&re);
	}
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:25,代码来源:t_exhaust.c


示例17: aborthandler

static void
aborthandler(int signo __unused)
{
	ATF_REQUIRE(myself == pthread_self());
	ATF_REQUIRE_MSG(expectsignal, "kill(SIGABRT) succeeded");
	atf_tc_pass();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,代码来源:t_threadjmp.c


示例18: mainfunc

static void
mainfunc(void)
{
	printf("Testing if swapcontext() alters TLS pointer if _UC_TLSBASE "
	       "is %s\n", (alter_tlsbase) ? "left set" : "cleared");

	_lwp_setprivate(&val1);
	printf("before swapcontext TLS pointer = %p\n", &val1);

	ATF_REQUIRE(getcontext(&nctx) == 0);

	nctx.uc_stack.ss_sp = stack;
	nctx.uc_stack.ss_size = sizeof(stack);

#ifndef _UC_TLSBASE
	ATF_REQUIRE_MSG(0, "_UC_TLSBASE is not defined");
#else /* _UC_TLSBASE */
	ATF_REQUIRE(nctx.uc_flags & _UC_TLSBASE);
	if (!alter_tlsbase)
		nctx.uc_flags &= ~_UC_TLSBASE;
#endif /* _UC_TLSBASE */

	makecontext(&nctx, swapfunc, 0);

	_lwp_setprivate(&val2);
	otls = _lwp_getprivate();
	printf("before swapcontext TLS pointer = %p\n", otls);
	ATF_REQUIRE(swapcontext(&octx, &nctx) == 0);

	printf("Test completed\n");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:31,代码来源:t_swapcontext.c


示例19: atf_utils_cat_file

/** Prints the contents of a file to stdout.
 *
 * \param name The name of the file to be printed.
 * \param prefix An string to be prepended to every line of the printed
 *     file. */
void
atf_utils_cat_file(const char *name, const char *prefix)
{
    const int fd = open(name, O_RDONLY);
    ATF_REQUIRE_MSG(fd != -1, "Cannot open %s", name);

    char buffer[1024];
    ssize_t count;
    bool continued = false;
    while ((count = read(fd, buffer, sizeof(buffer) - 1)) > 0) {
        buffer[count] = '\0';

        if (!continued)
            printf("%s", prefix);

        char *iter = buffer;
        char *end;
        while ((end = strchr(iter, '\n')) != NULL) {
            *end = '\0';
            printf("%s\n", iter);

            iter = end + 1;
            if (iter != buffer + count)
                printf("%s", prefix);
            else
                continued = false;
        }
        if (iter < buffer + count) {
            printf("%s", iter);
            continued = true;
        }
    }
    ATF_REQUIRE(count == 0);
}
开发者ID:0xbda2d2f8,项目名称:freebsd,代码行数:39,代码来源:utils.c


示例20: aio_timeout_stop

static void
aio_timeout_stop(void)
{

	ATF_REQUIRE_MSG(signal(SIGALRM, NULL) != SIG_ERR,
	    "failed to reset SIGALRM handler to default: %s", strerror(errno));
	alarm(0);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:8,代码来源:aio_test.c



注:本文中的ATF_REQUIRE_MSG函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ATF_REQUIRE_STREQ函数代码示例发布时间:2022-05-30
下一篇:
C++ ATF_REQUIRE_ERRNO函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap