Beispiel #1
0
int main(int argc, const char **argv) 
{
  rados_t cluster;
  rados_ioctx_t io_ctx;
  rbd_image_t image;

  srand(time(0));

  assert(rados_create(&cluster, NULL) == 0);
  assert(rados_conf_parse_argv(cluster, argc, argv) == 0);
  assert(rados_conf_read_file(cluster, NULL) == 0);
  assert(rados_connect(cluster) == 0);

  if (rados_pool_lookup(cluster, TEST_POOL) != -ENOENT) {
    int r = rados_pool_delete(cluster, TEST_POOL);
    printf("rados_pool_delete returned %d\n", r);
  }
  int r = rados_pool_create(cluster, TEST_POOL);
  printf("rados_pool_create returned %d\n", r);

  assert(rados_ioctx_create(cluster, TEST_POOL, &io_ctx) == 0);
  test_ls(io_ctx, 0);

  test_create_and_stat(io_ctx, TEST_IMAGE, MB_BYTES(1));
  assert(rbd_open(io_ctx, TEST_IMAGE, &image, NULL) == 0);

  test_ls(io_ctx, 1, TEST_IMAGE);
  test_ls_snaps(image, 0);

  test_create_snap(image, TEST_SNAP);
  test_ls_snaps(image, 1, TEST_SNAP, MB_BYTES(1));
  test_resize_and_stat(image, MB_BYTES(2));
  test_io(io_ctx, image);

  test_create_snap(image, TEST_SNAP "1");
  test_ls_snaps(image, 2, TEST_SNAP, MB_BYTES(1), TEST_SNAP "1", MB_BYTES(2));

  test_delete_snap(image, TEST_SNAP);
  test_ls_snaps(image, 1, TEST_SNAP "1", MB_BYTES(2));

  test_delete_snap(image, TEST_SNAP "1");
  test_ls_snaps(image, 0);

  test_io_to_snapshot(io_ctx, image, MB_BYTES(2));
  assert(rbd_close(image) == 0);

  test_create_and_stat(io_ctx, TEST_IMAGE "1", MB_BYTES(2));
  test_ls(io_ctx, 2, TEST_IMAGE, TEST_IMAGE "1");

  test_delete(io_ctx, TEST_IMAGE);
  test_ls(io_ctx, 1, TEST_IMAGE "1");

  test_delete(io_ctx, TEST_IMAGE "1");
  test_ls(io_ctx, 0);

  rados_ioctx_destroy(io_ctx);
  rados_shutdown(cluster);

  return 0;
}
Beispiel #2
0
int main() {
	test_create_pointer_stack();
	test_main();
	test_extended();
	test_io();
	test_limitation();
	test_optimization();
	test_private();
	test_protection();
	return 0;
}
Beispiel #3
0
int main(int argc , char ** argv) {
  create_test();
  get_test();
  set_test();
  load_empty_test();
  test_equal();
  test_copy();
  test_io();
  test_update_undefined( );
  test_select_matching();
  test_count_matching();
  exit(0);
}
Beispiel #4
0
//============================================
//  メインプログラム
//============================================
int main(void)
{
    EC_GROUP ec;

    curve_init(ec, "ec_bn254_tw");

    test_feature(ec);

    test_arithmetic_operation(ec);

    test_map_to_point(ec);

    test_io(ec);

    curve_clear(ec);

    fprintf(stderr, "ok\n");

    return 0;
}
Beispiel #5
0
//============================================
//
//============================================
int main(void)
{
    Field f;

    field_init(f, "bn254_fp6");

    test_feature(f);

    test_arithmetic_operation(f);

    test_sqrt(f);

    //test_frob(f);

    test_io(f);

    field_clear(f);

    fprintf(stderr, "ok\n");

    return 0;
}
Beispiel #6
0
int main(int argc, char *argv[])
{
    SceCtrlData pad;
    int result;
    int oldButtons = 0;
    int cbid = -1;
    int waitStatThid = -1;

    pspDebugScreenInit();
    if (argc > 0) {
        printf("Bootpath: %s\n", argv[0]);
    }

    printf("Triangle - Exit\n");
    printf("Left - sceUmdActivate\n");
    printf("Right - sceUmdDeactivate\n");
    printf("Cross - Delay CB\n");
    printf("Circle - Display umd info\n");
    printf("Square - Refer umd callback\n");
    printf("L-Trigger - IO test\n");
    printf("R-Trigger - Start/Stop wait stat test\n");

    SetupCallbacks();

    sceCtrlSetSamplingCycle(0);
    sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

    {
        printUmdInfo();

        // result:
        // callback events are generated if we launch from iso or immediately after psplink has reset
        cbid = sceKernelCreateCallback("UMD Callback (not active)", umd_callback, (void*)0x34343434);
        result = sceUmdRegisterUMDCallBack(cbid);
        printf("sceUmdRegisterUMDCallBack result %08X\n", result);

		// Register a second UMD callback: it will overwrite the first one.
		cbid = sceKernelCreateCallback("UMD Callback", umd_callback, (void*)0x11111111);
		result = sceUmdRegisterUMDCallBack(cbid);
        printf("sceUmdRegisterUMDCallBack result %08X\n", result);
    }

    while (!done)
    {
        sceCtrlReadBufferPositive(&pad, 1); // context switch in here
        //sceCtrlPeekBufferPositive(&pad, 1); // no context switch version
        int buttonDown = (oldButtons ^ pad.Buttons) & pad.Buttons;

        if (buttonDown & PSP_CTRL_LEFT)
        {
            result = sceUmdActivate(1, "disc0:");
            printf("sceUmdActivate result %08x\n", result);
        }

        if (buttonDown & PSP_CTRL_RIGHT)
        {
            result = sceUmdDeactivate(1, "disc0:");
            printf("sceUmdDeactivate result %08x\n", result);
        }

        if (buttonDown & PSP_CTRL_CROSS)
        {
            printf("sceKernelDelayThreadCB ...\n");
            sceKernelDelayThreadCB(10000);
        }

        if (buttonDown & PSP_CTRL_CIRCLE)
        {
            printUmdInfo();
        }

        if (buttonDown & PSP_CTRL_SQUARE)
        {
            SceKernelCallbackInfo info;
            memset(&info, 0xee, sizeof(info));
            info.size = sizeof(info);
            result = sceKernelReferCallbackStatus(cbid, &info);
            printf("sceKernelReferCallbackStatus result %08x\n", result);
            printf("  size %d (%d)\n", info.size, sizeof(info));
            printf("  name '%s'\n", info.name);
            printf("  threadId %08x (%08x)\n", info.threadId, sceKernelGetThreadId());
            printf("  callback %p common %p\n", info.callback, info.common);
            printf("  notifyCount %08x\n", info.notifyCount);
            printf("  notifyArg %08x\n", info.notifyArg);
        }

        if (buttonDown & PSP_CTRL_LTRIGGER)
        {
            test_io();
        }

        if (buttonDown & PSP_CTRL_RTRIGGER)
        {
            if (waitStatThid >= 0)
            {
                printf("Cleaning up wait stat test ...\n");

                referThread(waitStatThid);

                result = sceUmdCancelWaitDriveStat();
                printf("sceUmdCancelWaitDriveStat result %08x\n", result);

                referThread(waitStatThid);

                result = sceKernelDeleteThread(waitStatThid);
                printf("sceKernelDeleteThread result %08x\n", result);

                //result = sceKernelTerminateDeleteThread(waitStatThid);
                //printf("sceKernelTerminateDeleteThread result %08x\n", result);

                waitStatThid = -1;
            }
            else
            {
                printf("Starting wait stat test ...\n");

                // test timeout:
                // Press Right (deactivate UMD)
                // Press R-Trigger:
                // - Press R-Trigger again before 3 seconds:
                //   0x800201a9 wait cancelled
                // - Or wait 3 seconds:
                //   0x800201a8 wait timeout
                struct WaitStatParams params = { 0x20, 3000000 };

                // test internal workings:
                // - (wantStat & curStat) == wantStat
                // - (wantStat & curStat) != 0 <-- looks like this is the correct one
                //struct WaitStatParams params = { 0xFF, 3000000 };

                waitStatThid = sceKernelCreateThread("WaitUMDStat", waitstat_thread, 0x20, 0x4000, 0, 0);
                printf("sceKernelCreateThread result %08x\n", waitStatThid);
                if (waitStatThid >= 0)
                {
                    result = sceKernelStartThread(waitStatThid, sizeof(params), &params);
                    printf("sceKernelStartThread result %08x\n", result);
                }
            }
        }

        if (buttonDown & PSP_CTRL_TRIANGLE)
            done = 1;

        oldButtons = pad.Buttons;
        sceDisplayWaitVblank(); // only catch callback when we press Cross (sceKernelDelayThreadCB)
        //sceDisplayWaitVblankCB(); // catch all callback events
    }

    sceKernelExitGame();
    return 0;
}