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

Function main

tests/test_main.c:818–1148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Tested by

no test coverage detected