From 1264c2a86f0b578b6f82a4c1993a22cbbe956a27 Mon Sep 17 00:00:00 2001 From: Jaeden Amero Date: Thu, 7 Mar 2019 16:01:11 +0000 Subject: [PATCH] tests: Exclude version suite when used as a submodule The version test suite is duplicated between Mbed TLS and Mbed Crypto. Use TLS's copy and not Crypto's copy when Crypto is used as a submodule of TLS. The version test is the only test that is tested from both TLS and Crypto, despite being entirely in libmbedcrypto. This is because the test data is code-gen'd from the version updating script and the version between Mbed TLS and Mbed Crypto don't necessarily always agree. The test data must come from the top level module, as only the top level module will have test data that matches the expected version. --- tests/CMakeLists.txt | 4 +++- tests/Makefile | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 06df85dfe..e9cae9a9b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -138,8 +138,10 @@ add_test_suite(psa_crypto_storage_file) add_test_suite(shax) add_test_suite(timing) add_test_suite(rsa) -add_test_suite(version) add_test_suite(xtea) +if (NOT USE_CRYPTO_SUBMODULE) + add_test_suite(version) +endif() # Make scripts and data files needed for testing available in an # out-of-source build. diff --git a/tests/Makefile b/tests/Makefile index 50a054969..8db7920d7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -59,6 +59,15 @@ endif # constructed by stripping path 'suites/' and extension .data. APPS = $(basename $(subst suites/,,$(wildcard suites/test_suite_*.data))) +# When this project is used as a submodule, exclude the following list of +# tests, which will be run from the parent module instead. +ifdef USE_CRYPTO_SUBMODULE +APPS := $(filter-out \ + test_suite_version \ + ,$(APPS)) +endif + + # Construct executable name by adding OS specific suffix $(EXEXT). BINARIES := $(addsuffix $(EXEXT),$(APPS))