summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-06-29 01:28:01 +0900
committertanaka takashi <isazaka@gmail.com>2026-06-29 01:28:01 +0900
commit8d38b06f11c713e547d70468340242f23322152c (patch)
tree566b4c658d7d0157c0cec4da490b37aa747a2d4e /tests
first commit
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt10
-rw-r--r--tests/fixtures/smoke-input.jsonl5
-rw-r--r--tests/smoke.cmake39
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..8f79a91
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(
+ NAME tiny-convmem-mcp.smoke
+ COMMAND "${CMAKE_COMMAND}"
+ "-DSERVER=$<TARGET_FILE:tiny-convmem-mcp>"
+ "-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/fixtures/smoke-input.jsonl"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/smoke.cmake"
+)
+
+set_tests_properties(tiny-convmem-mcp.smoke PROPERTIES TIMEOUT 15)
+
diff --git a/tests/fixtures/smoke-input.jsonl b/tests/fixtures/smoke-input.jsonl
new file mode 100644
index 0000000..5c046a4
--- /dev/null
+++ b/tests/fixtures/smoke-input.jsonl
@@ -0,0 +1,5 @@
+{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"tiny-convmem-smoke","version":"0.1.0"}}}
+{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
+{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
+{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"health","arguments":{}}}
+
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")