Add command test to CMakeLists.txt

This commit is contained in:
Zhi Guan
2024-06-01 11:46:13 +08:00
parent 76312df4d6
commit 3d6c8d15a8
3 changed files with 19 additions and 0 deletions

14
cmake/gmssl_sm3.cmake Normal file
View File

@@ -0,0 +1,14 @@
execute_process(
COMMAND gmssl sm3 -in_str abc
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
OUTPUT_VARIABLE TEST_OUTPUT
)
if(NOT ${TEST_RESULT} EQUAL 0)
message(FATAL_ERROR "stderr: ${TEST_STDERR}")
endif()
if(NOT ${TEST_OUTPUT} STREQUAL "66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0\n")
message(FATAL_ERROR "stdout: ${TEST_OUTPUT}")
endif()