comparison 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
comparison
equal deleted inserted replaced
772:aec00847d86d 773:2c69298b4188
14 14
15 find_package(Qt5Test) 15 find_package(Qt5Test)
16 include_directories(${Qt5Test_INCLUDE_DIRS}) 16 include_directories(${Qt5Test_INCLUDE_DIRS})
17 find_program(HIAWATHA_EXECUTABLE hiawatha) 17 find_program(HIAWATHA_EXECUTABLE hiawatha)
18 find_program(OSSLSIGNCODE_EXECUTABLE osslsigncode) 18 find_program(OSSLSIGNCODE_EXECUTABLE osslsigncode)
19 find_program(OPENSSL_EXECUTABLE openssl)
19 20
20 if (NOT HIAWATHA_EXECUTABLE) 21 if (NOT HIAWATHA_EXECUTABLE)
21 message (STATUS "WARNING: hiawatha webserver not found. Downloader will not be run.") 22 message (STATUS "WARNING: hiawatha webserver not found. Downloader will not be run.")
22 else() 23 else()
23 add_definitions(-DHIAWATHA_EXECUTABLE="${HIAWATHA_EXECUTABLE}") 24 add_definitions(-DHIAWATHA_EXECUTABLE="${HIAWATHA_EXECUTABLE}")
24 endif() 25 endif()
25 26
26 if (WIN32 AND NOT OSSLSIGNCODE_EXECUTABLE) 27 if (WIN32 AND NOT OSSLSIGNCODE_EXECUTABLE)
27 message (STATUS "WARNING: osslsigncode not found. Authenticode tests will not be run.") 28 message (STATUS "WARNING: osslsigncode not found. Authenticode tests will not be run.")
29 endif()
30
31 if (UNIX AND NOT OPENSSL_EXECUTABLE)
32 message (STATUS "WARNING: openssl (the tool) not found. Binary verification tests will not be run.")
28 endif() 33 endif()
29 34
30 macro(add_custom_test _source _additional_sources) 35 macro(add_custom_test _source _additional_sources)
31 set(_test ${_source}) 36 set(_test ${_source})
32 get_filename_component(_name ${_source} NAME_WE) 37 get_filename_component(_name ${_source} NAME_WE)
106 -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe && 111 -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe &&
107 ${CMAKE_STRIP} ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe 112 ${CMAKE_STRIP} ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe
108 ) 113 )
109 endif() 114 endif()
110 else () 115 else ()
111 add_custom_test (binverifytest.cpp "") 116 if (OPENSSL_EXECUTABLE)
117 add_custom_test (binverifytest.cpp "")
118 add_custom_command(
119 TARGET binverifytest
120 POST_BUILD
121 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/append-sig.sh ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.key
122 ${CMAKE_CURRENT_BINARY_DIR}/fakeinst ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-signed
123 )
124 # add_custom_command(
125 # TARGET binverifytest
126 # POST_BUILD
127 # COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.pem
128 # -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.key
129 # -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
130 # -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-other-key.exe
131 # )
132 # add_custom_command(
133 # TARGET binverifytest
134 # POST_BUILD
135 # COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.pem
136 # -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning-other.key
137 # -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
138 # -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-other-cert.exe
139 # )
140 # add_custom_command(
141 # TARGET binverifytest
142 # POST_BUILD
143 # COMMAND ${OSSLSIGNCODE_EXECUTABLE} sign -certs ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.pem
144 # -key ${CMAKE_CURRENT_SOURCE_DIR}/data/codesign/codesigning.key
145 # -h sha256 -in ${CMAKE_CURRENT_BINARY_DIR}/fakeinst.exe
146 # -out ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe &&
147 # ${CMAKE_STRIP} ${CMAKE_CURRENT_BINARY_DIR}/fakeinst-invalid.exe
148 # )
149 endif()
112 endif () 150 endif ()
113 151
114 if (NSS_FOUND) 152 if (NSS_FOUND)
115 include_directories(${NSS_INCLUDE_DIRS}) 153 include_directories(${NSS_INCLUDE_DIRS})
116 set(NSSTEST_SOURCES 154 set(NSSTEST_SOURCES

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