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

Function main

tests/test_main.c:744–1074  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742extern void cbm_kind_in_set_free_cache(void);
743
744int main(int argc, char **argv) {
745 /* Skip the multi-hundred-MB executable-image hash that computes the exact
746 * build fingerprint: it is tens of seconds per spawned worker/daemon under
747 * ASan on constrained CI runners and the sole cause of the daemon-family
748 * readiness-timeout flakes. Set once here; every forked child and re-exec'd
749 * worker inherits it, so exact-build match/mismatch still works (a
750 * mismatch test still passes a DIFFERENT fingerprint via argv). Honoured
751 * only under CBM_CLI_ENABLE_TEST_API — never in a production binary. */
752 if (!getenv("CBM_TEST_BUILD_FINGERPRINT")) {
753 (void)cbm_setenv("CBM_TEST_BUILD_FINGERPRINT",
754 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", 1);
755 }
756 int blocking_git_rc = tf_maybe_run_blocking_git_probe(argc, argv);
757 if (blocking_git_rc >= 0) {
758 return blocking_git_rc;
759 }
760 /* Installation tests use this executable as a structurally real candidate.
761 * Mirror the production binary's minimal verification contract. */
762 if (argc == 2 && strcmp(argv[1], "--version") == 0) {
763 (void)puts("codebase-memory-mcp test-runner");
764 return 0;
765 }
766 int mcp_idxfailclosed_rc = tf_maybe_run_mcp_idxfailclosed_probe(argc, argv);
767 if (mcp_idxfailclosed_rc >= 0) {
768 return mcp_idxfailclosed_rc;
769 }
770 int runtime_image_rc = tf_maybe_run_runtime_image_holder(argc, argv);
771 if (runtime_image_rc >= 0) {
772 return runtime_image_rc;
773 }
774 int runtime_hello_rc = tf_maybe_run_runtime_hello_client(argc, argv);
775 if (runtime_hello_rc >= 0) {
776 return runtime_hello_rc;
777 }
778 int runtime_activation_rc = tf_maybe_run_runtime_activation_client(argc, argv);
779 if (runtime_activation_rc >= 0) {
780 return runtime_activation_rc;
781 }
782 int runtime_mapped_hello_rc = tf_maybe_run_runtime_mapped_hello_client(argc, argv);
783 if (runtime_mapped_hello_rc >= 0) {
784 return runtime_mapped_hello_rc;
785 }
786 int cohort_crash_rc = tf_maybe_run_version_cohort_crash_holder(argc, argv);
787 if (cohort_crash_rc >= 0) {
788 return cohort_crash_rc;
789 }
790 int daemon_ipc_probe_rc = tf_maybe_run_daemon_ipc_lock_probe(argc, argv);
791 if (daemon_ipc_probe_rc >= 0) {
792 return daemon_ipc_probe_rc;
793 }
794
795 /* #798 follow-up: if spawned as the socket-isolation probe, report whether an
796 * inheritable socket handle crossed into this child and exit before any suite. */
797 int probe_rc = tf_maybe_run_socket_probe(argc, argv);
798 if (probe_rc >= 0) {
799 return probe_rc;
800 }
801

Callers

nothing calls this directly

Tested by

no test coverage detected