Tests: add a test for cpp linking
Change the name of header_test to cpp_dumy_build
Update the test description to better reflect its contents
diff --git a/programs/.gitignore b/programs/.gitignore
index 5bbe2e8..0241896 100644
--- a/programs/.gitignore
+++ b/programs/.gitignore
@@ -45,7 +45,7 @@
test/benchmark
test/ecp-bench
test/selftest
-test/header_test
+test/cpp_dummy_build
test/ssl_cert_test
test/udp_proxy
test/zeroize
diff --git a/programs/Makefile b/programs/Makefile
index 844d680..b6d1fa2 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -80,7 +80,7 @@
endif
ifdef TEST_CPP
-APPS += test/header_test$(EXEXT)
+APPS += test/cpp_dummy_build$(EXEXT)
endif
.SILENT:
@@ -248,9 +248,9 @@
echo " CC test/benchmark.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
-test/header_test$(EXEXT): test/header_test.cpp $(DEP)
- echo " CXX test/header_test.cpp"
- $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/header_test.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
+test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
+ echo " CXX test/cpp_dummy_build.cpp"
+ $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
test/selftest$(EXEXT): test/selftest.c $(DEP)
echo " CC test/selftest.c"
diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt
index 6791ffd..994e92c 100644
--- a/programs/test/CMakeLists.txt
+++ b/programs/test/CMakeLists.txt
@@ -17,8 +17,8 @@
target_link_libraries(benchmark ${libs})
if(TEST_CPP)
- add_executable(header_test header_test.cpp)
- target_link_libraries(header_test ${libs})
+ add_executable(cpp_dummy_build cpp_dummy_build.cpp)
+ target_link_libraries(cpp_dummy_build ${libs})
endif()
add_executable(ssl_cert_test ssl_cert_test.c)
diff --git a/programs/test/header_test.cpp b/programs/test/cpp_dummy_build.cpp
similarity index 91%
rename from programs/test/header_test.cpp
rename to programs/test/cpp_dummy_build.cpp
index 69d7c4a..03373a9 100644
--- a/programs/test/header_test.cpp
+++ b/programs/test/cpp_dummy_build.cpp
@@ -1,6 +1,6 @@
/*
- * A C++ program that includes all of the mbed TLS header files, in order to
- * test if no errors are raised in the process.
+ * This program is a dummy C++ program to ensure Mbed TLS library header files
+ * can be included and built with a C++ compiler.
*
* Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
@@ -108,8 +108,10 @@
#include "mbedtls/memory_buffer_alloc.h"
#endif
-int main( int argc, char *argv[] )
+int main()
{
- (void) argc;
- (void) argv;
+ mbedtls_platform_context *ctx = NULL;
+ mbedtls_platform_setup(ctx);
+ mbedtls_printf("CPP Build test\n");
+ mbedtls_platform_teardown(ctx);
}