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

Function main

tests/test_main.c:819–1150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

817extern void cbm_kind_in_set_free_cache(void);
818
819int main(int argc, char **argv) {
820 /* Skip the multi-hundred-MB executable-image hash that computes the exact
821 * build fingerprint: it is tens of seconds per spawned worker/daemon under
822 * ASan on constrained CI runners and the sole cause of the daemon-family
823 * readiness-timeout flakes. Set once here; every forked child and re-exec'd
824 * worker inherits it, so exact-build match/mismatch still works (a
825 * mismatch test still passes a DIFFERENT fingerprint via argv). Honoured
826 * only under CBM_CLI_ENABLE_TEST_API — never in a production binary. */
827 if (!getenv("CBM_TEST_BUILD_FINGERPRINT")) {
828 (void)cbm_setenv("CBM_TEST_BUILD_FINGERPRINT",
829 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", 1);
830 }
831 int blocking_git_rc = tf_maybe_run_blocking_git_probe(argc, argv);
832 if (blocking_git_rc >= 0) {
833 return blocking_git_rc;
834 }
835 /* Installation tests use this executable as a structurally real candidate.
836 * Mirror the production binary's minimal verification contract. */
837 if (argc == 2 && strcmp(argv[1], "--version") == 0) {
838 (void)puts("codebase-memory-mcp test-runner");
839 return 0;
840 }
841 int mcp_idxfailclosed_rc = tf_maybe_run_mcp_idxfailclosed_probe(argc, argv);
842 if (mcp_idxfailclosed_rc >= 0) {
843 return mcp_idxfailclosed_rc;
844 }
845 int runtime_image_rc = tf_maybe_run_runtime_image_holder(argc, argv);
846 if (runtime_image_rc >= 0) {
847 return runtime_image_rc;
848 }
849 int runtime_hello_rc = tf_maybe_run_runtime_hello_client(argc, argv);
850 if (runtime_hello_rc >= 0) {
851 return runtime_hello_rc;
852 }
853 int runtime_activation_rc = tf_maybe_run_runtime_activation_client(argc, argv);
854 if (runtime_activation_rc >= 0) {
855 return runtime_activation_rc;
856 }
857 int runtime_mapped_hello_rc = tf_maybe_run_runtime_mapped_hello_client(argc, argv);
858 if (runtime_mapped_hello_rc >= 0) {
859 return runtime_mapped_hello_rc;
860 }
861 int cohort_crash_rc = tf_maybe_run_version_cohort_crash_holder(argc, argv);
862 if (cohort_crash_rc >= 0) {
863 return cohort_crash_rc;
864 }
865 int daemon_ipc_probe_rc = tf_maybe_run_daemon_ipc_lock_probe(argc, argv);
866 if (daemon_ipc_probe_rc >= 0) {
867 return daemon_ipc_probe_rc;
868 }
869
870 /* #798 follow-up: if spawned as the socket-isolation probe, report whether an
871 * inheritable socket handle crossed into this child and exit before any suite. */
872 int probe_rc = tf_maybe_run_socket_probe(argc, argv);
873 if (probe_rc >= 0) {
874 return probe_rc;
875 }
876

Callers

nothing calls this directly

Tested by

no test coverage detected