23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_BE 66 rc = m0_be_fmt_log_header_init(&lh,
NULL);
68 size = m0_be_fmt_log_header_size(&lh);
75 rc = m0_be_fmt_log_header_encode(&lh, &cur_encoded);
79 rc = m0_be_fmt_log_header_decode(&lh_decoded, &cur_encoded,
83 equal = memcmp(&lh, lh_decoded,
sizeof lh) == 0;
86 m0_be_fmt_log_header_decoded_free(lh_decoded);
87 m0_be_fmt_log_header_fini(&lh);
94 rc = m0_be_fmt_log_header_decode(&lh_decoded, &cur_encoded,
98 m0_be_fmt_log_header_decoded_free(lh_decoded);
105 rc = m0_be_fmt_log_header_decode(&lh_decoded, &cur_encoded,
109 m0_be_fmt_log_header_decoded_free(lh_decoded);
116 rc = m0_be_fmt_log_header_decode(&lh_decoded, &cur_encoded,
120 m0_be_fmt_log_header_decoded_free(lh_decoded);
147 rc = m0_be_fmt_cblock_init(&cb,
NULL);
149 size = m0_be_fmt_cblock_size(&cb);
158 rc = m0_be_fmt_cblock_encode(&cb, &cur_encoded);
162 rc = m0_be_fmt_cblock_decode(&cb_decoded, &cur_encoded,
166 equal = memcmp(&cb, cb_decoded,
sizeof cb) == 0;
169 m0_be_fmt_cblock_decoded_free(cb_decoded);
170 m0_be_fmt_cblock_fini(&cb);
177 rc = m0_be_fmt_cblock_decode(&cb_decoded, &cur_encoded,
181 m0_be_fmt_cblock_decoded_free(cb_decoded);
188 rc = m0_be_fmt_cblock_decode(&cb_decoded, &cur_encoded,
192 m0_be_fmt_cblock_decoded_free(cb_decoded);
199 rc = m0_be_fmt_cblock_decode(&cb_decoded, &cur_encoded,
203 m0_be_fmt_cblock_decoded_free(cb_decoded);
210 uint32_t rnr =
left->fg_content_header.fch_reg_area.chr_nr;
211 uint32_t tnr =
left->fg_content_header.fch_txs.cht_nr;
212 uint32_t pnr =
left->fg_content.fmc_payloads.fcp_nr;
215 &
left->fg_content_header.fch_reg_area;
219 &
left->fg_content_header.fch_txs;
223 left->fg_content.fmc_payloads.fcp_payload;
227 left->fg_content.fmc_reg_area.cra_reg;
232 sizeof left->fg_header) == 0 &&
233 left->fg_content_header.fch_reg_area.chr_nr ==
235 left->fg_content_header.fch_txs.cht_nr ==
240 sizeof ltxs->
cht_tx[
i]) == 0) &&
241 left->fg_content.fmc_payloads.fcp_nr ==
243 left->fg_content.fmc_reg_area.cra_nr ==
250 #define CFG(tx_nr_max, reg_nr_max, payload_sz_max, ra_sz_max) \ 251 (const struct m0_be_fmt_group_cfg) { \ 252 .fgc_tx_nr_max = tx_nr_max, \ 253 .fgc_reg_nr_max = reg_nr_max, \ 254 .fgc_payload_size_max = payload_sz_max, \ 255 .fgc_reg_size_max = ra_sz_max, \ 257 #define REG(size, addr, buf) \ 258 (const struct m0_be_fmt_reg) { \ 263 #define TX(p_addr, p_nob, id) \ 264 (const struct m0_be_fmt_tx) { \ 280 for (
i = 0;
i < TX_NR_MAX; ++
i)
285 for (
i = 0;
i < REG_NR_MAX; ++
i)
287 (
void *) 0x400000000128ULL,
306 M0_UT_ASSERT((uint8_t)
t->cfg.fgc_tx_nr_max ==
t->cfg.fgc_tx_nr_max);
308 if (
addr[
i] ==
t->cfg.fgc_tx_nr_max) {
326 uint64_t reg_area_size;
332 uint64_t reg_sizes1[] = { 1024, 1024, 1024 };
333 uint64_t reg_sizes2[] = { 2048, 512, 512 };
334 uint64_t reg_sizes3[] = { 3072, 0, 0 };
335 uint64_t reg_sizes4[] = { 1, 2, 3, 4, 5, 6 };
339 uint64_t payload_size;
342 { 3,
ARRAY_SIZE(reg_sizes1), 1024, reg_sizes1 },
343 { 4,
ARRAY_SIZE(reg_sizes2), 100, reg_sizes2 },
345 { 1,
ARRAY_SIZE(reg_sizes4), 99, reg_sizes4 },
352 for (j = 0; j <
tests[
i].reg_nr; ++j) {
353 reg_area_size +=
tests[
i].reg_sizes[j];
366 for (j = 0; j <
tests[
i].tx_nr; ++j) {
368 tests[
i].payload_size, 0));
370 for (j = 0; j <
tests[
i].reg_nr; ++j) {
394 uint64_t *payload_size =
NULL;
395 uint64_t *reg_size =
NULL;
399 if ((
fg_cfg->fgc_tx_nr_max == 0 &&
fg_cfg->fgc_payload_size_max > 0) ||
400 (
fg_cfg->fgc_reg_nr_max == 0 &&
fg_cfg->fgc_reg_size_max > 0))
405 if (
fg_cfg->fgc_tx_nr_max > 0) {
412 0, + payload_size[
i]) ==
413 fg_cfg->fgc_payload_size_max);
415 if (
fg_cfg->fgc_reg_nr_max > 0) {
423 fg_cfg->fgc_reg_size_max);
427 for (
i = 0;
i <
fg_cfg->fgc_tx_nr_max; ++
i)
429 for (
i = 0;
i <
fg_cfg->fgc_reg_nr_max; ++
i)
448 uint64_t *
value[] = {
451 &
fg_cfg.fgc_payload_size_max,
462 size_max >= size_max_prev));
464 size_max_prev : size_max;
477 .fgc_payload_size_max = 0,
478 .fgc_reg_size_max = 0,
482 .fgc_tx_nr_max = 0x100,
483 .fgc_reg_nr_max = 0x100,
484 .fgc_payload_size_max = 0x100,
485 .fgc_reg_size_max = 0x100,
486 .fgc_seg_nr_max = 0x100,
510 .cfg =
CFG(10, 100, 99, 800),
513 .cfg =
CFG(1, 2, 20, 16),
516 .cfg =
CFG(10, 100, 99, 800),
520 .cfg =
CFG(10, 100, 99, 800),
528 .cfg =
CFG(10, 100, 99, 800),
531 g->fg_content_header.fch_txs.cht_nr =
538 .cfg =
CFG(10, 100, 99, 800),
541 g->fg_content_header.fch_reg_area.chr_nr =
547 fmt-
group motr: fb00 FATAL : [lib/assert.c:46:
m0_panic] panic: fatal signal delivered
at unknown() (unknown:0) [git: jenkins-OSAINT_motr-294-230-g2d11e2b-dirty]
548 Motr panic: fatal signal delivered
at unknown() unknown:0 (errno: 2) (
last failed: none) [git: jenkins-OSAINT_motr-294-230-g2d11e2b-dirty] pid: 76277
549 Motr panic reason: signo: 11
552 /.libs/libmotr-0.1.0.so(
m0_panic+0x1e5)[0x7f3e6799e9a8]
553 /.libs/libmotr-0.1.0.so(+0x22b6ee)[0x7f3e679b36ee]
554 /lib64/libpthread.so.0[0x3593e0f4a0]
555 /lib64/libc.so.6[0x3593a889e8]
556 /lib64/libc.so.6(memmove+0x7e)[0x3593a8252e]
558 /.libs/libmotr-0.1.0.so(+0x2d4ccb)[0x7f3e67a5cccb]
560 /.libs/libmotr-0.1.0.so(+0x18ee45)[0x7f3e67916e45]
562 /.libs/libmotr-ut.so.0(m0_be_ut_fmt_group+0x3d0)[0x7f3e68699484]
567 .cfg =
CFG(10, 100, 99, 99),
570 g->fg_content.fmc_payloads.fcp_nr =
577 .cfg =
CFG(10, 100, 99, 99),
580 g->fg_content.fmc_payloads.fcp_payload[0].b_nob =
587 .cfg =
CFG(10, 100, 99, 99),
590 g->fg_content.fmc_reg_area.cra_nr =
601 .cfg =
CFG(0xEA, 100, 99, 800),
605 .cfg =
CFG(10, 0xEA, 99, 0xEA * 8),
609 .cfg =
CFG(10, 100, 0xEA, 800),
617 for (
i = 0; !
test[
i].last; ++
i) {
624 bool reseted =
false;
628 test[
i].cfg.fgc_tx_nr_max,
629 test[
i].cfg.fgc_reg_nr_max,
630 test[
i].cfg.fgc_reg_size_max,
631 test[
i].cfg.fgc_payload_size_max);
645 test[
i].cfg.fgc_tx_nr_max,
646 test[
i].cfg.fgc_reg_nr_max);
690 #undef M0_TRACE_SUBSYSTEM
#define TX(p_addr, p_nob, id)
#define M0_BUFVEC_INIT_BUF(addr_ptr, count_ptr)
M0_INTERNAL void m0_ut_random_arr_with_sum(uint64_t *arr, uint64_t nr, uint64_t sum, uint64_t *seed)
#define M0_ALLOC_ARR(arr, nr)
#define M0_BE_FMT_DECODE_CFG_DEFAULT
M0_INTERNAL void m0_be_fmt_group_reg_add(struct m0_be_fmt_group *fg, const struct m0_be_fmt_reg *freg)
M0_INTERNAL bool m0_buf_eq(const struct m0_buf *x, const struct m0_buf *y)
#define M0_LOG(level,...)
void m0_panic(const struct m0_panic_ctx *ctx,...)
static void spoil_nr(struct m0_be_ut_fmt_group_test *t, struct m0_buf *b)
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
#define REG(size, addr, buf)
int const char const void * value
struct m0_be_fmt_group_cfg cfg
void m0_be_ut_fmt_log_header(void)
M0_INTERNAL int m0_be_fmt_group_decode(struct m0_be_fmt_group **fg, struct m0_bufvec_cursor *cur, const struct m0_be_fmt_decode_cfg *cfg)
void(* encoded_spoil)(struct m0_be_ut_fmt_group_test *, struct m0_buf *)
M0_INTERNAL void m0_be_fmt_group_decoded_free(struct m0_be_fmt_group *fg)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copy(struct m0_bufvec_cursor *dcur, struct m0_bufvec_cursor *scur, m0_bcount_t num_bytes)
#define CFG(tx_nr_max, reg_nr_max, payload_sz_max, ra_sz_max)
struct m0_be_fmt_content fg_content
static struct m0_thread t[8]
static void be_fmt_group_populate(struct m0_be_fmt_group *group, void *payload, size_t payload_size, size_t TX_NR_MAX, size_t REG_NR_MAX)
M0_INTERNAL m0_bcount_t m0_be_fmt_group_size_max(const struct m0_be_fmt_group_cfg *cfg)
static long long max(long long a, long long b)
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
M0_INTERNAL void m0_arch_backtrace(void)
char * fmt(const char *format,...) __attribute__((format(printf
void * m0_alloc(size_t size)
struct m0_be_fmt_group_header fg_header
void m0_be_ut_fmt_group(void)
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
static m0_bcount_t be_ut_fmt_group_size_max_check(struct m0_be_fmt_group_cfg *fg_cfg, uint64_t *seed)
M0_INTERNAL m0_bcount_t m0_be_fmt_group_size(struct m0_be_fmt_group *fg)
#define m0_forall(var, nr,...)
void m0_be_ut_fmt_group_size_max_rnd(void)
static bool at(struct ff2c_context *ctx, char c)
M0_INTERNAL void m0_be_fmt_group_fini(struct m0_be_fmt_group *fg)
struct m0_be_fmt_content_header fg_content_header
M0_INTERNAL uint64_t m0_rnd64(uint64_t *seed)
struct m0_buf * fcp_payload
void m0_be_ut_fmt_cblock(void)
void m0_be_ut_fmt_group_size_max(void)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_arch_panic(const struct m0_panic_ctx *ctx, va_list ap) __attribute__((noreturn))
M0_INTERNAL int m0_xcode_encode(struct m0_xcode_ctx *ctx)
#define M0_BE_FMT_DECODE_CFG_DEFAULT_WITH_TRACE
M0_INTERNAL void m0_ut_random_shuffle(uint64_t *arr, uint64_t nr, uint64_t *seed)
M0_INTERNAL void m0_be_fmt_group_tx_add(struct m0_be_fmt_group *fg, const struct m0_be_fmt_tx *ftx)
static void be_ut_fmt_group_size_max_test(struct m0_be_fmt_group_cfg *fg_cfg2, uint64_t *seed)
#define M0_ASSERT_INFO(cond, fmt,...)
struct m0_be_fmt_content_payloads fmc_payloads
M0_INTERNAL void m0_be_fmt_group_reset(struct m0_be_fmt_group *fg)
static struct gen g[MAX_GEN]
M0_INTERNAL int m0_be_fmt_group_init(struct m0_be_fmt_group *fg, const struct m0_be_fmt_group_cfg *cfg)
M0_INTERNAL int m0_be_fmt_group_encode(struct m0_be_fmt_group *fg, struct m0_bufvec_cursor *cur)
struct m0_be_fmt_content_reg_area fmc_reg_area
static uint64_t max64u(uint64_t a, uint64_t b)
static struct m0_addb2_frame_header last
void(* group_spoil)(struct m0_be_ut_fmt_group_test *, struct m0_be_fmt_group *)
static bool fmt_group_eq(struct m0_be_fmt_group *left, struct m0_be_fmt_group *right)