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
This commit is contained in:
Andrzej Kurek 2018-03-16 07:37:44 -04:00
parent 0211c32c9a
commit 89c048c101
4 changed files with 14 additions and 12 deletions

2
programs/.gitignore vendored
View file

@ -45,7 +45,7 @@ ssl/mini_client
test/benchmark test/benchmark
test/ecp-bench test/ecp-bench
test/selftest test/selftest
test/header_test test/cpp_dummy_build
test/ssl_cert_test test/ssl_cert_test
test/udp_proxy test/udp_proxy
test/zeroize test/zeroize

View file

@ -80,7 +80,7 @@ APPS += ssl/ssl_pthread_server$(EXEXT)
endif endif
ifdef TEST_CPP ifdef TEST_CPP
APPS += test/header_test$(EXEXT) APPS += test/cpp_dummy_build$(EXEXT)
endif endif
.SILENT: .SILENT:
@ -248,9 +248,9 @@ test/benchmark$(EXEXT): test/benchmark.c $(DEP)
echo " CC test/benchmark.c" echo " CC test/benchmark.c"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
test/header_test$(EXEXT): test/header_test.cpp $(DEP) test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
echo " CXX test/header_test.cpp" echo " CXX test/cpp_dummy_build.cpp"
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/header_test.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
test/selftest$(EXEXT): test/selftest.c $(DEP) test/selftest$(EXEXT): test/selftest.c $(DEP)
echo " CC test/selftest.c" echo " CC test/selftest.c"

View file

@ -17,8 +17,8 @@ add_executable(benchmark benchmark.c)
target_link_libraries(benchmark ${libs}) target_link_libraries(benchmark ${libs})
if(TEST_CPP) if(TEST_CPP)
add_executable(header_test header_test.cpp) add_executable(cpp_dummy_build cpp_dummy_build.cpp)
target_link_libraries(header_test ${libs}) target_link_libraries(cpp_dummy_build ${libs})
endif() endif()
add_executable(ssl_cert_test ssl_cert_test.c) add_executable(ssl_cert_test ssl_cert_test.c)

View file

@ -1,6 +1,6 @@
/* /*
* A C++ program that includes all of the mbed TLS header files, in order to * This program is a dummy C++ program to ensure Mbed TLS library header files
* test if no errors are raised in the process. * can be included and built with a C++ compiler.
* *
* Copyright (C) 2018, ARM Limited, All Rights Reserved * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
@ -108,8 +108,10 @@
#include "mbedtls/memory_buffer_alloc.h" #include "mbedtls/memory_buffer_alloc.h"
#endif #endif
int main( int argc, char *argv[] ) int main()
{ {
(void) argc; mbedtls_platform_context *ctx = NULL;
(void) argv; mbedtls_platform_setup(ctx);
mbedtls_printf("CPP Build test\n");
mbedtls_platform_teardown(ctx);
} }