void oc_bpt_test_utl_btree_remove_range( Oc_wu *wu_p, Oc_bpt_test_state *s_p, uint32 lo_key, uint32 hi_key, bool *check_eq_pio) { int rc1, rc2; param->total_ops++; if (param->verbose) printf("// remove_range lo_key=%lu hi_key=%lu\n", lo_key, hi_key); rc1 = oc_bpt_remove_range_b(wu_p, &s_p->bpt_s, (struct Oc_bpt_key*)&lo_key, (struct Oc_bpt_key*)&hi_key); rc2 = oc_bpt_alt_remove_range_b(wu_p, &s_p->alt_s, (struct Oc_bpt_key*)&lo_key, (struct Oc_bpt_key*)&hi_key); if (*check_eq_pio) { if (!validate_fun()) *check_eq_pio = FALSE; if (rc1 != rc2) { printf("mismatch in remove_range lo_key=%lu hi_key=%lu\n", lo_key, hi_key); *check_eq_pio = FALSE; } } if (param->verbose && (*check_eq_pio)) { if (0 == rc1) printf(" // no keys removed during remove-range\n"); if (param->verbose) print_fun(); } }
void oc_bpt_test_utl_btree_remove_key( Oc_wu *wu_p, Oc_bpt_test_state *s_p, uint32 key, bool *check_eq_pio) { bool rc1, rc2; param->total_ops++; if (param->verbose) printf("// remove %lu TID=%Lu\n", key, get_tid(s_p)); rc1 = oc_bpt_remove_key_b( wu_p, &s_p->bpt_s, (struct Oc_bpt_key *)&key); rc2 = oc_bpt_alt_remove_key_b( wu_p, &s_p->alt_s, (struct Oc_bpt_key *)&key); if (*check_eq_pio) { if (rc1 != rc2) { printf(" // mismatch in remove_key(%lu)\n", key); } if (!validate_fun()) *check_eq_pio = FALSE; } // print only if a key has actually been removed if (param->verbose && (*check_eq_pio) && rc1) print_fun(); }
void oc_bpt_test_utl_btree_insert( Oc_wu* wu_p, Oc_bpt_test_state *s_p, uint32 key, bool *check_eq_pio) { bool rc1, rc2; param->total_ops++; if (param->verbose) printf("// insert %lu TID=%Lu\n", key, get_tid(s_p)); rc1 = oc_bpt_insert_key_b(wu_p, &s_p->bpt_s, (struct Oc_bpt_key*) &key, (struct Oc_bpt_data*) &key); rc2 = oc_bpt_alt_insert_key_b(wu_p, &s_p->alt_s, (struct Oc_bpt_key*) &key, (struct Oc_bpt_data*) &key); if (*check_eq_pio) { if (rc1 != rc2) { printf(" // mismatch in insert (%lu)\n", key); *check_eq_pio = FALSE; } if (!validate_fun()) { *check_eq_pio = FALSE; } } if (param->verbose && (*check_eq_pio)) print_fun(); }
void list_print(list_t *l, void(*print_fun)(void*)) { for(int i = 0;i < l->size; i++) { void *elem = l->data + l->elem_size * i; print_fun(elem); } }
void oc_bpt_test_utl_btree_delete( Oc_wu *wu_p, Oc_bpt_test_state *s_p) { if (param->verbose) printf("// btree delete\n"); oc_bpt_delete_b(wu_p, &s_p->bpt_s); oc_bpt_alt_delete_b(wu_p, &s_p->alt_s); if (param->verbose) print_fun(); }
// clone a b-tree void oc_bpt_test_utl_btree_clone( struct Oc_wu *wu_p, struct Oc_bpt_test_state* src_p, struct Oc_bpt_test_state* trg_p ) { if (param->verbose) printf("// clone new-TID=%Lu\n", get_tid(trg_p)); oc_bpt_clone_b(wu_p, &src_p->bpt_s, &trg_p->bpt_s); oc_bpt_alt_clone_b(wu_p, &src_p->alt_s, &trg_p->alt_s); if (param->verbose) print_fun(); }
void oc_bpt_test_utl_btree_insert_range( Oc_wu *wu_p, Oc_bpt_test_state *s_p, uint32 lo_key, uint32 len, bool *check_eq_pio) { bool rc1, rc2; uint32 key_array[30]; uint32 data_array[30]; uint32 i; // we handle limited sized arrays if (len > 30) ERR(("The test current supports up to insert-ranges of length 30")); param->total_ops++; if (param->verbose) printf("// insert_range key=%lu len=%lu\n", lo_key, len); // setup the array for (i=0; i<len ; i++) { key_array[i] = lo_key+i; data_array[i] = lo_key+i; } rc1 = oc_bpt_insert_range_b(wu_p, &s_p->bpt_s, len, (struct Oc_bpt_key*)key_array, (struct Oc_bpt_data*)data_array); rc2 = oc_bpt_alt_insert_range_b(wu_p, &s_p->alt_s, len, (struct Oc_bpt_key*)key_array, (struct Oc_bpt_data*)data_array); if (*check_eq_pio) { if (!validate_fun()) *check_eq_pio = FALSE; if (rc1 != rc2) { printf(" // mismatch in insert_range key=%lu len=%lu\n", lo_key, len); *check_eq_pio = FALSE; } } if (param->verbose && (*check_eq_pio)) print_fun(); }
int load_options(hash_table *table, int argc, char *argv[]) { if (table == NULL) return ERROR; if (argc == 0) return SUCCESS; int c; while(1) { static struct option long_options[] = { {"xml", required_argument, 0, 'x'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {"print", no_argument, 0, 'p'}, {"device", required_argument, 0, 'd'}, {"exclude", required_argument, 0, 'e'}, {"only", required_argument, 0, 'o'}, {"single-process", no_argument, 0, 's'}, {"fun", no_argument, 0, 'f'}, {0, 0, 0, 0} }; int option_index = 0; c = getopt_long (argc, argv, "x:vhpd:e:o:sf", long_options, &option_index); if (c == -1) break; if (c == '?' || c == ':') { print_syntax_error(); return ERROR; } switch (c) { case 0: if (long_options[option_index].flag != 0) break; printf("option: %s ", long_options[option_index].name); if (optarg) printf("arg: %s", optarg); printf("\n"); break; case 'p': add_hash_info(table,"print_output", "yes"); break; case 'x': if (optarg) { add_hash_info(table, "xml_output", optarg); } else { print_syntax_error(); return ERROR; } break; case 'h': print_help(); exit(0); break; case 'f': print_fun(); exit(0); break; case 'v': print_version(); exit(0); break; case 'd': if (optarg == NULL || !is_valid_plugin(optarg)) { print_syntax_error(); return ERROR; } if(equals(optarg, "all")) { add_hash_info(table, "all_plugins", "yes"); } else { add_hash_info(table, optarg, "yes"); } break; case 'e': if (optarg == NULL || !is_valid_plugin(optarg) || equals(optarg, "all")) { print_syntax_error(); return ERROR; } add_hash_info(table, optarg, "no"); break; case 'o': if (optarg == NULL || !is_valid_plugin(optarg)) { return ERROR; } add_hash_info(table,"only",optarg); break; case 's': add_hash_info(table,"single","yes"); break; } } return SUCCESS; }