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