xref: /spdk/test/event/scheduler/scheduler.sh (revision 32999ab917f67af61872f868585fd3d78ad6fb8a)
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../../..)
5source $rootdir/test/common/autotest_common.sh
6
7function scheduler_create_thread() {
8	$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x1 -a 100
9	$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x2 -a 100
10	$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x4 -a 100
11	$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x8 -a 100
12	$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x1 -a 0
13	$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x2 -a 0
14	$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x4 -a 0
15	$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x8 -a 0
16
17	$rpc --plugin scheduler_plugin scheduler_thread_create -n one_third_active -a 30
18	thread_id=$($rpc --plugin scheduler_plugin scheduler_thread_create -n half_active -a 0)
19	$rpc --plugin scheduler_plugin scheduler_thread_set_active $thread_id 50
20
21	thread_id=$($rpc --plugin scheduler_plugin scheduler_thread_create -n deleted -a 100)
22	$rpc --plugin scheduler_plugin scheduler_thread_delete $thread_id
23}
24
25rpc=rpc_cmd
26
27$testdir/scheduler -m 0xF -p 0x2 --wait-for-rpc &
28scheduler_pid=$!
29trap 'killprocess $scheduler_pid; exit 1' SIGINT SIGTERM EXIT
30waitforlisten $scheduler_pid
31
32$rpc framework_set_scheduler dynamic
33$rpc framework_start_init
34
35# basic integrity test
36run_test "scheduler_create_thread" scheduler_create_thread
37
38trap - SIGINT SIGTERM EXIT
39killprocess $scheduler_pid
40