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

Function main

tests/windows/test_non_ascii_path.py:428–557  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

426
427
428def main():
429 if len(sys.argv) < 2:
430 print("usage: python test_non_ascii_path.py <binary>")
431 return 2
432 binary = os.path.abspath(sys.argv[1])
433 if not os.path.exists(binary):
434 print("FAIL: binary not found: %s" % binary)
435 return 2
436
437 work = tempfile.mkdtemp(prefix="cbm_win_nonascii_")
438 failures = []
439 runtime_error = None
440 try:
441 runtime_error = verify_relocated_runtime(binary, work)
442 if runtime_error:
443 print("[FAIL] non-ASCII runtime relocation: %s" % runtime_error)
444 print("\nREGRESSION (red): Unicode/extended-length runtime publication "
445 "or exact adjacent-asset resolution failed.")
446 return 1
447 print("[PASS] Unicode relocation + extended-length install/probe/uninstall")
448
449 ascii_repo = os.path.join(work, "ascii_repo")
450 make_fixture(ascii_repo)
451 # The baseline is setup, not the surface under test: a cold runner can
452 # lose the first index to daemon startup latency (#1952). One retry
453 # against a fresh cache separates that environmental window from a
454 # real indexing failure before the guard declares a precondition skip.
455 base = {}
456 for attempt in ("c_ascii", "c_ascii_retry"):
457 base = index_and_count(binary, ascii_repo, os.path.join(work, attempt))
458 if not base.get("error") and base.get("nodes"):
459 break
460 print("SETUP: ASCII baseline attempt %r did not index: %r"
461 % (attempt, base))
462 if base.get("error") or not base.get("nodes"):
463 print("SETUP FAIL: ASCII baseline did not index: %r" % base)
464 return 2
465 print("baseline (ASCII): nodes=%s edges=%s definitions=%s go=%s" %
466 (base["nodes"], base["edges"], base["definition_nodes"],
467 base["go_definition_nodes"]))
468 if base["definition_nodes"] < 1:
469 print("SETUP FAIL: ASCII baseline produced no definitions: %r" % base)
470 return 2
471 if base["go_definition_nodes"] < 1:
472 print("SETUP FAIL: ASCII baseline extracted no Go definitions: %r"
473 % base)
474 return 2
475
476 for key, seg in NON_ASCII_SEGMENTS.items():
477 repo = os.path.join(work, seg)
478 make_fixture(repo)
479 got = index_and_count(binary, repo, os.path.join(work, "c_" + key))
480 ok = (not got.get("error")
481 and got.get("nodes") == base["nodes"]
482 and got.get("edges") == base["edges"]
483 and got.get("definition_nodes") == base["definition_nodes"]
484 and got.get("go_definition_nodes") == base["go_definition_nodes"])
485 status = "PASS" if ok else "FAIL"

Callers 1

Calls 7

verify_relocated_runtimeFunction · 0.85
index_and_countFunction · 0.85
make_fixtureFunction · 0.70
getMethod · 0.65
openFunction · 0.50
runMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected