In preparation for enabling valgrind tests, remove instances where we
allocate a coroutine's stack from a buffer itself on the stack. Not all
that surprisingly, valgrind gets very, very confused by having one
"thread"'s stack embedded within another's.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
+static char buf[COROUTINE_MIN_STKSZ + COROUTINE_STK_OVERHEAD];
+
- char buf[COROUTINE_MIN_STKSZ + COROUTINE_STK_OVERHEAD];
struct coroutine_stack *stack;
/* This is how many tests you plan to run */
struct coroutine_stack *stack;
/* This is how many tests you plan to run */
struct coroutine_stack *stack;
/* This is how many tests you plan to run */
struct coroutine_stack *stack;
/* This is how many tests you plan to run */
/* Fix seed so we get consistent, though pseudo-random results */
srandom(0);
/* Fix seed so we get consistent, though pseudo-random results */
srandom(0);
- stack = coroutine_stack_init(buf, sizeof(buf), sizeof(struct metadata));
+ buf = malloc(BUFSIZE);
+ ok1(buf != NULL);
+
+ stack = coroutine_stack_init(buf, BUFSIZE, sizeof(struct metadata));
ok1(stack != NULL);
ok1(coroutine_stack_check(stack, NULL) == stack);
ok1(coroutine_stack_size(stack)
ok1(stack != NULL);
ok1(coroutine_stack_check(stack, NULL) == stack);
ok1(coroutine_stack_size(stack)
coroutine_stack_release(stack, sizeof(struct metadata));
coroutine_stack_release(stack, sizeof(struct metadata));
/* This exits depending on whether all tests passed */
return exit_status();
}
/* This exits depending on whether all tests passed */
return exit_status();
}