Commit 822325ca authored by Richael Zhuang's avatar Richael Zhuang Committed by Jim Harris
Browse files

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: default avatarRichael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16825


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent bad261b6
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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