xref: /xnu-8020.140.41/tools/tests/perf_index/perfindex-file_read.c (revision 27b03b360a988dfd3dfdf34262bb0042026747cc) !
1*27b03b36SApple OSS Distributions #include "perf_index.h"
2*27b03b36SApple OSS Distributions #include "fail.h"
3*27b03b36SApple OSS Distributions #include "test_file_helper.h"
4*27b03b36SApple OSS Distributions #include <sys/param.h>
5*27b03b36SApple OSS Distributions #include <stdio.h>
6*27b03b36SApple OSS Distributions 
7*27b03b36SApple OSS Distributions char tempdir[MAXPATHLEN];
8*27b03b36SApple OSS Distributions 
9*27b03b36SApple OSS Distributions DECL_SETUP {
10*27b03b36SApple OSS Distributions 	char* retval;
11*27b03b36SApple OSS Distributions 
12*27b03b36SApple OSS Distributions 	retval = setup_tempdir(tempdir);
13*27b03b36SApple OSS Distributions 
14*27b03b36SApple OSS Distributions 	VERIFY(retval, "tempdir setup failed");
15*27b03b36SApple OSS Distributions 
16*27b03b36SApple OSS Distributions 	printf("tempdir: %s\n", tempdir);
17*27b03b36SApple OSS Distributions 
18*27b03b36SApple OSS Distributions 	return test_file_read_setup(tempdir, num_threads, length, 0L);
19*27b03b36SApple OSS Distributions }
20*27b03b36SApple OSS Distributions 
21*27b03b36SApple OSS Distributions DECL_TEST {
22*27b03b36SApple OSS Distributions 	return test_file_read(tempdir, thread_id, num_threads, length, 0L);
23*27b03b36SApple OSS Distributions }
24*27b03b36SApple OSS Distributions 
25*27b03b36SApple OSS Distributions DECL_CLEANUP {
26*27b03b36SApple OSS Distributions 	int retval;
27*27b03b36SApple OSS Distributions 
28*27b03b36SApple OSS Distributions 	retval = test_file_read_cleanup(tempdir, num_threads, length);
29*27b03b36SApple OSS Distributions 	VERIFY(retval == PERFINDEX_SUCCESS, "test_file_read_cleanup failed");
30*27b03b36SApple OSS Distributions 
31*27b03b36SApple OSS Distributions 	retval = cleanup_tempdir(tempdir);
32*27b03b36SApple OSS Distributions 	VERIFY(retval == 0, "cleanup_tempdir failed");
33*27b03b36SApple OSS Distributions 
34*27b03b36SApple OSS Distributions 	return PERFINDEX_SUCCESS;
35*27b03b36SApple OSS Distributions }
36