]> git.saurik.com Git - apple/xnu.git/blame_incremental - tools/tests/perf_index/perfindex-compile.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / tools / tests / perf_index / perfindex-compile.c
... / ...
CommitLineData
1#include "perf_index.h"
2#include "fail.h"
3#include <stdio.h>
4#include <stdlib.h>
5
6static const char *src_dst = "/tmp/perf_index_compile_code";
7static const char *src_root = "/Network/Servers/xs1/release/Software/Zin/Projects/xnu/xnu-2050.7.9";
8
9DECL_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
27DECL_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
43DECL_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}