aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2020-01-08 15:46:18 +0000
committerTamas Ban <tamas.ban@arm.com>2020-01-23 13:33:03 +0000
commitdad4b89ca9f06bbde7af7ee0ef2e696dabe0c2cf (patch)
tree2039c39025d9b06ca15fed9e0761bd7437ee44b7
parent31fa6743fb838871aa1aec8538cf2c8960d15aee (diff)
downloadtrusted-firmware-m-dad4b89ca9f06bbde7af7ee0ef2e696dabe0c2cf.tar.gz
Build: Compile QCBOR test suite togheter with the library
QCBOR encode/decode library and its test suite was built in different places. Move them to the same CMake file to increase transparency and reduce the include path for test application. Change-Id: I645f4e8d4f1e5fb06aa72c00f8fd547a527ba110 Signed-off-by: Tamas Ban <tamas.ban@arm.com>
-rw-r--r--lib/ext/qcbor/CMakeLists.txt15
-rw-r--r--test/CMakeLists.txt5
-rw-r--r--test/suites/qcbor/CMakeLists.inc17
-rw-r--r--test/suites/qcbor/non_secure/qcbor_ns_testsuite.c6
4 files changed, 20 insertions, 23 deletions
diff --git a/lib/ext/qcbor/CMakeLists.txt b/lib/ext/qcbor/CMakeLists.txt
index ff7004680..96f2ec5d7 100644
--- a/lib/ext/qcbor/CMakeLists.txt
+++ b/lib/ext/qcbor/CMakeLists.txt
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -36,16 +36,29 @@ list(APPEND ALL_SRC_C_DECODE
"${QCBOR_DIR}/src/UsefulBuf.c"
)
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C_TEST
+ "${QCBOR_DIR}/test/float_tests.c"
+ "${QCBOR_DIR}/test/half_to_double_from_rfc7049.c"
+ "${QCBOR_DIR}/test/qcbor_decode_tests.c"
+ "${QCBOR_DIR}/test/qcbor_encode_tests.c"
+ "${QCBOR_DIR}/test/run_tests.c"
+ "${QCBOR_DIR}/test/UsefulBuf_Tests.c"
+ )
+
#Setting include directories
embedded_include_directories(PATH ${QCBOR_DIR}/inc ABSOLUTE)
#Specify what we build (for the QCBOR, build as an object library)
add_library(tfm_qcbor_encode OBJECT ${ALL_SRC_C_ENCODE})
add_library(tfm_qcbor_decode OBJECT ${ALL_SRC_C_DECODE})
+add_library(tfm_qcbor_test OBJECT ${ALL_SRC_C_TEST})
#Set common compiler flags
config_setting_shared_compiler_flags(tfm_qcbor_encode)
config_setting_shared_compiler_flags(tfm_qcbor_decode)
+config_setting_shared_compiler_flags(tfm_qcbor_test)
embedded_project_end(tfm_qcbor_encode)
embedded_project_end(tfm_qcbor_decode)
+embedded_project_end(tfm_qcbor_test)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b98a8c3f0..2790fffd5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -151,10 +151,7 @@ if (TFM_BUILD_IN_SPE)
#to hold the compiled tfm_qcbor files.
add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S})
if (ENABLE_ATTESTATION_SERVICE_TESTS)
- target_sources(tfm_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_t_cose_verify>)
- endif()
- if (ENABLE_ATTESTATION_SERVICE_TESTS OR ENABLE_QCBOR_TESTS)
- target_sources(tfm_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_qcbor_decode>)
+ target_sources(tfm_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_t_cose_verify> $<TARGET_OBJECTS:tfm_qcbor_decode>)
endif()
#Set common compiler and linker flags
diff --git a/test/suites/qcbor/CMakeLists.inc b/test/suites/qcbor/CMakeLists.inc
index 8d9cc6a91..d8fa1f779 100644
--- a/test/suites/qcbor/CMakeLists.inc
+++ b/test/suites/qcbor/CMakeLists.inc
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -26,24 +26,11 @@ if(NOT DEFINED TFM_ROOT_DIR)
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
-#Get the directory where test cases are stored
-set(QCBOR_TEST_DIR "${TFM_ROOT_DIR}/lib/ext/qcbor/test")
-
if (NOT DEFINED ENABLE_QCBOR_TESTS)
message(FATAL_ERROR "Incomplete build configuration: ENABLE_QCBOR_TESTS is undefined.")
elseif(ENABLE_QCBOR_TESTS)
list(APPEND ALL_SRC_C_NS
"${QCBOR_TEST_SUIT_DIR}/non_secure/qcbor_ns_testsuite.c"
- "${QCBOR_TEST_DIR}/float_tests.c"
- "${QCBOR_TEST_DIR}/half_to_double_from_rfc7049.c"
- "${QCBOR_TEST_DIR}/qcbor_decode_tests.c"
- "${QCBOR_TEST_DIR}/qcbor_encode_tests.c"
- "${QCBOR_TEST_DIR}/run_tests.c"
- "${QCBOR_TEST_DIR}/UsefulBuf_Tests.c"
+ $<TARGET_OBJECTS:tfm_qcbor_test> #See in lib/ext/qcbor/CMakeList.txt
)
-
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/qcbor/inc ABSOLUTE)
- embedded_include_directories(PATH ${QCBOR_TEST_DIR} ABSOLUTE)
endif()
diff --git a/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c b/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
index 2b0e05469..95f397262 100644
--- a/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
+++ b/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -7,7 +7,7 @@
#include "qcbor_ns_tests.h"
#include <stdio.h>
-#include "run_tests.h"
+#include "lib/ext/qcbor/test/run_tests.h"
/*
* The QCBOR test cases are defined in: lib/ext/qcbor/test/run_test.c
@@ -109,7 +109,7 @@ static void fputs_wrapper(const char *string, void *out_ctx, int new_line)
* the preprocessor '#if 0' to '#if 1'.
*/
# if 0
- TEST_LOG("%s", string);
+ TEST_LOG("%s\r\n", string);
#else
(void)string;
#endif