bdev/raid: remove random test case values

For test setup only, each time a UT would run several params, like
the number of drives in the test, would be based on a random value
which is not optimal for UT. This patch just selects a reasonable
fixed values and uses them every time.

This can save up to 4 seconds per run depending on the values that
were randomly chosen (worst case) vs what is in this patch.

There is value in some read/write test cases in using different
strip sizes however. Enabling multiples values for the tests where
it adds value will come in following patches as will removal of
more random numbers like # of channels.

Change-Id: I1b9d44b70ae81af0dcf53ae4a56e31c9c9add39e
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454505
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
paul luse 2019-05-14 14:59:37 -04:00 committed by Jim Harris
parent ad7f7bf587
commit 17de9bfdd6

View File

@ -38,8 +38,8 @@
#include "bdev/raid/bdev_raid.c"
#include "bdev/raid/bdev_raid_rpc.c"
#define MAX_BASE_DRIVES 255
#define MAX_RAIDS 31
#define MAX_BASE_DRIVES 32
#define MAX_RAIDS 16
#define INVALID_IO_SUBMIT 0xFFFF
#define MAX_TEST_IO_RANGE (3 * 3 * 3 * (MAX_BASE_DRIVES + 5))
@ -59,12 +59,6 @@ struct raid_io_ranges {
uint64_t nblocks;
};
/* Different test options, more options to test can be added here */
uint32_t g_blklen_opts[] = {512, 4096};
uint32_t g_strip_opts[] = {64, 128, 256, 512, 1024, 2048};
uint32_t g_iosize_opts[] = {256, 512, 1024};
uint32_t g_max_qd_opts[] = {64, 128, 256, 512, 1024, 2048};
/* Globals */
int g_bdev_io_submit_status;
struct io_output *g_io_output = NULL;
@ -96,22 +90,18 @@ struct raid_io_ranges g_io_ranges[MAX_TEST_IO_RANGE];
uint32_t g_io_range_idx;
uint64_t g_lba_offset;
/* Set randomly test options, in every run it is different */
static void
set_test_opts(void)
{
uint32_t seed = time(0);
/* Generate random test options */
srand(seed);
g_max_base_drives = (rand() % MAX_BASE_DRIVES) + 1;
g_max_raids = (rand() % MAX_RAIDS) + 1;
g_block_len = g_blklen_opts[rand() % SPDK_COUNTOF(g_blklen_opts)];
g_strip_size = g_strip_opts[rand() % SPDK_COUNTOF(g_strip_opts)];
g_max_io_size = g_iosize_opts[rand() % SPDK_COUNTOF(g_iosize_opts)];
g_max_qd = g_max_qd_opts[rand() % SPDK_COUNTOF(g_max_qd_opts)];
g_max_base_drives = MAX_BASE_DRIVES;
g_max_raids = MAX_RAIDS;
g_block_len = 4096;
g_strip_size = 64;
g_max_io_size = 1024;
g_max_qd = 32;
printf("Test Options, seed = %u\n", seed);
printf("Test Options\n");
printf("blocklen = %u, strip_size = %u, max_io_size = %u, max_qd = %u, g_max_base_drives = %u, g_max_raids = %u\n",
g_block_len, g_strip_size, g_max_io_size, g_max_qd, g_max_base_drives, g_max_raids);
}