mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-05 01:00:11 -05:00
improve tests
This commit is contained in:
parent
99400d92d6
commit
ac3e8e5221
@ -4,16 +4,21 @@
|
||||
include(FindPython3)
|
||||
enable_testing()
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests/tsa_server.py"
|
||||
DESTINATION "${PROJECT_BINARY_DIR}/Testing"
|
||||
)
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests/files"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/certs"
|
||||
set(FILES "${PROJECT_BINARY_DIR}/Testing/files")
|
||||
set(CERTS "${PROJECT_BINARY_DIR}/Testing/certs")
|
||||
set(CONF "${PROJECT_BINARY_DIR}/Testing/conf")
|
||||
|
||||
file(COPY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/files"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/conf"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/tsa_server.py"
|
||||
DESTINATION "${PROJECT_BINARY_DIR}/Testing"
|
||||
)
|
||||
|
||||
set(FILES "${PROJECT_BINARY_DIR}/Testing/files")
|
||||
set(CERTS "${PROJECT_BINARY_DIR}/Testing/certs")
|
||||
file(COPY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/certs/ca-bundle.crt"
|
||||
DESTINATION "${CONF}"
|
||||
)
|
||||
|
||||
set(priv_p12 "-pkcs12" "${CERTS}/cert.p12" "-readpass" "${CERTS}/password.txt")
|
||||
set(priv_spc "-certs" "${CERTS}/cert.spc" "-key" "${CERTS}/key.pvk" "-pass" "passme")
|
||||
@ -24,12 +29,27 @@ set(sign_opt "-time" "1556708400"
|
||||
"-h" "sha512" "-i" "https://www.osslsigncode.com/"
|
||||
"-n" "osslsigncode" "-ac" "${CERTS}/crosscert.pem"
|
||||
)
|
||||
execute_process(
|
||||
COMMAND "${CERTS}/makecerts.sh"
|
||||
WORKING_DIRECTORY ${CERTS}
|
||||
OUTPUT_VARIABLE makecerts
|
||||
)
|
||||
message(STATUS "makecerts.sh: ${makecerts}")
|
||||
|
||||
if(NOT CMAKE_HOST_WIN32)
|
||||
execute_process(
|
||||
COMMAND "${CONF}/makecerts.sh"
|
||||
WORKING_DIRECTORY ${CONF}
|
||||
OUTPUT_VARIABLE makecerts_output
|
||||
RESULT_VARIABLE makecerts_result
|
||||
)
|
||||
else()
|
||||
set(makecerts_result 1)
|
||||
endif()
|
||||
|
||||
if(makecerts_result)
|
||||
if(makecerts_output)
|
||||
message(STATUS "makecerts.sh failed: ${makecerts_output}")
|
||||
endif()
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests/certs"
|
||||
DESTINATION "${PROJECT_BINARY_DIR}/Testing"
|
||||
)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E sha256sum "${CERTS}/cert.der"
|
||||
OUTPUT_VARIABLE sha256sum
|
||||
|
3
tests/certs/makecerts.sh → tests/conf/makecerts.sh
Executable file → Normal file
3
tests/certs/makecerts.sh → tests/conf/makecerts.sh
Executable file → Normal file
@ -251,8 +251,7 @@ if test -n "$(command -v faketime)"
|
||||
make_certs "$1"
|
||||
result=$?
|
||||
else
|
||||
printf "%s\n" "faketime not found in \$PATH"
|
||||
printf "%s\n" "tests skipped, please install faketime package"
|
||||
printf "%s" "faketime not found in \$PATH, please install faketime package"
|
||||
result=1
|
||||
fi
|
||||
|
@ -12,13 +12,14 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
RESULT_PATH = os.getcwd()
|
||||
FILES_PATH = os.path.join(RESULT_PATH, "./Testing/files/")
|
||||
CERTS_PATH = os.path.join(RESULT_PATH, "./Testing/certs/")
|
||||
CONF_PATH = os.path.join(RESULT_PATH, "./Testing/conf/")
|
||||
DEFAULT_PATH = os.path.join(RESULT_PATH, "./osslsigncode")
|
||||
DEFAULT_IN = os.path.join(FILES_PATH, "./unsigned.exe")
|
||||
DEFAULT_OUT = os.path.join(FILES_PATH, "./ts.exe")
|
||||
DEFAULT_CERT = os.path.join(CERTS_PATH, "./cert.pem")
|
||||
DEFAULT_KEY = os.path.join(CERTS_PATH, "./key.pem")
|
||||
DEFAULT_CROSSCERT = os.path.join(CERTS_PATH, "./crosscert.pem")
|
||||
OPENSSL_CONF = os.path.join(CERTS_PATH, "./openssl_tsa.cnf")
|
||||
OPENSSL_CONF = os.path.join(CONF_PATH, "./openssl_tsa.cnf")
|
||||
REQUEST = os.path.join(FILES_PATH, "./jreq.tsq")
|
||||
RESPONS = os.path.join(FILES_PATH, "./jresp.tsr")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user