test/scheduler: add a for_each_reactor shutdown test
The scheduler test app is ideal for testing that the reactors properly flush any existing for_each_reactor operations during the shutdown process. This is because it has no SPDK subsystems, so the reactors stop immediately after the application is signaled to terminate. So start a for_each_reactor operation when the application starts, and then keep starting another one once the previous one completes. This serves as a regression test for issue #2206. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I69825b50ad6f3c059da11241f58a8319199e88d5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9929 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
5466d5d4dc
commit
84ab68c1a3
@ -43,6 +43,8 @@
|
||||
#include "spdk/thread.h"
|
||||
#include "spdk/util.h"
|
||||
|
||||
#include "spdk_internal/event.h"
|
||||
|
||||
static bool g_is_running = true;
|
||||
pthread_mutex_t g_sched_list_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#define TIMESLICE_US 100 * 1000
|
||||
@ -390,10 +392,28 @@ test_shutdown(void)
|
||||
pthread_mutex_unlock(&g_sched_list_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
for_each_nop(void *arg1, void *arg2)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
for_each_done(void *arg1, void *arg2)
|
||||
{
|
||||
spdk_for_each_reactor(for_each_nop, NULL, NULL, for_each_done);
|
||||
}
|
||||
|
||||
static void
|
||||
test_start(void *arg1)
|
||||
{
|
||||
SPDK_NOTICELOG("Scheduler test application started.\n");
|
||||
/* Start an spdk_for_each_reactor operation that just keeps
|
||||
* running over and over again until the app exits. This
|
||||
* serves as a regression test for SPDK issue #2206, ensuring
|
||||
* that any pending spdk_for_each_reactor operations are
|
||||
* completed before reactors are shut down.
|
||||
*/
|
||||
for_each_done(NULL, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user