From e8adf880c13f0ba10a3e23cdabaf02d4166c4fa4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 5 Oct 2026 17:48:35 +0500 Subject: upgrade cmake-common --- aesxx/utils/CMakeLists.txt | 7 ++++++ aesxx/utils/test/basic.cmake | 60 +++++++++++--------------------------------- aesxx/utils/test/block.cmake | 22 ++++++---------- cmake | 2 +- test/CMakeLists.txt | 17 +++++++------ 5 files changed, 40 insertions(+), 68 deletions(-) diff --git a/aesxx/utils/CMakeLists.txt b/aesxx/utils/CMakeLists.txt index 8b904a6..e2d85ed 100644 --- a/aesxx/utils/CMakeLists.txt +++ b/aesxx/utils/CMakeLists.txt @@ -44,6 +44,13 @@ endif() find_package(Python3 REQUIRED COMPONENTS Interpreter) +set(test_run + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" + COMMAND Python3::Interpreter + -m project.ctest_driver + run +) + include(test/basic.cmake) include(test/block.cmake) if(WIN32) diff --git a/aesxx/utils/test/basic.cmake b/aesxx/utils/test/basic.cmake index cba1180..e63a5ae 100644 --- a/aesxx/utils/test/basic.cmake +++ b/aesxx/utils/test/basic.cmake @@ -7,17 +7,13 @@ foreach(action encrypt decrypt) foreach(util ${utils}) set(exe "${action}_${util}") set(tgt "util_${exe}") - add_test(NAME "${tgt}_help" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_help" ${test_run} --pass-regex "usage: ${exe}" "set algorithm" --fail-regex "usage error:" -- "$" -h ) - add_test(NAME "${tgt}_no_args" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_args" ${test_run} --exit-code 1 --pass-regex "usage error: the option '--algorithm' is required" @@ -30,79 +26,59 @@ foreach(action encrypt decrypt) set(exe "${action}_block") set(tgt "util_${exe}") - add_test(NAME "${tgt}_no_input" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_input" ${test_run} --fail-regex ".+" -- "$" -a aes256 -m ofb ) - add_test(NAME "${tgt}_only_key" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_only_key" ${test_run} --fail-regex ".+" -- "$" -a AES256 -m ECB 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f ) - add_test(NAME "${tgt}_invalid_algorithm" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_algorithm" ${test_run} --exit-code 1 --pass-regex "usage error:" "for option '--algorithm' is invalid" -- "$" -a bar -m ecb ) - add_test(NAME "${tgt}_invalid_mode" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_mode" ${test_run} --exit-code 1 --pass-regex "usage error:" "for option '--mode' is invalid" -- "$" -a aes128 -m foo ) - add_test(NAME "${tgt}_no_iv" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_iv" ${test_run} --exit-code 1 --pass-regex "usage error: an initialization vector is required" -- "$" -a aes192 -m cbc 000102030405060708090a0b0c0d0e0f1011121314151617 ) - add_test(NAME "${tgt}_invalid_key1" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_key1" ${test_run} --exit-code 1 --pass-regex [=[AES error: Couldn't parse '0001020304050607' \(possibly not complete input\) as a 32-byte hex string]=] -- "$" -a aes256 -m ecb 0001020304050607 ) - add_test(NAME "${tgt}_invalid_key2" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_key2" ${test_run} --exit-code 1 --pass-regex [=[AES error: Couldn't parse 'foobar' \(possibly not complete input\) as a 32-byte hex string]=] -- "$" -a aes256 -m ecb foobar ) - add_test(NAME "${tgt}_invalid_iv1" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_iv1" ${test_run} --exit-code 1 --pass-regex [=[AES error: Couldn't parse '2222222222222222222222222222222' \(possibly not complete input\) as a 16-byte hex string]=] -- "$" -a aes128 -m cbc 11111111111111111111111111111111 2222222222222222222222222222222 ) - add_test(NAME "${tgt}_invalid_iv2" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_iv2" ${test_run} --exit-code 1 --pass-regex [=[AES error: Couldn't parse '222222222222222222222222222222222' \(possibly not complete input\) as a 16-byte hex string]=] -- "$" -a aes128 -m cbc 11111111111111111111111111111111 222222222222222222222222222222222 ) - add_test(NAME "${tgt}_invalid_block" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_invalid_block" ${test_run} --exit-code 1 --pass-regex [=[AES error: Couldn't parse '0' \(possibly not complete input\) as a 16-byte hex string]=] -- @@ -111,25 +87,19 @@ foreach(action encrypt decrypt) set(exe "${action}_file") set(tgt "util_${exe}") - add_test(NAME "${tgt}_no_key" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_key" ${test_run} --exit-code 1 --pass-regex [=[the option '--key' is required but missing]=] -- "$" -a aes128 -m ecb -i in.txt -o out.txt ) - add_test(NAME "${tgt}_no_files" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_files" ${test_run} --exit-code 1 --pass-regex [=[the option '--input' is required but missing]=] -- "$" -a aes128 -m ecb -k 11111111111111111111111111111111 ) - add_test(NAME "${tgt}_no_iv" COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run + add_test(NAME "${tgt}_no_iv" ${test_run} --exit-code 1 --pass-regex [=[AES error: Encryption mode requires init vector]=] -- diff --git a/aesxx/utils/test/block.cmake b/aesxx/utils/test/block.cmake index c6aa196..e5f2dfc 100644 --- a/aesxx/utils/test/block.cmake +++ b/aesxx/utils/test/block.cmake @@ -67,13 +67,10 @@ foreach(algorithm ${algorithms}) string(JOIN "\n" output ${ciphertexts_${algorithm}_${mode}}) message(STATUS "Adding test for encrypt_block (${algorithm}/${mode})") - add_test(NAME "util_encrypt_block_${algorithm}_${mode}" - COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run - --pass-regex "^${output}$" - -- - "$" -a "${algorithm}" -m "${mode}" ${input} + add_test(NAME "util_encrypt_block_${algorithm}_${mode}" ${test_run} + --pass-regex "^${output}$" + -- + "$" -a "${algorithm}" -m "${mode}" ${input} ) set(input "") @@ -87,13 +84,10 @@ foreach(algorithm ${algorithms}) string(JOIN "\n" output ${plaintexts}) message(STATUS "Adding test for decrypt_block (${algorithm}/${mode})") - add_test(NAME "util_decrypt_block_${algorithm}_${mode}" - COMMAND Python3::Interpreter - "${CMAKE_SOURCE_DIR}/cmake/tools/ctest-driver.py" - run - --pass-regex "^${output}$" - -- - "$" -a "${algorithm}" -m "${mode}" ${input} + add_test(NAME "util_decrypt_block_${algorithm}_${mode}" ${test_run} + --pass-regex "^${output}$" + -- + "$" -a "${algorithm}" -m "${mode}" ${input} ) endforeach() endforeach() diff --git a/cmake b/cmake index 88a20a8..afa6d7a 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 88a20a8b36ded8137c5bedb6851c3974926e68d0 +Subproject commit afa6d7ad45daa8b8092f6ab076e7e8e66bb71ceb diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ee5728..bd7fb1b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,8 +1,13 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter) -add_test(NAME nist COMMAND Python3::Interpreter - "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/tools/ctest-driver.py" +set(test_run + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" + COMMAND Python3::Interpreter + -m project.ctest_driver run +) + +add_test(NAME nist ${test_run} --pass-regex [=[Succeeded: *30$]=] --fail-regex [=[Failed: *[1-9]]=] -- @@ -10,9 +15,7 @@ add_test(NAME nist COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/nist.py" --path "$" ) -add_test(NAME cavp COMMAND Python3::Interpreter - "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/tools/ctest-driver.py" - run +add_test(NAME cavp ${test_run} --pass-regex [=[Succeeded: *96$]=] --fail-regex [=[Failed: *[1-9]]=] -- @@ -20,9 +23,7 @@ add_test(NAME cavp COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/cavp.py" --path "$" ) -add_test(NAME file COMMAND Python3::Interpreter - "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/tools/ctest-driver.py" - run +add_test(NAME file ${test_run} --pass-regex [=[Succeeded: *180$]=] --fail-regex [=[Failed: *[1-9]]=] -- -- cgit v1.3