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