Only pass 6 arguments to the 'run' function on amd64. amd64's

makecontext on FreeBSD only supports a maximum of 6 arguments.  This
fixes the setcontext_link test on amd64.

PR:		194828
This commit is contained in:
John Baldwin 2014-11-25 12:44:18 +00:00
parent 993a751eb3
commit 521b1af4ea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275033

View File

@ -51,7 +51,11 @@ run(int n, ...)
ATF_REQUIRE_EQ(n, DEPTH - calls - 1);
va_start(va, n);
#if defined(__FreeBSD__) && defined(__amd64__)
for (i = 0; i < 5; i++) {
#else
for (i = 0; i < 9; i++) {
#endif
ia = va_arg(va, int);
ATF_REQUIRE_EQ(i, ia);
}
@ -101,13 +105,6 @@ ATF_TC_BODY(setcontext_link, tc)
ucontext_t save;
volatile int i = 0; /* avoid longjmp clobbering */
#ifdef __FreeBSD__
#ifdef __amd64__
atf_tc_expect_fail("setcontext in this testcase fails on "
"FreeBSD/amd64 with rc == -1/errno == EINVAL; see PR # 194828");
#endif
#endif
for (i = 0; i < DEPTH; ++i) {
ATF_REQUIRE_EQ(getcontext(&uc[i]), 0);
@ -115,21 +112,20 @@ ATF_TC_BODY(setcontext_link, tc)
uc[i].uc_stack.ss_size = STACKSZ;
uc[i].uc_link = (i > 0) ? &uc[i - 1] : &save;
#if defined(__FreeBSD__) && defined(__amd64__)
/* FreeBSD/amd64 only permits up to 6 arguments. */
makecontext(&uc[i], (void *)run, 6, i,
0, 1, 2, 3, 4);
#else
makecontext(&uc[i], (void *)run, 10, i,
0, 1, 2, 3, 4, 5, 6, 7, 8);
#endif
}
ATF_REQUIRE_EQ(getcontext(&save), 0);
#ifdef __FreeBSD__
if (calls == 0) {
int rc = setcontext(&uc[DEPTH-1]);
ATF_REQUIRE_EQ_MSG(rc, 0, "%d != 0; (errno = %d)", rc, errno);
}
#else
if (calls == 0)
ATF_REQUIRE_EQ(setcontext(&uc[DEPTH-1]), 0);
#endif
}
ATF_TP_ADD_TCS(tp)