28 #include <sys/types.h> 49 return ctx.sx_instance.si_instance->m0c_motr;
59 return ctx.sx_instance.si_instance;
69 if (idx < 0 || idx >=
ctx.sx_cfg.sc_nr_threads)
72 return ctx.sx_worker_stats + idx;
82 return ctx.sx_cfg.sc_tests;
92 return ctx.sx_cfg.sc_mode;
98 ctx.sx_cfg.sc_nr_threads =
nr;
105 return ctx.sx_cfg.sc_nr_threads;
111 || idx >=
ctx.sx_cfg.sc_nr_threads)
114 ctx.sx_worker_tids[idx] = tid;
123 if (
ctx.sx_worker_tids ==
NULL)
126 for (
i = 0;
i <
ctx.sx_cfg.sc_nr_threads;
i++) {
127 if (
ctx.sx_worker_tids[
i] == tid)
132 if (
i ==
ctx.sx_cfg.sc_nr_threads)
145 for (
i = 0;
i <
ctx.sx_nr_all; ++
i)
147 return ctx.sx_all[
i];
159 for (
t =
s->ss_tests;
t->st_name !=
NULL;
t++)
160 if (
str_eq(
t->st_name, t_name))
185 sub_token = strchr(
token,
':');
186 if (sub_token !=
NULL)
190 if (suite ==
NULL)
continue;
192 if (sub_token !=
NULL) {
196 test->st_enabled = 1;
201 test->st_enabled = 1;
206 ctx.sx_selected[
ctx.sx_nr_selected++] = suite;
234 for (
i = 0;
i < nr_tests; ) {
236 for (j = 0; j <
i; j++)
237 if (order[j] ==
index)
break;
253 for (
i = 0;
i < nr_tests;
i++){
256 for (j = 0; j < nr_tests; j++)
257 if (order[j] == k)
break;
271 while (isspace(*str))
276 static const char padding[256] = { [0 ... 254] =
' ', [255] =
'\0' };
308 name_len = strlen(
test->st_name);
309 max_name_len =
ctx.sx_max_name_len;
311 len = (name_len > max_name_len)?name_len:max_name_len;
312 pad_len = len - name_len;
350 if (
ctx.sx_cfg.sc_run_selected == 1
351 &&
test->st_enabled == 0)
383 for (
i = 0;
i < nr_suites &&
rc == 0;
i++)
396 uint64_t nr_asserts = 0;
397 uint64_t nr_failed_asserts = 0;
406 ctx.sx_worker_stats[worker_idx].sws_nr_asserts = 0;
407 ctx.sx_worker_stats[worker_idx].sws_nr_failed_asserts = 0;
409 if (test_list_str ==
NULL)
412 ctx.sx_cfg.sc_run_selected =
true;
421 nr_asserts =
ctx.sx_worker_stats[worker_idx].sws_nr_asserts;
423 ctx.sx_worker_stats[worker_idx].sws_nr_failed_asserts;
428 " Failed Asserts: %" PRIu64 429 "\nClient tests Done\n",
431 nr_asserts, nr_failed_asserts);
432 return nr_failed_asserts;
440 for (
i = 0;
i <
ctx.sx_nr_all; ++
i) {
443 for (
t =
ctx.sx_all[
i]->ss_tests;
t->st_name !=
NULL;
t++)
463 if (
ctx.sx_worker_tids ==
NULL)
467 if (
ctx.sx_worker_stats ==
NULL)
481 if (
ctx.sx_worker_tids !=
NULL)
484 if (
ctx.sx_worker_stats !=
NULL)
511 max_len =
ctx.sx_max_name_len;
513 if (
t->st_proc ==
NULL)
516 str_len = strlen(
t->st_name);
517 max_len = (str_len > max_len)?str_len:max_len;
521 ctx.sx_all[
ctx.sx_nr_all++] = suite;
522 ctx.sx_max_name_len = max_len;
static struct m0_addb2_philter p
struct st_worker_stat * st_get_worker_stat(int idx)
void st_cleaner_disable()
struct st_test ss_tests[]
static struct st_suite * lookup_suite(const char *name)
static struct st_test * lookup_test(struct st_suite *s, const char *t_name)
void st_cleaner_empty_bin()
int st_run(const char *test_list_str)
struct st_suite st_suite_cancel
struct st_suite st_suite_m0_read
struct st_suite st_suite_mt
struct st_suite st_suite_isync
void st_list(bool with_tests)
struct st_suite st_suite_example
int st_set_worker_tid(int idx, pid_t tid)
static void run_test(const struct st_test *test)
void st_set_instance(struct m0_client *instance)
int oid_allocator_fini(void)
int st_get_nr_workers(void)
void st_set_nr_workers(int nr)
struct st_suite st_suite_idx
struct m0 * st_get_motr(void)
static void duration(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
static struct m0_thread t[8]
void st_set_tests(const char *tests)
static int struct dentry int mode
static void token(struct ff2c_context *ctx, struct ff2c_term *term, struct ff2c_token *tok)
struct st_suite st_suite_obj
void console_printf(const char *fmt,...)
static void mem_free(const struct m0_be_btree *btree, struct m0_be_tx *tx, void *ptr)
struct st_suite st_suite_osync
struct st_suite st_suite_m0_write
struct st_suite st_suite_layout
enum st_mode st_get_test_mode(void)
static M0_UNUSED const char * skipspaces(const char *str)
#define MEM_ALLOC_ARR(arr, nr)
static int run_suite(struct st_suite *suite)
struct m0_client * st_get_instance()
int oid_allocator_init(void)
static int start(struct m0_fom *fom)
const char * st_get_tests()
static struct m0 instance
uint32_t generate_random(uint32_t max)
uint64_t time_seconds(const uint64_t time)
static int select_tests(const char *str)
int st_get_worker_idx(pid_t tid)
static int shuffle_tests(struct st_suite *suite)
struct st_cfg st_get_cfg()
static const char padding[256]
int st_add(struct st_suite *suite)
static struct m0_addb2_source * s
uint64_t time_nanoseconds(const uint64_t time)
static int run_suites(struct st_suite **suites, int nr_suites)
void st_set_test_mode(enum st_mode mode)