diff ui/tests/CMakeLists.txt @ 636:2fd4f9980a2a

Add test for authenticode verificate (binverify) Still incomplete
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 23 Jun 2014 18:00:45 +0200
parents cf7e82e91875
children be30d50bc4f0
line wrap: on
line diff
--- a/ui/tests/CMakeLists.txt	Mon Jun 23 17:24:00 2014 +0200
+++ b/ui/tests/CMakeLists.txt	Mon Jun 23 18:00:45 2014 +0200
@@ -15,13 +15,18 @@
 find_package(Qt5Test)
 include_directories(${Qt5Test_INCLUDE_DIRS})
 find_program(HIAWATHA_EXECUTABLE hiawatha)
+find_program(OSSLSIGNCODE_EXECUTABLE osslsigncode)
 
 if (NOT HIAWATHA_EXECUTABLE)
-   message (STATUS "WARNING: hiawatha webserver not found. Downloader tests will fail.")
+   message (STATUS "WARNING: hiawatha webserver not found. Downloader will not be run.")
 else()
   add_definitions(-DHIAWATHA_EXECUTABLE="${HIAWATHA_EXECUTABLE}")
 endif()
 
+if (WIN32 AND NOT OSSLSIGNCODE_EXECUTABLE)
+   message (STATUS "WARNING: osslsigncode not found. Authenticode tests will not be run.")
+endif()
+
 macro(add_custom_test _source _additional_sources)
   set(_test ${_source})
   get_filename_component(_name ${_source} NAME_WE)
@@ -65,7 +70,21 @@
 
 if (WIN32)
    add_custom_test(windowsstoretest.cpp "${CMAKE_SOURCE_DIR}/cinst/windowsstore.c")
-endif (WIN32)
+
+   if (OSSLSIGNCODE_EXECUTABLE)
+      add_custom_test (binverifytest.cpp "")
+      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-signed.exe
+         )
+    endif()
+else ()
+   add_custom_test (binverifytest.cpp "")
+endif ()
 
 if (NSS_FOUND)
    include_directories(${NSS_INCLUDE_DIRS})

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