test/bdevio: add delay before starting unit tests
This is a bit of a workaround for some upcoming changes where bdev subsystem initialization will not wait for all vbdevs to finish tasting all bdevs that are registered. We need to allow those vbdevs to clean up after themselves after doing their initial tasting, before we start the unit tests, since the unit tests are blocking and won't return to the reactor loop to allow asynchronous tasting I/O to get returned to the vbdev modules. Eventually we should consider modifying bdevio run asynchronously, maybe including removing its use of CUnit for test reporting. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I6c425dd2711ce06fb6df1678f08294d6228c9ae4 Reviewed-on: https://review.gerrithub.io/368616 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
4794c791de
commit
be2cb0c535
@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
pthread_mutex_t g_test_mutex;
|
pthread_mutex_t g_test_mutex;
|
||||||
pthread_cond_t g_test_cond;
|
pthread_cond_t g_test_cond;
|
||||||
|
struct spdk_poller *g_start_timer;
|
||||||
|
|
||||||
struct io_target {
|
struct io_target {
|
||||||
struct spdk_bdev *bdev;
|
struct spdk_bdev *bdev;
|
||||||
@ -699,11 +700,13 @@ blockdev_test_reset(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_main(void *arg1, void *arg2)
|
test_main(void *arg1)
|
||||||
{
|
{
|
||||||
CU_pSuite suite = NULL;
|
CU_pSuite suite = NULL;
|
||||||
unsigned int num_failures;
|
unsigned int num_failures;
|
||||||
|
|
||||||
|
spdk_poller_unregister(&g_start_timer, NULL);
|
||||||
|
|
||||||
pthread_mutex_init(&g_test_mutex, NULL);
|
pthread_mutex_init(&g_test_mutex, NULL);
|
||||||
pthread_cond_init(&g_test_cond, NULL);
|
pthread_cond_init(&g_test_cond, NULL);
|
||||||
|
|
||||||
@ -765,6 +768,12 @@ test_main(void *arg1, void *arg2)
|
|||||||
spdk_app_stop(num_failures);
|
spdk_app_stop(num_failures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
start_timer(void *arg1, void *arg2)
|
||||||
|
{
|
||||||
|
spdk_poller_register(&g_start_timer, test_main, NULL, spdk_env_get_current_core(), 1000 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -779,7 +788,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
bdevtest_init(config_file, "0x3", &opts);
|
bdevtest_init(config_file, "0x3", &opts);
|
||||||
|
|
||||||
num_failures = spdk_app_start(&opts, test_main, NULL, NULL);
|
num_failures = spdk_app_start(&opts, start_timer, NULL, NULL);
|
||||||
spdk_app_fini();
|
spdk_app_fini();
|
||||||
|
|
||||||
return num_failures;
|
return num_failures;
|
||||||
|
Loading…
Reference in New Issue
Block a user