From 85d6e845d2b9c47779cc96438e3aa6e894b4a71a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 19 Apr 2019 11:01:31 +0200 Subject: score: Add _Per_CPU_Add_job() --- testsuites/smptests/smpmulticast01/init.c | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'testsuites') diff --git a/testsuites/smptests/smpmulticast01/init.c b/testsuites/smptests/smpmulticast01/init.c index 5f10400ce6..9e5d15f795 100644 --- a/testsuites/smptests/smpmulticast01/init.c +++ b/testsuites/smptests/smpmulticast01/init.c @@ -351,6 +351,49 @@ static void test_wrong_cpu_state_to_perform_jobs(void) rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 0); } +#define TEST_JOB_ORDER_JOBS 3 + +static Per_CPU_Job job_order_jobs[TEST_JOB_ORDER_JOBS]; + +static void job_order_handler_0(void *arg) +{ + T_step(1, "invalid job order"); +} + +static void job_order_handler_1(void *arg) +{ + T_step(2, "invalid job order"); +} + +static void job_order_handler_2(void *arg) +{ + T_step(3, "invalid job order"); +} + +static const Per_CPU_Job_context job_order_contexts[TEST_JOB_ORDER_JOBS] = { + { .handler = job_order_handler_0 }, + { .handler = job_order_handler_1 }, + { .handler = job_order_handler_2 } +}; + +T_TEST_CASE(JobOrder) +{ + Per_CPU_Control *cpu_self; + size_t i; + + T_plan(4); + cpu_self = _Thread_Dispatch_disable(); + + for (i = 0; i < TEST_JOB_ORDER_JOBS; ++i) { + job_order_jobs[i].context = &job_order_contexts[i]; + _Per_CPU_Add_job(cpu_self, &job_order_jobs[i]); + } + + T_step(0, "wrong job processing time"); + _SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS); + _Thread_Dispatch_enable(cpu_self); +} + T_TEST_CASE(UnicastDuringMultitaskingIRQDisabled) { test_unicast(&test_instance, multicast_action_irq_disabled); -- cgit v1.2.3