mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
test: fixture lifetimes the Linux and Windows legs exposed
js_fixture returned its arena by value while the index kept a pointer to it, which only worked where the copy was elided. The parallel harness never freed the Rust project and ECMAScript surfaces. Templates sized exactly to their text overflow on Windows, where cbm_mkdtemp rewrites /tmp/ to the longer temp root in place. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
1 parent
e821b3e084
commit
f6556b7b05
4 files changed
+23
-11
No files matched your search
@@ -13,6 +13,8 @@
|
||||
#include "pipeline/pipeline_internal.h"
|
||||
#include "pipeline/pass_lsp_cross.h"
|
||||
#include "pipeline/shared_resolver.h"
|
||||
#include "pipeline/resolver_ecma.h"
|
||||
#include "resolve/rust_names.h"
|
||||
#include "pipeline/lsp_resolve.h"
|
||||
#include "lsp/oo_strict.h"
|
||||
#include "pipeline/worker_pool.h"
|
||||
@@ -200,6 +202,10 @@ static void harness_ctx_free_tables(cbm_pipeline_ctx_t *ctx) {
|
||||
free((void *)ctx->return_type_table);
|
||||
ctx->return_type_table = NULL;
|
||||
}
|
||||
cbm_ecma_surfaces_free(ctx->ecma_surfaces);
|
||||
ctx->ecma_surfaces = NULL;
|
||||
cbm_rust_project_free(ctx->rust_project);
|
||||
ctx->rust_project = NULL;
|
||||
}
|
||||
|
||||
/* Mirror production occurrence capture while the extraction cache, cross
|
||||
|
||||
@@ -24175,7 +24175,7 @@ TEST(pipeline_python_explicit_package_reexports_keep_identity) {
|
||||
.label = "Class",
|
||||
.declaration_line = 3,
|
||||
.declaration_text = "class Doc:"}}};
|
||||
char tmp[] = "/tmp/cbm_py_explicit_reexport_XXXXXX";
|
||||
char tmp[512] = "/tmp/cbm_py_explicit_reexport_XXXXXX";
|
||||
ASSERT_NOT_NULL(cbm_mkdtemp(tmp));
|
||||
for (size_t i = 0; i < sizeof(sources) / sizeof(sources[0]); i++)
|
||||
write_temp_file(tmp, sources[i].path, sources[i].text);
|
||||
@@ -24258,7 +24258,7 @@ TEST(pipeline_python_dunder_file_reexports_keep_symbol_identity) {
|
||||
.label = "Function",
|
||||
.declaration_line = 1,
|
||||
.declaration_text = "def __file__():"}}};
|
||||
char tmp[] = "/tmp/cbm_py_dunder_file_XXXXXX";
|
||||
char tmp[512] = "/tmp/cbm_py_dunder_file_XXXXXX";
|
||||
ASSERT_NOT_NULL(cbm_mkdtemp(tmp));
|
||||
for (size_t i = 0; i < sizeof(sources) / sizeof(sources[0]); i++)
|
||||
write_temp_file(tmp, sources[i].path, sources[i].text);
|
||||
@@ -24301,7 +24301,7 @@ TEST(pipeline_python_from_import_dependency_is_not_a_local_binding) {
|
||||
};
|
||||
bool ok = true;
|
||||
for (size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
|
||||
char tmp[] = "/tmp/cbm_python_dependency_XXXXXX";
|
||||
char tmp[512] = "/tmp/cbm_python_dependency_XXXXXX";
|
||||
ASSERT_NOT_NULL(cbm_mkdtemp(tmp));
|
||||
write_temp_file(tmp, "pkg/__init__.py", cases[i].parent);
|
||||
if (cases[i].child)
|
||||
@@ -24390,7 +24390,7 @@ static void python_submodule_diagnostic(cbm_store_t *store, const char *project)
|
||||
|
||||
static int python_submodule_case_run(const python_submodule_case *fixture, bool *quality,
|
||||
RQ_Report *report) {
|
||||
char tmp[] = "/tmp/cbm_python_submodule_XXXXXX";
|
||||
char tmp[512] = "/tmp/cbm_python_submodule_XXXXXX";
|
||||
*quality = false;
|
||||
if (!cbm_mkdtemp(tmp))
|
||||
return -1;
|
||||
@@ -27073,7 +27073,7 @@ TEST(pipeline_python_nested_class_methods_resolve_parallel) {
|
||||
}
|
||||
|
||||
TEST(pipeline_python_default_callable_references_have_execution_owner) {
|
||||
char tmp[] = "/tmp/cbm_py_default_owner_XXXXXX";
|
||||
char tmp[512] = "/tmp/cbm_py_default_owner_XXXXXX";
|
||||
ASSERT_NOT_NULL(cbm_mkdtemp(tmp));
|
||||
write_temp_file(tmp, "app.py",
|
||||
"def target():\n"
|
||||
|
||||
@@ -585,9 +585,10 @@ TEST(resolver_binding_js_const_export_requires_unique_materialized_value) {
|
||||
* Kilo-Org/kilocode, with a decoy beside it that must keep abstaining.
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/* The fixture is returned by value and the index keeps its arena, so the arena must not move. */
|
||||
typedef struct {
|
||||
CBMFileResult *result;
|
||||
CBMArena arena;
|
||||
CBMArena *arena;
|
||||
cbm_resolve_binding_index_t *index;
|
||||
} js_fixture_t;
|
||||
|
||||
@@ -596,15 +597,20 @@ static js_fixture_t js_fixture(const char *source, CBMLanguage language, const c
|
||||
js_fixture_t fixture = {0};
|
||||
fixture.result =
|
||||
cbm_extract_file(source, (int)strlen(source), language, "test", file, 0, NULL, NULL);
|
||||
cbm_arena_init(&fixture.arena);
|
||||
fixture.arena = malloc(sizeof(*fixture.arena));
|
||||
if (!fixture.arena)
|
||||
return fixture;
|
||||
cbm_arena_init(fixture.arena);
|
||||
if (fixture.result)
|
||||
fixture.index = cbm_resolve_binding_build_declared_module(
|
||||
&fixture.arena, fixture.result, language, source, strlen(source), declared_module);
|
||||
fixture.arena, fixture.result, language, source, strlen(source), declared_module);
|
||||
return fixture;
|
||||
}
|
||||
|
||||
static void js_fixture_free(js_fixture_t *fixture) {
|
||||
cbm_arena_destroy(&fixture->arena);
|
||||
if (fixture->arena)
|
||||
cbm_arena_destroy(fixture->arena);
|
||||
free(fixture->arena);
|
||||
cbm_free_result(fixture->result);
|
||||
}
|
||||
|
||||
@@ -618,7 +624,7 @@ static bool js_binds_at(js_fixture_t *fixture, const char *source, const char *c
|
||||
uint32_t start = (uint32_t)(site - source);
|
||||
cbm_resolve_result_t resolved = cbm_resolve_binding_validate(
|
||||
fixture->index, name, start, start + (uint32_t)strlen(spelling), CBM_SOURCE_ORIGIN_RAW,
|
||||
js_local(&fixture->arena, fixture->result, name));
|
||||
js_local(fixture->arena, fixture->result, name));
|
||||
return cbm_resolve_admit(&resolved);
|
||||
}
|
||||
|
||||
|
||||
@@ -1228,7 +1228,7 @@ TEST(resolver_generation_publish_keeps_the_wal_small) {
|
||||
rows[i].start_byte = (uint32_t)i;
|
||||
rows[i].end_byte = (uint32_t)i + 1;
|
||||
}
|
||||
char dir[] = "/tmp/cbm_generation_wal_XXXXXX";
|
||||
char dir[512] = "/tmp/cbm_generation_wal_XXXXXX";
|
||||
ASSERT_NOT_NULL(cbm_mkdtemp(dir));
|
||||
char db_path[256], wal_path[256];
|
||||
snprintf(db_path, sizeof(db_path), "%s/stage.db", dir);
|
||||
|
||||
Reference in new issue
Block a user