From 50157ff5abc60ba75b9048384606839523b5ca77 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 19 Jul 2016 14:57:00 +0100 Subject: [PATCH] Add new timing test suite that runs the timing self test --- tests/CMakeLists.txt | 1 + tests/Makefile | 6 +++++- tests/suites/test_suite_timing.data | 2 ++ tests/suites/test_suite_timing.function | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/suites/test_suite_timing.data create mode 100644 tests/suites/test_suite_timing.function diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a004a3db3..13659de0f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -95,6 +95,7 @@ add_test_suite(pkparse) add_test_suite(pkwrite) add_test_suite(shax) add_test_suite(ssl) +add_test_suite(timing) add_test_suite(rsa) add_test_suite(version) add_test_suite(xtea) diff --git a/tests/Makefile b/tests/Makefile index 58c404e5d..4fe75a89c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -81,7 +81,7 @@ APPS = test_suite_aes.ecb$(EXEXT) test_suite_aes.cbc$(EXEXT) \ test_suite_pkparse$(EXEXT) test_suite_pkwrite$(EXEXT) \ test_suite_pk$(EXEXT) \ test_suite_rsa$(EXEXT) test_suite_shax$(EXEXT) \ - test_suite_ssl$(EXEXT) \ + test_suite_ssl$(EXEXT) test_suite_timing$(EXEXT) \ test_suite_x509parse$(EXEXT) test_suite_x509write$(EXEXT) \ test_suite_xtea$(EXEXT) test_suite_version$(EXEXT) @@ -412,6 +412,10 @@ test_suite_ssl$(EXEXT): test_suite_ssl.c $(DEP) echo " CC $<" $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ +test_suite_timing$(EXEXT): test_suite_timing.c $(DEP) + echo " CC $<" + $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ + test_suite_x509parse$(EXEXT): test_suite_x509parse.c $(DEP) echo " CC $<" $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ diff --git a/tests/suites/test_suite_timing.data b/tests/suites/test_suite_timing.data new file mode 100644 index 000000000..3ba79a476 --- /dev/null +++ b/tests/suites/test_suite_timing.data @@ -0,0 +1,2 @@ +Timing selftest +timing_selftest: diff --git a/tests/suites/test_suite_timing.function b/tests/suites/test_suite_timing.function new file mode 100644 index 000000000..74f711c7d --- /dev/null +++ b/tests/suites/test_suite_timing.function @@ -0,0 +1,15 @@ +/* BEGIN_HEADER */ +#include "mbedtls/timing.h" +/* END_HEADER */ + +/* BEGIN_DEPENDENCIES + * depends_on:MBEDTLS_TIMING_C + * END_DEPENDENCIES + */ + +/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */ +void timing_selftest() +{ + TEST_ASSERT( mbedtls_timing_self_test( 0 ) == 0 ); +} +/* END_CASE */