1#include <fcntl.h>
2#include "perf_index.h"
3#include <errno.h>
4
5static const char *src_dst = "/tmp/perf_index_compile_code";
6static const char *src_root = "/Network/Servers/xs1/release/Software/Zin/Projects/xnu/xnu-2050.7.9";
7
8const stress_test_t compile_test = {"compile", &compile_init, &compile, &compile_cleanup, &no_validate};
9
10DECL_INIT(compile_init) {
11  char *cmd;
12  const char *src = src_root;
13  if(test_argc >= 1)
14    src = test_argv[0];
15  assert(asprintf(&cmd, "ditto \"%s\" \"%s\"", src, src_dst) >= 0);
16  assert(system(cmd) == 0);
17  free(cmd);
18}
19
20DECL_CLEANUP(compile_cleanup) {
21  char *cmd;
22  assert(asprintf(&cmd, "rm -rf \"%s\"", src_dst) >= 0);
23  assert(system(cmd) == 0);
24  free(cmd);
25}
26
27DECL_TEST(compile) {
28  char *cmd;
29  if(thread_id == 0) {
30    assert(asprintf(&cmd, "make -C \"%s\" MAKEJOBS=-j%d", src_dst, num_threads) >= 0);
31    assert(system(cmd) == 0);
32    free(cmd);
33  }
34}
35