diff ui/tests/CMakeLists.txt @ 773:2c69298b4188

WIP start with tests for Linux binary verification
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 10 Jul 2014 19:16:21 +0200
parents be30d50bc4f0
children 44fa5de02b52
line wrap: on
line diff
--- a/ui/tests/CMakeLists.txt	Thu Jul 10 19:15:48 2014 +0200
+++ b/ui/tests/CMakeLists.txt	Thu Jul 10 19:16:21 2014 +0200
@@ -16,6 +16,7 @@
 include_directories(${Qt5Test_INCLUDE_DIRS})
 find_program(HIAWATHA_EXECUTABLE hiawatha)
 find_program(OSSLSIGNCODE_EXECUTABLE osslsigncode)
+find_program(OPENSSL_EXECUTABLE openssl)
 
 if (NOT HIAWATHA_EXECUTABLE)
    message (STATUS "WARNING: hiawatha webserver not found. Downloader will not be run.")
@@ -27,6 +28,10 @@
    message (STATUS "WARNING: osslsigncode not found. Authenticode tests will not be run.")
 endif()
 
+if (UNIX AND NOT OPENSSL_EXECUTABLE)
+   message (STATUS "WARNING: openssl (the tool) not found. Binary verification tests will not be run.")
+endif()
+
 macro(add_custom_test _source _additional_sources)
   set(_test ${_source})
   get_filename_component(_name ${_source} NAME_WE)
@@ -108,7 +113,40 @@
          )
     endif()
 else ()
-   add_custom_test (binverifytest.cpp "")
+   if (OPENSSL_EXECUTABLE)
+      add_custom_test (binverifytest.cpp "")
+      add_custom_command(
+         TARGET binverifytest
+         POST_BUILD
+         COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/append-sig.sh ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.key
+                 ${CMAKE_CURRENT_BINARY_DIR}/fakeinst ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-signed
+         )
+#      add_custom_command(
+#         TARGET binverifytest
+#         POST_BUILD
+#         COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.pem
+#         -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.key
+#         -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
+#         -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-other-key.exe
+#         )
+#      add_custom_command(
+#         TARGET binverifytest
+#         POST_BUILD
+#         COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.pem
+#         -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.key
+#         -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
+#         -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-other-cert.exe
+#         )
+#      add_custom_command(
+#         TARGET binverifytest
+#         POST_BUILD
+#         COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.pem
+#         -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.key
+#         -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
+#         -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe &&
+#         ${CMAKE_STRIP} ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe
+#         )
+   endif()
 endif ()
 
 if (NSS_FOUND)

http://wald.intevation.org/projects/trustbridge/