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.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 06df85d..e9cae9a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -138,8 +138,10 @@
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 50a0549..8db7920 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -59,6 +59,15 @@
# 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))