[PATCH 20/23] mcp-server: Add Makefile for running tests

John Kacur <[email protected]>
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Add a local Makefile in the mcp-server directory to simplify running
tests. This keeps the MCP server tests isolated since the MCP server
may be an optional package that not all users will have installed.

The Makefile provides:
- make test: Run all tests
- make test-new-tools: Query/filter tools tests
- make test-integration: MCP integration tests
- make test-histogram: Histogram extraction tests
- make test-per-cpu: Per-CPU statistics tests
- make help: Show available targets
- make clean: Clean Python cache files

Updated README.md to document the Makefile-based test workflow,
replacing the outdated reference to test_tools.py which no longer
exists.

The Makefile can be invoked from the mcp-server directory or from
the project root using: make -C mcp-server test

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <[email protected]>
---
 mcp-server/Makefile  | 51 ++++++++++++++++++++++++++++++++++++++++++++
 mcp-server/README.md | 21 ++++++++++++++++--
 2 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 mcp-server/Makefile

diff --git a/mcp-server/Makefile b/mcp-server/Makefile
new file mode 100644
index 000000000000..7f06dc85b9fc
--- /dev/null
+++ b/mcp-server/Makefile
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Makefile for rteval MCP Server tests
+#
+# Copyright 2026 John Kacur <[email protected]>
+
+PYTHON := python3
+TEST_DIR := tests
+
+.PHONY: all help test test-new-tools test-integration test-histogram test-per-cpu clean
+
+all: test
+
+help:
+	@echo "rteval MCP Server - Test targets:"
+	@echo ""
+	@echo "  make                   - Run all tests (default)"
+	@echo "  make test              - Run all tests"
+	@echo "  make test-new-tools    - Run query/filter tools tests"
+	@echo "  make test-integration  - Run MCP integration tests"
+	@echo "  make test-histogram    - Run histogram extraction tests"
+	@echo "  make test-per-cpu      - Run per-CPU statistics tests"
+	@echo "  make clean             - Clean Python cache files"
+	@echo ""
+
+test: test-new-tools test-integration test-histogram test-per-cpu
+	@echo ""
+	@echo "All tests completed successfully"
+
+test-new-tools:
+	@echo "Running query/filter tools tests..."
+	@cd $(TEST_DIR) && $(PYTHON) test_new_tools.py
+
+test-integration:
+	@echo "Running MCP integration tests..."
+	@cd $(TEST_DIR) && $(PYTHON) test_mcp_integration.py
+
+test-histogram:
+	@echo "Running histogram extraction tests..."
+	@cd $(TEST_DIR) && $(PYTHON) test_histogram.py
+
+test-per-cpu:
+	@echo "Running per-CPU statistics tests..."
+	@cd $(TEST_DIR) && $(PYTHON) test_per_cpu_stats.py
+
+clean:
+	@echo "Cleaning Python cache files..."
+	@find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
+	@find . -type f -name '*.pyc' -delete
+	@find . -type f -name '*.pyo' -delete
+	@echo "Clean completed"
diff --git a/mcp-server/README.md b/mcp-server/README.md
index 6d6a9eb257dd..370aa0e9ca71 100644
--- a/mcp-server/README.md
+++ b/mcp-server/README.md
@@ -69,10 +69,27 @@ sudo dnf install python3-mcp python3-mcp+cli python3-lxml
 
 ## Usage
 
-### Testing the Server Directly
+### Testing the Server
+
+The MCP server includes a test suite to verify functionality:
 
 ```bash
-python3 test_tools.py
+cd mcp-server
+
+# Run all tests
+make test
+
+# Run individual test suites
+make test-new-tools      # Query/filter tools
+make test-integration    # MCP integration tests
+make test-histogram      # Histogram extraction
+make test-per-cpu        # Per-CPU statistics
+
+# Show available targets
+make help
+
+# Clean Python cache files
+make clean
 ```
 
 ### Using with Claude Code
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.