# Makefile for MCP Protocol Core Test Suite # Guile executable GUILE ?= guile GUILD ?= guild # Test directories and files TEST_DIR = tests SERVER_DIR = server TEST_FILES = $(wildcard $(TEST_DIR)/*.scm) SERVER_FILES = $(wildcard $(SERVER_DIR)/*.scm) # Guile load path GUILE_LOAD_PATH := $(CURDIR):$(GUILE_LOAD_PATH) export GUILE_LOAD_PATH # Default target .PHONY: all all: test # Run all tests .PHONY: test test: check-dependencies @echo "๐Ÿงช Running MCP Protocol Core Test Suite" @echo "=======================================" $(GUILE) -L . $(TEST_DIR)/run-tests.scm # Run only unit tests .PHONY: test-unit test-unit: check-dependencies @echo "๐Ÿ“‹ Running Unit Tests Only" $(GUILE) -L . $(TEST_DIR)/run-tests.scm unit # Run only integration tests .PHONY: test-integration test-integration: check-dependencies @echo "๐Ÿ”— Running Integration Tests Only" $(GUILE) -L . $(TEST_DIR)/run-tests.scm integration # Run only compliance tests .PHONY: test-compliance test-compliance: check-dependencies @echo "๐Ÿ“œ Running Protocol Compliance Tests Only" $(GUILE) -L . $(TEST_DIR)/run-tests.scm compliance # Check syntax of all Scheme files .PHONY: check-syntax check-syntax: @echo "๐Ÿ” Checking Syntax..." @for file in $(SERVER_FILES) $(TEST_FILES); do \ echo " Checking $$file..."; \ $(GUILD) compile -W all -x $$file > /dev/null || exit 1; \ done @echo "โœ… Syntax check passed!" # Check dependencies .PHONY: check-dependencies check-dependencies: @echo "๐Ÿ”ง Checking Dependencies..." @$(GUILE) -c "(use-modules (srfi srfi-64))" 2>/dev/null || \ (echo "โŒ SRFI-64 testing framework not available"; exit 1) @$(GUILE) -c "(use-modules (json))" 2>/dev/null || \ (echo "โŒ JSON module not available"; exit 1) @echo "โœ… Dependencies check passed!" # Run tests with coverage (if gcov available) .PHONY: test-coverage test-coverage: check-dependencies @echo "๐Ÿ“Š Running Tests with Coverage..." # Note: Coverage reporting for Guile would require additional setup $(MAKE) test # Clean compiled files .PHONY: clean clean: @echo "๐Ÿงน Cleaning compiled files..." find . -name "*.go" -delete find . -name "*.x" -delete @echo "โœ… Clean complete!" # Continuous testing (watch mode) .PHONY: test-watch test-watch: @echo "๐Ÿ‘€ Watching for changes..." @while true; do \ $(MAKE) test; \ echo ""; \ echo "Waiting for changes... (Ctrl+C to stop)"; \ sleep 2; \ done # Generate test report .PHONY: test-report test-report: check-dependencies @echo "๐Ÿ“„ Generating Test Report..." $(GUILE) -L . $(TEST_DIR)/run-tests.scm > test-report.txt 2>&1 @echo "๐Ÿ“„ Test report saved to test-report.txt" # Benchmark tests .PHONY: benchmark benchmark: check-dependencies @echo "โฑ๏ธ Running Performance Benchmarks..." # Placeholder for benchmark implementation @echo "โš ๏ธ Benchmarks not yet implemented" # Help target .PHONY: help help: @echo "๐Ÿงช MCP Protocol Core Test Suite" @echo "===============================" @echo "" @echo "Available targets:" @echo " test - Run all tests (default)" @echo " test-unit - Run only unit tests" @echo " test-integration - Run only integration tests" @echo " test-compliance - Run only protocol compliance tests" @echo " check-syntax - Check syntax of all Scheme files" @echo " check-dependencies - Check if required dependencies are available" @echo " test-coverage - Run tests with coverage reporting" @echo " test-watch - Continuously run tests on file changes" @echo " test-report - Generate detailed test report" @echo " benchmark - Run performance benchmarks" @echo " clean - Clean compiled files" @echo " help - Show this help message" @echo "" @echo "Environment variables:" @echo " GUILE - Guile executable (default: guile)" @echo " GUILD - Guild executable (default: guild)" # Show current test status .PHONY: status status: @echo "๐Ÿ“Š Test Suite Status" @echo "===================" @echo "Test files: $(words $(TEST_FILES))" @echo "Server modules: $(words $(SERVER_FILES))" @echo "Guile version: $$($(GUILE) --version | head -1)" @echo "Load path: $(GUILE_LOAD_PATH)"