int main(int argc, char * const argv[])
{
	if (initial_check(argc, argv))
		return 1;

	node = argv[1];

	libubi = libubi_open();
	if (libubi == NULL) {
		failed("libubi_open");
		return 1;
	}

	if (ubi_get_dev_info(libubi, node, &dev_info)) {
		failed("ubi_get_dev_info");
		goto close;
	}

	if (test_update(UBI_DYNAMIC_VOLUME))
		goto close;
	if (test_update(UBI_STATIC_VOLUME))
		goto close;

	libubi_close(libubi);
	return 0;

close:
	libubi_close(libubi);
	return 1;
}
Exemplo n.º 2
0
void G1StaticIHOPControl::test() {
  size_t const initial_ihop = 45;

  G1StaticIHOPControl ctrl(initial_ihop);
  ctrl.update_target_occupancy(100);

  size_t threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_ihop,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);

  ctrl.update_allocation_info(100.0, 100, 100);
  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_ihop,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);

  ctrl.update_marking_length(1000.0);
  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_ihop,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);

  // Whatever we pass, the IHOP value must stay the same.
  test_update(&ctrl, 2, 10, 10, 3);
  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_ihop,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);

  test_update(&ctrl, 12, 10, 10, 3);
  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_ihop,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold);
}
Exemplo n.º 3
0
void start_test(int id)
{
  uint i;
  int error,lock_type;
  MI_ISAMINFO isam_info;
  MI_INFO *file,*file1,*file2=0,*lock;

  if (use_log)
    mi_log(1);
  if (!(file1=mi_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)) ||
      !(file2=mi_open(filename,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
  {
    fprintf(stderr,"Can't open isam-file: %s\n",filename);
    exit(1);
  }
  if (key_cacheing && rnd(2) == 0)
    init_key_cache(dflt_key_cache, KEY_CACHE_BLOCK_SIZE, 65536L, 0, 0);
  printf("Process %d, pid: %d\n",id,getpid()); fflush(stdout);

  for (error=i=0 ; i < tests && !error; i++)
  {
    file= (rnd(2) == 1) ? file1 : file2;
    lock=0 ; lock_type=0;
    if (rnd(10) == 0)
    {
      if (mi_lock_database(lock=(rnd(2) ? file1 : file2),
			   lock_type=(rnd(2) == 0 ? F_RDLCK : F_WRLCK)))
      {
	fprintf(stderr,"%2d: start: Can't lock table %d\n",id,my_errno);
	error=1;
	break;
      }
    }
    switch (rnd(4)) {
    case 0: error=test_read(file,id); break;
    case 1: error=test_rrnd(file,id); break;
    case 2: error=test_write(file,id,lock_type); break;
    case 3: error=test_update(file,id,lock_type); break;
    }
    if (lock)
      mi_lock_database(lock,F_UNLCK);
  }
  if (!error)
  {
    mi_status(file1,&isam_info,HA_STATUS_VARIABLE);
    printf("%2d: End of test.  Records:  %ld  Deleted:  %ld\n",
	   id,(long) isam_info.records, (long) isam_info.deleted);
    fflush(stdout);
  }

  mi_close(file1);
  mi_close(file2);
  if (use_log)
    mi_log(0);
  if (error)
  {
    printf("%2d: Aborted\n",id); fflush(stdout);
    exit(1);
  }
}
Exemplo n.º 4
0
int main()
{
  test_basic();
  test_capacity();
  test_comparison();
  test_composite_key();
  test_conv_iterators();
  test_copy_assignment();
  test_hash_ops();
  test_iterators();
  test_key_extractors();
  test_list_ops();
  test_modifiers();
  test_mpl_ops();
  test_observers();
  test_projection();
  test_range();
  test_rank_ops();
  test_rearrange();
  test_safe_mode();
  test_serialization();
  test_set_ops();
  test_special_set_ops();
  test_update();

  return boost::report_errors();
}
Exemplo n.º 5
0
int main()
{
    test_misc();
    test_clear();
    test_update();
    test_circular();

    return 0;
}
Exemplo n.º 6
0
int unittest_io_writer_log_logbuffer()
{
   if (test_initfree())    goto ONERR;
   if (test_query())       goto ONERR;
   if (test_update())      goto ONERR;

   return 0;
ONERR:
   return EINVAL;
}
Exemplo n.º 7
0
int main(int argc, char **argv)
{
    test_construct();
    test_simple();
    test_update();
    test_multiple_keys();
    test_function_update();
    test_free_null();
    test_negative_size();
    test_clear();
    return 0;
}
Exemplo n.º 8
0
static void run_tests()
{
    test_misc();
    test_clear();
    test_update();
    test_conditional_updates();
    test_circular();
    test_set_nocheck();
    test_iterators();
    test_preserve_order();
    test_object_foreach();
}
Exemplo n.º 9
0
int main()
{
    test_misc();
    test_clear();
    test_update();
    test_circular();
    test_set_nocheck();
    test_iterators();
    test_preserve_order();

    return 0;
}
Exemplo n.º 10
0
void update()
{
	switch(game->state) {
		case Game_State_None:
#if DEBUG
			test_update();
#endif
			break;
		case Game_State_Menu:
			main_menu_update();
			break;
		case Game_State_Play:
			play_state_update();
			break;
		default:
			break;
	}
}
Exemplo n.º 11
0
int main(int argc, char **argv)
{
	int fd;

	parse_args(argc, argv);
	print_options();

	fd = open(rtcdev, O_RDONLY);

	if (fd == -1) {
		perror(rtcdev);
		exit(errno);
	}

	if (autotest) {
		auto_test(fd);
		goto done;
	}

	if (!strcmp(cmd, "read")) {
		test_read_time(fd);
	} else if (!strcmp(cmd, "write")) {
		test_set_time(fd);
	} else if (!strcmp(cmd, "vl")) {
		test_low_voltage(fd);
	} else if (!strcmp(cmd, "update")) {
		test_update(fd);
	} else if (!strcmp(cmd, "alarm")) {
		test_alarm(fd);
	} else if (!strcmp(cmd, "periodic")) {
		test_periodic(fd);
	} else {
		printf("invalid command %s\n", cmd);
	}
	goto done;

done:
	fprintf(stderr, "\n*** Test complete ***\n");

	close(fd);

	return 0;
}
Exemplo n.º 12
0
int main()
{
    MYSQL *conn;
    MYSQL_RES *res;
    MYSQL_ROW row;
    conn = mysql_init(NULL);
    if(!mysql_real_connect(conn, server,
                user, password, database, 0, NULL, 0))
    {
        printf("%s\n", mysql_error(conn));
        return 0;
    }
    printf("print the type of benchmark:\n");
    printf("1.insert\n2.delete\n3.update\n4.replace\n");
    int type;
    scanf("%d", &type);
    switch(type)
    {
        case 1:
            int insert_type, insert_time, insert_size;
            printf("1.simple insert\n2.concurrency insert\n");
            scanf("%d", &insert_type);
            printf("print the time you wanto insert:\n");
            scanf("%d", &insert_time);
            printf("print the size you wanto insert:\n1.1B\n2.1K\n3.1M\nOthers\n");
            scanf("%d", &insert_size);
            if(insert_size == 1)
                insert_size = SIZE_1B;
            else if(insert_size == 2)
                insert_size = SIZE_1K;
            else if(insert_size == 3)
                insert_size = SIZE_1M;
            if(insert_type == 1)
                test_insert(conn, insert_time, insert_size, 0);
            else
            {
                test_concurrency_insert(conn, insert_time, insert_size);
            }
            break;
        case 2:
            test_delete(conn);
            break;
        case 3:
            printf("print the update size\n1.1B\n2.1K\n3.1M\nOther\n");
            int update_size;
            scanf("%d", &update_size);
            if(update_size == 1)
                update_size = SIZE_1B;
            else if(update_size == 2)
                update_size = SIZE_1K;
            else if(update_size == 3)
                update_size = SIZE_1M;
            test_update(conn, update_size);
            break;
        case 4:
            int rep_insert_time, rep_insert_type, rep_insert_size;
            printf("print the time you wanto insert:\n");
            scanf("%d", &rep_insert_time);
            printf("print the size you wanto insert:\n1.1B\n2.1K\n3.1M\nOthers\n");
            scanf("%d", &rep_insert_size);
            if(rep_insert_size == 1)
                rep_insert_size = SIZE_1B;
            else if(rep_insert_size == 2)
                rep_insert_size = SIZE_1K;
            else if(rep_insert_size == 3)
                rep_insert_size = SIZE_1M;
            test_insert(conn, rep_insert_time, rep_insert_size, 1);
            break;
    }
    return 0;
}
Exemplo n.º 13
0
void G1AdaptiveIHOPControl::test() {
  size_t const initial_threshold = 45;
  size_t const young_size = 10;
  size_t const target_size = 100;

  // The final IHOP value is always
  // target_size - (young_size + alloc_amount/alloc_time * marking_time)

  G1Predictions pred(0.95);
  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
  ctrl.update_target_occupancy(target_size);

  // First "load".
  size_t const alloc_time1 = 2;
  size_t const alloc_amount1 = 10;
  size_t const marking_time1 = 2;
  size_t const settled_ihop1 = target_size - (young_size + alloc_amount1/alloc_time1 * marking_time1);

  size_t threshold;
  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == initial_threshold,
         "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
  for (size_t i = 0; i < G1AdaptiveIHOPNumInitialSamples - 1; i++) {
    ctrl.update_allocation_info(alloc_time1, alloc_amount1, young_size);
    ctrl.update_marking_length(marking_time1);
    // Not enough data yet.
    threshold = ctrl.get_conc_mark_start_threshold();
    assert(threshold == initial_threshold,
           "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_threshold, threshold);
  }

  test_update(&ctrl, alloc_time1, alloc_amount1, young_size, marking_time1);

  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold == settled_ihop1,
         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);

  // Second "load". A bit higher allocation rate.
  size_t const alloc_time2 = 2;
  size_t const alloc_amount2 = 30;
  size_t const marking_time2 = 2;
  size_t const settled_ihop2 = target_size - (young_size + alloc_amount2/alloc_time2 * marking_time2);

  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);

  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold < settled_ihop1,
         "Expected IHOP threshold to settle at a value lower than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop1, threshold);

  // Third "load". Very high (impossible) allocation rate.
  size_t const alloc_time3 = 1;
  size_t const alloc_amount3 = 50;
  size_t const marking_time3 = 2;
  size_t const settled_ihop3 = 0;

  test_update(&ctrl, alloc_time3, alloc_amount3, young_size, marking_time3);
  threshold = ctrl.get_conc_mark_start_threshold();

  assert(threshold == settled_ihop3,
         "Expected IHOP threshold to settle at " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);

  // And back to some arbitrary value.
  test_update(&ctrl, alloc_time2, alloc_amount2, young_size, marking_time2);

  threshold = ctrl.get_conc_mark_start_threshold();
  assert(threshold > settled_ihop3,
         "Expected IHOP threshold to settle at value larger than " SIZE_FORMAT " but is " SIZE_FORMAT, settled_ihop3, threshold);
}
Exemplo n.º 14
0
int test_main(int,char *[])
{
  test_update();
  return 0;
}