Пример #1
0
void test_threads_iterator__workdir(void)
{
	_repo = cl_git_sandbox_init("status");

	run_in_parallel(
		1, 20, run_workdir_iterator, NULL, NULL);
}
Пример #2
0
void test_threads_diff__with_concurrent_index_modified(void)
{
	_repo = cl_git_sandbox_init("status");
	_check_counts = 0;

	run_in_parallel(
		5, 16, run_index_diffs_with_modifier, setup_trees, free_trees);
}
Пример #3
0
void test_threads_diff__concurrent_diffs(void)
{
	_repo = cl_git_sandbox_init("status");
	_check_counts = 1;

	run_in_parallel(
		5, 32, run_index_diffs, setup_trees, free_trees);
}
Пример #4
0
/** @brief  
  * 
  * @param args contains the parsed cmd-line options & arguments.
  * @param argc number of cmd-line arguments.
  * @param argv list of cmd-line arguments
  * @param optind index of the first non-option cmd-line argument.
  * 
  * @return exit status for main() to return.
  */
int foreach_parallel(struct cmdargs *args, int argc, char *argv[], int optind) {
  int tmp_fd = -1;
  char tmp_template[] = "/usr/tmp/foreach_parallel_XXXXXX";

  int ret;

  if (optind == argc) {
    fprintf(stderr, "%s: no input values provided.\n", getenv("_"));
    return EXIT_HELP;
  }

  /* no user-specified file - read stdin and put that into a
     tmp file */
  if (!args->file) {
    FILE *out;

    tmp_fd = mkstemp(tmp_template);
    if (tmp_fd < 0) {
      warn(args->file);
      return EXIT_FILE_ERR;
    }
    args->file = tmp_template;

    if (args->verbose) {
      printf("tmp fd: %d\ntmp name: %s\n", tmp_fd, args->file);
    }

    out = fopen(args->file, "w");
    ret = read_code(stdin, out);
    fclose(out);

    if (ret < 0) {
      fprintf(stderr, "%s: out of memory\n", getenv("_"));
      return EXIT_MEM_ERR;
    } else if (ret == 0) {
      fprintf(stderr, "%s: nothing to execute.\n", getenv("_"));
      return EXIT_HELP;
    }

  }

  ret = run_in_parallel(args->file, args, argc, argv, optind);

  /* see if these are pointing at the same string.  if so, we
     created a tmp file. */
  if (args->file == tmp_template)
    unlink(args->file);

  return ret;
}
Пример #5
0
/* Set errors so we can check that we free it */
void test_threads_basic__set_error(void)
{
	run_in_parallel(1, 4, set_error, NULL, NULL);
}