test/schedule: fix idle.sh test failure

idle.sh sometimes fails because the app_thread's idle time is less
than busy time.

For rpc "framework_set_scheduler dynamic" will initialize the dpdk_governor
which finally call rte_power_init. This process is time consuming on some
systems which may make app_thread busy.

We can allow the app_thread to be busy for the first sample. This is one
solution. It also works if we call sleep for some time after calling rpc
framework_set_scheduler.

Change-Id: Ia2f4b2f35e94657ce093ce261438ab710399435a
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16825
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Richael Zhuang 2023-02-16 16:08:53 +08:00 committed by Jim Harris
parent bad261b6ab
commit 822325ca28

View File

@ -14,7 +14,7 @@ trap 'killprocess "$spdk_pid"' EXIT
thread_stats() {
local thread
local busy_threads=0
busy_threads=0
get_thread_stats
@ -27,8 +27,6 @@ thread_stats() {
printf '%s is idle\n' "${thread_map[thread]}"
fi
done
((busy_threads == 0))
}
idle() {
@ -57,6 +55,11 @@ idle() {
done
thread_stats
# Allow app_thread is busy for the first sample. Because on some system the dpdk_governor
# initiation process on app_thread is time consuming. This may make the busy time greater
# than idle time which causes the test to fail.
((samples == 1 && busy_threads <= 1 || samples > 1 && busy_threads == 0))
done
xtrace_restore