int main() {
    try {
        test_store();
    } catch (const std::exception& e) {
        std::cout << e.what() << std::endl;
        return 1;
    }
    return 0;
}
Example #2
0
int main ( void ) {
	plan_tests(119);
	
	test_variables();
	test_literals();
	test_resources();
	test_bnodes();
	test_cmp();
	test_store();
	
	return exit_status();
}
Example #3
0
int main()
{
    int tx_port = 0;
    char *source = "test/test_defs.b";

    sys_init(0);
    tx_server(source, "bin/state", &tx_port);
    vol_init(0, "bin/volume");

    char *code = sys_load(source);
    env = env_new(source, code);
    mem_free(code);

    int len = 0;
    char **files = sys_list("test/data", &len);

    vars = vars_new(len);
    rvars = vars_new(len);
    for (int i = 0; i < len; ++i) {
        vars_add(rvars, files[i], 0, NULL);
        vars_add(vars, files[i], 0, NULL);
    }
    vars_add(vars, "___param", 0, NULL);

    test_vars();
    test_load();
    test_param();
    test_clone();
    test_eq();
    test_store();
    test_select();
    test_rename();
    test_extend();
    test_join();
    test_project();
    test_semidiff();
    test_summary();
    test_union();
    test_compound();
    test_call();

    tx_free();
    env_free(env);
    mem_free(files);
    vars_free(vars);
    vars_free(rvars);

    return 0;
}
int main(){

	ps = new PagingSystem(32, 1024, 4);

	test_dir();

	test_store();

	test_dir();

	test_delete();

	test_dir();
	
	test_read();
}
Example #5
0
int main (void)
{
  int i;
  for (i = 0; i < MAX; ++i)
    {
      pa[i] = i * 2;
      pb[i] = i * 2 + 1;
    }

  test_load ();
  test_store ();
  test_exch ();
  test_cas ();

  return 0;
}
Example #6
0
/*
 * main
 */
int
main(int argc, char **argv)
{
    int	sts;

    set_proc_fmt();
    printf("pid=%" FMT_PID " ppid=%" FMT_PID "\n", getpid(), getppid());
    getargs(argc, argv);

    if (pmnsfile != PM_NS_DEFAULT) {
	if ((sts = pmLoadNameSpace(pmnsfile)) < 0) {
	    printf("%s: Cannot load pmnsfile from \"%s\": %s\n", 
		    pmProgname, pmnsfile, pmErrStr(sts));
	    exit(1);
	}
    }

    if ((sts = pmNewContext(PM_CONTEXT_HOST, host)) < 0) {
	printf("%s: Cannot connect to PMCD on host \"%s\": %s\n", 
		pmProgname, host, pmErrStr(sts));
	exit(1);
    }

    test_PMNS();
    test_desc();
    test_instance();
    test_prof_fetch();
    if (!is_hotproc)
        test_store();

    if ((sts = pmWhichContext()) < 0) {
	printf("%s: pmWhichContext: %s\n", pmProgname, pmErrStr(sts));
	exit(1);
    }
    pmDestroyContext(sts);

    exit(0);
}
Example #7
0
main()
{
	char *repo_name = "pds_demo.dat";
	char *ndx_name = "pds_demo.ndx";
	int status;

	status = pds_open( repo_name, ndx_name );
	if( status != PDS_SUCCESS ){
		fprintf(stderr, "pds_open failed: %d\n", status);
		exit(1);
	}
	test_store();
	test_search();

	// Close and reopen to check if the index got saved properly
	pds_close();
	status = pds_open( repo_name, ndx_name );
	if( status != PDS_SUCCESS ){
		fprintf(stderr, "pds_open failed: %d\n", status);
		exit(1);
	}
	test_search();
	test_delete();
	pds_close();

	status = pds_open( repo_name, ndx_name );
	if( status != PDS_SUCCESS ){
		fprintf(stderr, "pds_open failed: %d\n", status);
		exit(1);
	}
	test_search();

	pds_close();

	printf("Program terminated successfully\n");
}
Example #8
0
int hc_store_multiple_files(int * argc, char ** argv, char *note) {

    char *test_vip =hash_get_value(CONTEXT_KEY_DATA_VIP,context_hash);
    int test_vip_port =atoi(hash_get_value(CONTEXT_KEY_DATA_VIP_PORT,context_hash));
    int first_time = TRUE;
    hcoa_store_handle_t *handle = NULL;
    int reuse_handle = TRUE;
    int err;
    hc_long_t size;
    int iters;

    if (test_vip == NULL) {
	hc_test_log(LOG_ERROR_LEVEL, "No data VIP has been provided.\n");
	return TEST_ERROR;
    }

    if (*argc < 2) {
	hc_test_log(LOG_ERROR_LEVEL, "you must pass in the number of store operations you want to execute and the max size of each file.\n");
	return TEST_ERROR;
    }
    iters = atoi(argv[0]);
    if (strcmp(argv[1], "-1") == 0) { // A -1 value means random size
	size = -1;
    } 
    else {
	size = translate_size(argv[1]); // A -1 value means size is random
	if (size == -1) {
	    hc_test_log(LOG_ERROR_LEVEL, "Invalid file size %s.\n", argv[1]);
	    return TEST_ERROR;
	}
    }

    if (*argc <= 3) {
	reuse_handle = atoi(argv[2]);
    }

    hc_test_log(LOG_DEBUG_LEVEL, "about to store %d files to %s:%d.\n",iters, test_vip,test_vip_port);

    if ((err = hc_standalone_init()) != HCERR_OK) {
	hc_test_log(LOG_ERROR_LEVEL, "hc_standalone_init failed! Return code was %s\n",hc_decode_hcerr(err));
	return TEST_ERROR;
    } else {
	hc_test_log(LOG_DEBUG_LEVEL, "hc_standalone_init succeeded!\n");
    }
    for (int i = 0; i < iters;i++) {
	FILE *input_file;
	char file_name[1024];
	hc_long_t sizegend;
	int in_file_fd = -1;

	if (first_time == TRUE || reuse_handle != TRUE) {
	    if (handle != NULL)
		free (handle);
	    if ((err = hcoa_store_object_create(&handle, test_vip, test_vip_port,0,0)) != HCERR_OK) {
		hc_test_log(LOG_ERROR_LEVEL, "Unable to create store handle! Return code was %s\n",hc_decode_hcerr(err));
		return err;
	    } else {
		hc_test_log(LOG_DEBUG_LEVEL, "hcoa_store_object_create succeeded!\n");
	    }
	    first_time = FALSE;
	}
	if (size == -1) {
	    size = rand();
	}
	if ( ( sizegend=file_generator(size, rand(),file_name, input_file) ) != size) {
	    hc_test_log(LOG_ERROR_LEVEL, "the size of the file generated, %ld, does not match the size requested  %ld.\n", (long)sizegend,(long)size);
	    return TEST_ERROR;
	}
	if((in_file_fd = open(file_name, O_RDONLY | O_BINARY)) == -1) {
	    hc_test_log(LOG_ERROR_LEVEL, "Failed to open data file '%s' for store: %d\n", file_name, in_file_fd);
	    return TEST_ERROR;
	}
	err = test_store (&read_from_file_data_source, (void *)in_file_fd, handle );
	close(in_file_fd);
	remove(file_name);

    }
    hc_cleanup(); 

    if (err != HCERR_OK) {
	hc_test_log(LOG_INFO_LEVEL, "Store operation returned %s.\n", hc_decode_hcerr(err));
	return TEST_FAIL;
    }
    return TEST_PASS;
}