MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / setup_parallel_repo

Function setup_parallel_repo

tests/test_parallel.c:51–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51static int setup_parallel_repo(void) {
52 snprintf(g_par_tmpdir, sizeof(g_par_tmpdir), "/tmp/cbm_par_XXXXXX");
53 if (!cbm_mkdtemp(g_par_tmpdir))
54 return -1;
55
56 char path[512];
57
58 /* main.go */
59 snprintf(path, sizeof(path), "%s/main.go", g_par_tmpdir);
60 FILE *f = fopen(path, "w");
61 if (!f)
62 return -1;
63 fprintf(f, "package main\n\nimport \"pkg\"\n\n"
64 "func main() {\n\tpkg.Serve()\n}\n");
65 fclose(f);
66
67 /* pkg/ */
68 snprintf(path, sizeof(path), "%s/pkg", g_par_tmpdir);
69 cbm_mkdir(path);
70
71 /* pkg/service.go */
72 snprintf(path, sizeof(path), "%s/pkg/service.go", g_par_tmpdir);
73 f = fopen(path, "w");
74 if (!f)
75 return -1;
76 fprintf(f, "package pkg\n\nimport \"pkg/util\"\n\n"
77 "func Serve() {\n\tutil.Help()\n}\n");
78 fclose(f);
79
80 /* pkg/util/ */
81 snprintf(path, sizeof(path), "%s/pkg/util", g_par_tmpdir);
82 cbm_mkdir(path);
83
84 /* pkg/util/helper.go */
85 snprintf(path, sizeof(path), "%s/pkg/util/helper.go", g_par_tmpdir);
86 f = fopen(path, "w");
87 if (!f)
88 return -1;
89 fprintf(f, "package util\n\nfunc Help() {}\n");
90 fclose(f);
91
92 /* Java interface/implements/extends trio: the parallel resolve path must
93 * make the same Interface-label edge split (IMPLEMENTS vs INHERITS) as
94 * the sequential semantic pass, and both must emit OVERRIDE for methods
95 * redefined from an explicit base. Without these files the IMPLEMENTS/
96 * INHERITS parity tests compare 0 == 0 and guard nothing (the demotion
97 * bug shipped: elasticsearch had 11k implements-as-INHERITS edges). */
98 snprintf(path, sizeof(path), "%s/probe", g_par_tmpdir);
99 cbm_mkdir(path);
100 snprintf(path, sizeof(path), "%s/probe/Shape.java", g_par_tmpdir);
101 f = fopen(path, "w");
102 if (!f)
103 return -1;
104 fprintf(f, "package probe;\npublic interface Shape {\n double area();\n}\n");
105 fclose(f);
106 snprintf(path, sizeof(path), "%s/probe/Circle.java", g_par_tmpdir);
107 f = fopen(path, "w");
108 if (!f)

Callers 1

ensure_parity_setupFunction · 0.85

Calls 1

cbm_mkdtempFunction · 0.85

Tested by

no test coverage detected