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

Function main

tests/test_main.c:1939–2464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1937const char *cbm_test_program_path;
1938
1939int main(int argc, char **argv) {
1940 cbm_test_program_path = tf_runner_image(argc, argv);
1941 if (argc >= 4 && argc % 2 == 0 && strcmp(argv[1], "__cbm_env_values") == 0) {
1942 for (int i = 2; i < argc; i += 2) {
1943 const char *value = getenv(argv[i]);
1944 if (!value || strcmp(value, argv[i + 1]) != 0) {
1945 return 61;
1946 }
1947 }
1948 return 0;
1949 }
1950 if (argc >= 5 && strcmp(argv[1], "__cbm_env_isolation") == 0) {
1951 const char *value = getenv(argv[2]);
1952 if (!value || strcmp(value, argv[3]) != 0) {
1953 return 61;
1954 }
1955 for (int i = 4; i < argc; i++) {
1956 if (getenv(argv[i])) {
1957 return 62;
1958 }
1959 }
1960 return 0;
1961 }
1962 /* #2003: never let a caller's GIT_DIR/GIT_INDEX_FILE/... redirect fixture
1963 * git commands at the caller's real repository. */
1964 th_clear_git_repo_env();
1965 tf_test_impact_runner_filter_set_binary(tf_runner_image(argc, argv));
1966#ifdef CBM_TEST_COVERAGE
1967 tf_coverage_process_init();
1968#ifndef _WIN32
1969 int coverage_child_rc = tf_coverage_children_dispatch(argc, argv);
1970 if (coverage_child_rc >= 0) {
1971 return coverage_child_rc;
1972 }
1973#endif
1974#endif
1975 int stdout_probe_rc = tf_maybe_run_subprocess_stdout_probe(argc, argv);
1976 if (stdout_probe_rc >= 0) {
1977 return stdout_probe_rc;
1978 }
1979 int git_facts_probe_rc = tf_maybe_run_git_facts_diff_probe(argc, argv);
1980 if (git_facts_probe_rc >= 0) {
1981 return git_facts_probe_rc;
1982 }
1983 int memory_limit_probe_rc = tf_maybe_run_windows_memory_limit_probe(argc, argv);
1984 if (memory_limit_probe_rc >= 0) {
1985 return memory_limit_probe_rc;
1986 }
1987 int blocking_git_rc = tf_maybe_run_blocking_git_probe(argc, argv);
1988 if (blocking_git_rc >= 0) {
1989 return blocking_git_rc;
1990 }
1991 /* Installation tests use this executable as a structurally real candidate.
1992 * Mirror the production binary's minimal verification contract. */
1993 if (argc == 2 && strcmp(argv[1], "--version") == 0) {
1994 (void)puts("codebase-memory-mcp test-runner");
1995 return 0;
1996 }

Callers

nothing calls this directly

Tested by

no test coverage detected