/* Verifies cleanup a stack that still be needed by another thread.  */
ZTEST(stack_fail, test_stack_cleanup_error)
/* Verifies cleanup a stack that still be needed by another thread.  */
ZTEST(stack_fail, test_stack_cleanup_error)
{
	stack_data_t rx_data[STACK_LEN - 1];
	k_stack_init(&stack, data, STACK_LEN);
	k_tid_t tid = k_thread_create(&thread_data2, threadstack2, STACK_SIZE,
					tStack_pop_entry, &stack,
					rx_data, NULL, K_PRIO_PREEMPT(0), 0,
					K_NO_WAIT);
	k_sleep(K_MSEC(500));
	zassert_true(k_stack_cleanup(&stack) == -EAGAIN, "The stack is cleanuped successful");
	k_thread_abort(tid);
}