diff options
author | Julian Büning <julian.buening@rwth-aachen.de> | 2019-08-04 21:18:01 +0200 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2019-09-05 09:39:19 +0100 |
commit | 368409073b0e4037a879bcc3f30265aa93a2b367 (patch) | |
tree | ed593026a12fb71bfa70a65635df24455ee3104e | |
parent | 11dd657333ec8e90945fe793c0ad40eadb0e0646 (diff) | |
download | klee-368409073b0e4037a879bcc3f30265aa93a2b367.tar.gz |
test/CMakeLists.txt: error handling for download
-rw-r--r-- | test/CMakeLists.txt | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 06bf5d28..0da40cf0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -70,7 +70,13 @@ if (DOWNLOAD_FILECHECK_SOURCE) set(FILECHECK_SRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/FileCheck.cpp") if (NOT EXISTS "${FILECHECK_SRC_FILE}") message(STATUS "Downloading LLVM FileCheck source") - file(DOWNLOAD "${FILECHECK_SRC_URL}" "${FILECHECK_SRC_FILE}" SHOW_PROGRESS) + file(DOWNLOAD "${FILECHECK_SRC_URL}" "${FILECHECK_SRC_FILE}" SHOW_PROGRESS STATUS DOWNLOAD_STATUS) + list(GET DOWNLOAD_STATUS 0 DOWNLOAD_STATUS_CODE) + if (NOT DOWNLOAD_STATUS_CODE EQUAL 0) + file(REMOVE "${FILECHECK_SRC_FILE}") + list(GET DOWNLOAD_STATUS 1 DOWNLOAD_STATUS_MESSAGE) + message(FATAL_ERROR "Download failed with error: ${DOWNLOAD_STATUS_CODE} - ${DOWNLOAD_STATUS_MESSAGE}") + endif() endif() add_executable(FileCheck ${FILECHECK_SRC_FILE} @@ -91,7 +97,13 @@ if (DOWNLOAD_NOT_SOURCE) set(NOT_SRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/not.cpp") if (NOT EXISTS "${NOT_SRC_FILE}") message(STATUS "Downloading LLVM not source") - file(DOWNLOAD "${NOT_SRC_URL}" "${NOT_SRC_FILE}" SHOW_PROGRESS) + file(DOWNLOAD "${NOT_SRC_URL}" "${NOT_SRC_FILE}" SHOW_PROGRESS STATUS DOWNLOAD_STATUS) + list(GET DOWNLOAD_STATUS 0 DOWNLOAD_STATUS_CODE) + if (NOT DOWNLOAD_STATUS_CODE EQUAL 0) + file(REMOVE "${NOT_SRC_FILE}") + list(GET DOWNLOAD_STATUS 1 DOWNLOAD_STATUS_MESSAGE) + message(FATAL_ERROR "Download failed with error: ${DOWNLOAD_STATUS_CODE} - ${DOWNLOAD_STATUS_MESSAGE}") + endif() endif() add_executable("not" ${NOT_SRC_FILE} |