summaryrefslogtreecommitdiff
path: root/tests/smoke.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tests/smoke.cmake')
-rw-r--r--tests/smoke.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/smoke.cmake b/tests/smoke.cmake
new file mode 100644
index 0000000..b741d4b
--- /dev/null
+++ b/tests/smoke.cmake
@@ -0,0 +1,39 @@
+if(NOT DEFINED SERVER OR NOT EXISTS "${SERVER}")
+ message(FATAL_ERROR "SERVER does not name a built tiny-convmem-mcp executable")
+endif()
+if(NOT DEFINED INPUT OR NOT EXISTS "${INPUT}")
+ message(FATAL_ERROR "INPUT does not name the smoke-test fixture")
+endif()
+
+execute_process(
+ COMMAND "${SERVER}"
+ INPUT_FILE "${INPUT}"
+ OUTPUT_VARIABLE server_output
+ ERROR_VARIABLE server_error
+ RESULT_VARIABLE server_result
+ TIMEOUT 10
+)
+
+if(NOT server_result EQUAL 0)
+ message(FATAL_ERROR
+ "Server exited with ${server_result}.\nstdout: ${server_output}\nstderr: ${server_error}"
+ )
+endif()
+
+foreach(expected
+ "\"protocolVersion\":\"2024-11-05\""
+ "\"serverInfo\""
+ "\"capabilities\""
+ "\"name\":\"health\""
+ "\"type\":\"text\""
+ "\"text\":\"ok\""
+ )
+ string(FIND "${server_output}" "${expected}" match_position)
+ if(match_position EQUAL -1)
+ message(FATAL_ERROR
+ "Expected ${expected} in MCP output.\nstdout: ${server_output}\nstderr: ${server_error}"
+ )
+ endif()
+endforeach()
+
+message(STATUS "MCP initialize, tools/list, and health tools/call succeeded")