]>
Commit | Line | Data |
---|---|---|
fe8ab488 A |
1 | #include "perf_index.h" |
2 | #include "fail.h" | |
3 | #include <stdio.h> | |
4 | #include <stdlib.h> | |
5 | ||
6 | static const char *src_dst = "/tmp/perf_index_compile_code"; | |
7 | static const char *src_root = "/Network/Servers/xs1/release/Software/Zin/Projects/xnu/xnu-2050.7.9"; | |
8 | ||
9 | DECL_SETUP { | |
10 | char* cmd; | |
11 | int retval; | |
12 | const char *src = src_root; | |
13 | if(test_argc >= 1) | |
14 | src = (char*)test_argv[0]; | |
15 | ||
16 | retval = asprintf(&cmd, "ditto \"%s\" \"%s\"", src, src_dst); | |
17 | VERIFY(retval > 0, "asprintf failed"); | |
18 | ||
19 | retval = system(cmd); | |
20 | VERIFY(retval == 0, "ditto command failed"); | |
21 | ||
22 | free(cmd); | |
23 | ||
24 | return PERFINDEX_SUCCESS; | |
25 | } | |
26 | ||
27 | DECL_TEST { | |
28 | char* cmd; | |
29 | int retval; | |
30 | ||
31 | if(thread_id != 0) | |
32 | return 0; | |
33 | ||
34 | retval = asprintf(&cmd, "make -C \"%s\" MAKEJOBS=-j%d", src_dst, num_threads); | |
35 | VERIFY(retval > 0, "asprintf failed"); | |
36 | ||
37 | retval = system(cmd); | |
38 | VERIFY(retval == 0, "make command failed"); | |
39 | ||
40 | return PERFINDEX_SUCCESS; | |
41 | } | |
42 | ||
43 | DECL_CLEANUP { | |
44 | char* cmd; | |
45 | int retval; | |
46 | ||
47 | retval = asprintf(&cmd, "rm -rf \"%s\"", src_dst); | |
48 | VERIFY(retval > 0, "asprintf failed"); | |
49 | ||
50 | retval = system(cmd); | |
51 | VERIFY(retval == 0, "rm command failed"); | |
52 | ||
53 | return PERFINDEX_SUCCESS; | |
54 | } |