示例#1
0
int main() {
    umask(0);
    int argc = 2;
    char* argv[] = { "kvfs", "test_sandbox", NULL };
    mountparent = (char*) calloc(1,PATH_MAX);
    realpath(".", mountparent);
    safe_run_suite(&fs_tests_suite);
}
示例#2
0
int main(int argc, const char *argv[]) {
  int suite_num, i;
  suite_info_t *suites;
  char const *suite;

  struct suite_desc suite_table[] = {
    {kvstore_suite, "kvstore"},
    {kvcacheset_suite, "kvcacheset"},
    {kvcache_suite, "kvcache"},
    {kvserver_suite, "kvserver"},
    {wq_suite, "wq"},
    {socket_server_suite, "socket_server"},
    {kvserver_client_suite, "kvserver_client"},
    {kvserver_tpc_suite, "kvserver_tpc"},
    {tpclog_suite, "tpclog"},
    {tpcmaster_suite, "tpcmaster"},
    {endtoend_suite, "endtoend"},
    {endtoend_tpc_suite, "endtoend_tpc"}
  };
  int num_suites = sizeof(suite_table) / sizeof(struct suite_desc);

  suite_info_t single_suite[] = {NULL_SUITE_INFO, NULL_SUITE_INFO};

  suite_info_t checkpoint1_suites[] = {
    kvcacheset_suite,
    kvcache_suite,
    kvserver_suite,
    wq_suite,
    socket_server_suite,
    endtoend_suite,
    NULL_SUITE_INFO
  };

  suite_info_t all_suites[] = {
    kvcacheset_suite,
    kvcache_suite,
    kvserver_suite,
    wq_suite,
    socket_server_suite,
    endtoend_suite,
    kvserver_tpc_suite,
    tpcmaster_suite,
    endtoend_tpc_suite,
    NULL_SUITE_INFO
  };

  if (argc < 2 || strcmp("checkpoint2", (suite = argv[1])) == 0
      || strcmp("all", suite) == 0) {
    suites = all_suites;
  } else if (strcmp("checkpoint1", suite) == 0) {
    suites = checkpoint1_suites;
  } else {
    suite_num = lookup(suite, suite_table, num_suites);
    if (suite_num < 0) {
      printf("Error: Invalid suite name passed in. Valid suite names are:"
             "\ncheckpoint1\ncheckpoint2\nall\n\n");
      for (i = 0; i < num_suites; i++)
        printf("%s\n", suite_table[i].name);
      exit(-1);
    }
    single_suite[0] = suite_table[suite_num].suite;
    suites = single_suite;
  }

  i = 0;

  while (!IS_NULL_SUITE_INFO(suites[i])) {
    safe_run_suite(&suites[i++]);
  }

  printf("A total of %d suites were run\n%d tests passed, %d tests failed\n",
      suites_run, tests_passed, tests_failed);
}