static int set_priority_helper_2(seL4_CPtr *t1, seL4_CPtr *t2) { test_check(set_priority_step == 1); ZF_LOGD("1..."); /* Raise thread 1 to equal to ours, which should fail. */ int error = seL4_TCB_SetPriority(*t1, SCHED0005_HIGHEST_PRIO - 1 + PRIORITY_FUDGE); test_check(error == seL4_IllegalOperation); /* Raise thread 1 to just below us. */ error = seL4_TCB_SetPriority(*t1, SCHED0005_HIGHEST_PRIO - 2); test_check(!error); /* Drop ours to below thread 1. Thread 1 should run. */ set_priority_step = 2; error = seL4_TCB_SetPriority(*t2, SCHED0005_HIGHEST_PRIO -3 ); test_check(!error); /* Once thread 1 exits, we should run. */ test_check(set_priority_step == 3); ZF_LOGD("3..."); set_priority_step = 4; return 0; }
/* * Test setting priorities. */ static int test_set_priorities(struct env* env) { /* Ensure we can set our priority equal to ourselves. */ int error = seL4_TCB_SetPriority(env->tcb, OUR_PRIO); test_assert(!error); /* Ensure we can set a different thread's priority equal to ourselves. */ seL4_CPtr tcb = vka_alloc_tcb_leaky(&env->vka); error = seL4_TCB_SetPriority(tcb, OUR_PRIO); test_assert(!error); return sel4test_get_result(); }
void set_helper_priority(helper_thread_t *thread, seL4_Word prio) { UNUSED int error; error = seL4_TCB_SetPriority(thread->thread.tcb.cptr, prio); assert(error == seL4_NoError); }
static int set_priority_helper_1(seL4_CPtr *t1, seL4_CPtr *t2) { test_check(set_priority_step == 0); ZF_LOGD("0..."); set_priority_step = 1; /* * Down our priority. This should force a reschedule and make thread 2 run. */ int error = seL4_TCB_SetPriority(*t1, SCHED0005_HIGHEST_PRIO - 4 ); test_check(!error); test_check(set_priority_step == 2); ZF_LOGD("2..."); set_priority_step = 3; return 0; }