Commit 358355a2 authored by Andy Ross's avatar Andy Ross Committed by Carles Cufi
Browse files

tests/kernel/smp: Fix cases for !SCHED_IPI_SUPPORTED



Obviously the test of the feature won't work if we don't have an IPI.
And there were two threads that spawned threads that enter busy loops,
expecting to be able to abort them from another CPU.  That doesn't
work[1] without an IPI.  Just skip these cases rather than trying to
kludge up some kind of abort signal.

[1] Rather, it does work, it just takes infinite time for these
    particular test cases.  Eventually the CPU would be expected to
    receive some other interrupt like a timeout, which would work to
    abort the running thread.  But no such timer was registered.

Signed-off-by: default avatarAndy Ross <andyross@google.com>
parent 0ca7150f
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -119,6 +119,14 @@ ZTEST(smp, test_smp_coop_threads)
{
	int i, ok = 1;

	if (!IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
		/* The spawned thread enters an infinite loop, so it can't be
		 * successfully aborted via an IPI.  Just skip in that
		 * configuration.
		 */
		ztest_test_skip();
	}

	k_tid_t tid = k_thread_create(&t2, t2_stack, T2_STACK_SIZE, t2_fn,
				      NULL, NULL, NULL,
				      K_PRIO_COOP(2), 0, K_NO_WAIT);
@@ -546,6 +554,14 @@ ZTEST(smp, test_get_cpu)
{
	k_tid_t thread_id;

	if (!IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
		/* The spawned thread enters an infinite loop, so it can't be
		 * successfully aborted via an IPI.  Just skip in that
		 * configuration.
		 */
		ztest_test_skip();
	}

	/* get current cpu number */
	_cpu_id = arch_curr_cpu()->id;

@@ -615,6 +631,7 @@ void z_trace_sched_ipi(void)
 *
 * @see arch_sched_ipi()
 */
#ifdef CONFIG_SCHED_IPI_SUPPORTED
ZTEST(smp, test_smp_ipi)
{
#ifndef CONFIG_TRACE_SCHED_IPI
@@ -640,6 +657,7 @@ ZTEST(smp, test_smp_ipi)
				sched_ipi_has_called);
	}
}
#endif

void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
{