コード例 #1
0
ファイル: fmemopentest.c プロジェクト: Basskrapfen/openbsd
int
main(void)
{
	int	 failures = 0;

	failures += simpletest();
	failures += updatetest();
	failures += writetest();
	failures += seektest();

 	return (failures);
}
コード例 #2
0
ファイル: usertests.c プロジェクト: msyksphinz/xv6-mips
int
main(int argc, char *argv[])
{
  printf(1, "usertests starting\n");

  if(open("usertests.ran", 0) >= 0){
    printf(1, "already ran user tests -- rebuild fs.img\n");
    exit();
  }
  close(open("usertests.ran", O_CREATE));

  createdelete();
  linkunlink();
  concreate();
  fourfiles();
  sharedfd();

  bigargtest();
  bigwrite();
  bigargtest();
  bsstest();
  sbrktest();
  validatetest();

  opentest();
  writetest();
  writetest1();
  createtest();

  openiputtest();
  exitiputtest();
  iputtest();

  mem();
  pipe1();
  preempt();
  exitwait();

  rmdot();
  fourteen();
  bigfile();
  subdir();
  linktest();
  unlinkread();
  dirfile();
  iref();
  forktest();
  bigdir(); // slow
  exectest();

  exit();
}
コード例 #3
0
ファイル: io.c プロジェクト: 6hoursdaily/node
int main()
{
  int i;
  int bsizes[] = {1024, 4096, 8192, 16384, 32768, 65536, 0};

  for (i = 0; bsizes[i] != 0; i++) {
    writetest(tsize, bsizes[i]);
  }
  for (i = 0; bsizes[i] != 0; i++) {
    readtest(tsize, bsizes[i]);
  }
  atexit(cleanup);
  return 0;
}
コード例 #4
0
ファイル: microbench.c プロジェクト: Mic92/Determinator
int main(int argc, char **argv)
{
	int full, np, nth, i, j, val = 0;
	struct args a;

	forktest();	// once to warm up
	const int forkiters = 10000;
	uint64_t ts = bench_time();
	for (i = 0; i < forkiters; i++)
		forktest();
	uint64_t td = (bench_time() - ts) / forkiters;
	printf("proc fork/wait: %lld ns\n", (long long)td);

	for (full = 0; full < 2; full++) {
		for (np = 1; np <= 1024; np *= 2) {
			for (nth = 1; nth <= MAXTHREADS; nth *= 2) {
				a.npages = np;
				a.fullpage = full;
				a.nthreads = nth;
				a.val = val++;
				writetest(&a);		// once to warm up
				const int iters = 10000;
				ts = bench_time();
				for (j = 0; j < iters; j++)
					writetest(&a);
				td = (bench_time() - ts) / iters;
				printf("fork/join x%d, %s %d pages: %lld ns\n",
					nth,
					full ? "scrubbing" : "touching", np,
					(long long)td);
			}
		}
	}

	return 0;
}
コード例 #5
0
ファイル: io.c プロジェクト: AntonMacias/node
int main(int argc, char** argv)
{
  int i;
  int bsizes[] = {1024, 4096, 8192, 16384, 32768, 65536, 0};

  if (argc > 1) path = argv[1];

  for (i = 0; bsizes[i] != 0; i++) {
    writetest(tsize, bsizes[i]);
  }
  for (i = 0; bsizes[i] != 0; i++) {
    readtest(tsize, bsizes[i]);
  }
  atexit(cleanup);
  return 0;
}
コード例 #6
0
//MAIN FUNCTION
int main(void)
{	
	FILE *fp = fopen(filepath, "ab");
	int readtest(int num_iterations, int scale_factor, void *src);
	int writetest(int num_iterations, int scale_factor, FILE *output_file, void *src);

	// USERSPACE UIO DRIVER FOR BRAM
	ptr_BRAM = malloc(BRAM_MAP_SIZE);
	fd = open("/dev/uio0", O_RDWR);
	if (fd < 1){
		fprintf(stderr, "Invalid UIO device file.\n");
		return -1;
	}
	ptr_BRAM = mmap(NULL, BRAM_MAP_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
	
	// PTR FOR RUNNING BASELINE TESTS
	/* 
	ptr_baseline = malloc(BRAM_MAP_SIZE);
	int j;
	for (j = 0; j < BRAM_MAP_SIZE/4; j = j+1)
	{
		ptr_baseline[j] = j;
	}
	*/

	// LOOP OVER A RANGE OF DATA SIZES
	int i;
	for (i = 1; i <= max_partitions; i = i*2)
	{
		//readtest_out = readtest(num_iterations, i, ptr_BRAM);
		writetest_out = writetest(num_iterations, i , fp, ptr_BRAM);
		//baseline_readtest_out = readtest(num_iterations, i, ptr_baseline);
		//baseline_writetest_out = writetest(num_iterations, i, fp, ptr_baseline);
	}
	
	// CLOSE FILES AND UNMAP BRAM
	fclose(fp);
	munmap(ptr_BRAM, BRAM_MAP_SIZE);

	return 0;
}
コード例 #7
0
ファイル: tfstest.c プロジェクト: Pedersen175/DAN-uMon
int
main(int argc,char *argv[])
{
	int	err, opt, removefiles, list;
	char *file1, *file2;

	verbose = 0;
	list = 0;
	removefiles = 1;
	getoptinit();
	while((opt=getopt(argc,argv,"lrv")) != -1) {
		switch(opt) {
		case 'l':
			list = 1;
			break;
		case 'r':
			removefiles = 0;
			break;
		case 'v':
			verbose++;
			break;
		default:
			usage(0);
		}
	}

	if (argc != optind+2)
		usage("Bad arg count");

	/* Test all aspects of TFS API calls: */
	file1 = argv[optind];
	file2 = argv[optind+1];
	if ((!strcmp(file1,TMPFILE)) || (!strcmp(file2,TMPFILE)))
		usage(TMPFILE);


	if (verbose)
		mon_printf("tfstest %s %s...\n",file1,file2);
	

	/* 
	 *	Start by removing files to be created later...
	 */
	if (mon_tfsstat(TMPFILE)) {
		if (verbose)
			mon_printf("Removing %s...\n",TMPFILE);
		err = mon_tfsunlink(TMPFILE);
		if (err != TFS_OKAY)
			tfsdie(err);
	}
	if (mon_tfsstat(file1)) {
		if (verbose)
			mon_printf("Removing %s...\n",file1);
		err = mon_tfsunlink(file1);
		if (err != TFS_OKAY)
			tfsdie(err);
	}
	if (mon_tfsstat(file2)) {
		if (verbose)
			mon_printf("Removing %s...\n",file2);
		err = mon_tfsunlink(file2);
		if (err != TFS_OKAY)
			tfsdie(err);
	}

	/*
	 *	Create a file...
	 */
	if (verbose)
		mon_printf("Creating %s...\n",file1);
	err = mon_tfsadd(file1,"data1","2",data1,strlen(data1));
	if (err != TFS_OKAY)
		tfsdie(err);

	/*
	 *	Basic getline test...
	 */
	if (verbose)
		mon_printf("Checking 'getline'...\n");
	getlinetest(file1,data1);

	/*
	 *	Now copy the file...
	 */
	if (verbose)
		mon_printf("Copying %s to %s...\n",file1,file2);
	cp(file2,file1);

	/*
	 *	Now compare the two...
	 *	(they should be identical)
	 */
	if (verbose)
		mon_printf("Comparing %s to %s...\n",file1,file2);
	if (cmp(file1,file2) != 0)
		die();

	/*
	 *	Seek test...
	 *  Verify that data at a specified offset is as expected based on the
	 *	file (file1) initially created from the data1 array...
	 */
	if (verbose)
		mon_printf("Running seek test on %s...\n",file1);
	seektest(file1,38,data1[38]);

	/* 
	 *	Truncateion test...
	 *	Truncate a file and verify.
	 */
	if (verbose)
		mon_printf("Running truncation test on %s...\n",file1);
	trunctest(file1,data1);

	/*
	 *	Tfsctrl() function test...
	 */
	if (verbose)
		mon_printf("Running tfsctrl test...\n");
	ctrltest(file1,data1);

	/* 
	 *	Write test...
	 *	Modify a file in a few different ways and verify the modification...
	 *	Note that after this point, file1 and data1 are not the same.
	 *	The content of file1 will be the same as the new_data1 array.
	 */
	if (verbose)
		mon_printf("Running write test on %s...\n",file1);
	writetest(file1,new_data1);
	
	/*
	 *	File in-use test...
	 *	Verify that if a file is in-use, it cannot be removed.
	 */
	if (verbose)
		mon_printf("Running in-use test on %s...\n",file1);
	inusetest(file1);

	/*
	 *	Append test...
	 *	Verify that a file can be properly appended to.
	 */
	if (verbose)
		mon_printf("Running append test on %s...\n",file1);
	appendtest(file1,"this_is_some_data","this_is_the_appended_data");

	/*
	 * If the -r option is not set, then remove the files...
	 */
	if (removefiles) {
		if (mon_tfsstat(file1)) {
			err = mon_tfsunlink(file1);
			if (err != TFS_OKAY)
				tfsdie(err);
		}
		if (mon_tfsstat(file2)) {
			err = mon_tfsunlink(file2);
			if (err != TFS_OKAY)
				tfsdie(err);
		}
		if (mon_tfsstat(TMPFILE)) {
			err = mon_tfsunlink(TMPFILE);
			if (err != TFS_OKAY)
				tfsdie(err);
		}
	}

	if (list)
		ls();

	/* All error cases checked above would have resulted in an exit
	 * of this application, so if we got here, the testing must
	 * have succeeded...
	 */
	mon_printf("TFS test on %s & %s PASSED\n",file1,file2);
	mon_appexit(0);
	return(0);
}