]>
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 { | |
0a7de745 A |
10 | char* cmd; |
11 | int retval; | |
12 | const char *src = src_root; | |
13 | if (test_argc >= 1) { | |
14 | src = (char*)test_argv[0]; | |
15 | } | |
fe8ab488 | 16 | |
0a7de745 A |
17 | retval = asprintf(&cmd, "ditto \"%s\" \"%s\"", src, src_dst); |
18 | VERIFY(retval > 0, "asprintf failed"); | |
fe8ab488 | 19 | |
0a7de745 A |
20 | retval = system(cmd); |
21 | VERIFY(retval == 0, "ditto command failed"); | |
fe8ab488 | 22 | |
0a7de745 | 23 | free(cmd); |
fe8ab488 | 24 | |
0a7de745 | 25 | return PERFINDEX_SUCCESS; |
fe8ab488 A |
26 | } |
27 | ||
28 | DECL_TEST { | |
0a7de745 A |
29 | char* cmd; |
30 | int retval; | |
fe8ab488 | 31 | |
0a7de745 A |
32 | if (thread_id != 0) { |
33 | return 0; | |
34 | } | |
fe8ab488 | 35 | |
0a7de745 A |
36 | retval = asprintf(&cmd, "make -C \"%s\" MAKEJOBS=-j%d", src_dst, num_threads); |
37 | VERIFY(retval > 0, "asprintf failed"); | |
fe8ab488 | 38 | |
0a7de745 A |
39 | retval = system(cmd); |
40 | VERIFY(retval == 0, "make command failed"); | |
fe8ab488 | 41 | |
0a7de745 | 42 | return PERFINDEX_SUCCESS; |
fe8ab488 A |
43 | } |
44 | ||
45 | DECL_CLEANUP { | |
0a7de745 A |
46 | char* cmd; |
47 | int retval; | |
fe8ab488 | 48 | |
0a7de745 A |
49 | retval = asprintf(&cmd, "rm -rf \"%s\"", src_dst); |
50 | VERIFY(retval > 0, "asprintf failed"); | |
fe8ab488 | 51 | |
0a7de745 A |
52 | retval = system(cmd); |
53 | VERIFY(retval == 0, "rm command failed"); | |
fe8ab488 | 54 | |
0a7de745 | 55 | return PERFINDEX_SUCCESS; |
fe8ab488 | 56 | } |