diff --git a/CMakeLists.txt b/CMakeLists.txt index fb9e1c31db..742c50a5e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,7 +297,7 @@ add_subdirectory(library) add_subdirectory(pkgconfig) # -# The C files in tests/src directory contain test code shared among test suites +# The C files in framework/src directory contain test code shared among test suites # and programs. This shared test code is compiled and linked to test suites and # programs objects as a set of compiled objects. The compiled objects are NOT # built into a library that the test suite and program objects would link @@ -312,8 +312,8 @@ add_subdirectory(pkgconfig) # if(ENABLE_TESTING OR ENABLE_PROGRAMS) file(GLOB MBEDTLS_TEST_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/*.c - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/drivers/*.c) + ${CMAKE_CURRENT_SOURCE_DIR}/framework/src/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/framework/src/drivers/*.c) add_library(mbedtls_test OBJECT ${MBEDTLS_TEST_FILES}) target_include_directories(mbedtls_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include @@ -323,7 +323,7 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS) set_target_properties(mbedtls_test PROPERTIES C_STANDARD 11) file(GLOB MBEDTLS_TEST_HELPER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_helpers/*.c) + ${CMAKE_CURRENT_SOURCE_DIR}/framework/src/test_helpers/*.c) add_library(mbedtls_test_helpers OBJECT ${MBEDTLS_TEST_HELPER_FILES}) target_include_directories(mbedtls_test_helpers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include diff --git a/Makefile b/Makefile index fb80529efa..d6678100c6 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ C_SOURCE_FILES = $(wildcard \ library/*.[hc] \ programs/*/*.[hc] \ tests/include/*/*.h tests/include/*/*/*.h \ - tests/src/*.c tests/src/*/*.c \ + framework/src/*.c framework/src/*/*.c \ tests/suites/*.function \ ) # Exuberant-ctags invocation. Other ctags implementations may require different options. diff --git a/docs/psa-driver-example-and-guide.md b/docs/psa-driver-example-and-guide.md index aa825adcdd..c84a6b627f 100644 --- a/docs/psa-driver-example-and-guide.md +++ b/docs/psa-driver-example-and-guide.md @@ -43,7 +43,7 @@ There are three deliverables for creating such a driver. These are: - C header files defining the types required by the driver description. The names of these header files are declared in the driver description file. - An object file compiled for the target platform defining the functions required by the driver description. Implementations may allow drivers to be provided as source files and compiled with the core instead of being pre-compiled. -The Mbed TLS driver tests for the aforementioned entry points provide examples of how these deliverables can be implemented. For sample driver description JSON files, see [`mbedtls_test_transparent_driver.json`](https://github.com/Mbed-TLS/mbedtls/blob/development/scripts/data_files/driver_jsons/mbedtls_test_transparent_driver.json) or [`mbedtls_test_opaque_driver.json`](https://github.com/Mbed-TLS/mbedtls/blob/development/scripts/data_files/driver_jsons/mbedtls_test_transparent_driver.json). The header file required by the driver description is [`test_driver.h`](https://github.com/Mbed-TLS/mbedtls/blob/development/tests/include/test/drivers/test_driver.h). As Mbed TLS tests are built from source, there is no object file for the test driver. However, the source for the test driver can be found under `tests/src/drivers`. +The Mbed TLS driver tests for the aforementioned entry points provide examples of how these deliverables can be implemented. For sample driver description JSON files, see [`mbedtls_test_transparent_driver.json`](https://github.com/Mbed-TLS/mbedtls/blob/development/scripts/data_files/driver_jsons/mbedtls_test_transparent_driver.json) or [`mbedtls_test_opaque_driver.json`](https://github.com/Mbed-TLS/mbedtls/blob/development/scripts/data_files/driver_jsons/mbedtls_test_transparent_driver.json). The header file required by the driver description is [`test_driver.h`](https://github.com/Mbed-TLS/mbedtls/blob/development/tests/include/test/drivers/test_driver.h). As Mbed TLS tests are built from source, there is no object file for the test driver. However, the source for the test driver can be found under `framework/src/drivers`. ### Process for Entry Points where auto-generation is not implemented diff --git a/include/mbedtls/threading.h b/include/mbedtls/threading.h index d50d04ead1..0714b65ceb 100644 --- a/include/mbedtls/threading.h +++ b/include/mbedtls/threading.h @@ -30,7 +30,7 @@ typedef struct mbedtls_threading_mutex_t { pthread_mutex_t MBEDTLS_PRIVATE(mutex); /* WARNING - state should only be accessed when holding the mutex lock in - * tests/src/threading_helpers.c, otherwise corruption can occur. + * framework/src/threading_helpers.c, otherwise corruption can occur. * state will be 0 after a failed init or a free, and nonzero after a * successful init. This field is for testing only and thus not considered * part of the public API of Mbed TLS and may change without notice.*/ diff --git a/library/threading.c b/library/threading.c index 85db243f21..1238a8a978 100644 --- a/library/threading.c +++ b/library/threading.c @@ -61,7 +61,7 @@ static void threading_mutex_init_pthread(mbedtls_threading_mutex_t *mutex) * this here in a thread safe manner without a significant performance * hit, so state transitions are checked in tests only via the state * variable. Please make sure any new mutex that gets added is exercised in - * tests; see tests/src/threading_helpers.c for more details. */ + * tests; see framework/src/threading_helpers.c for more details. */ (void) pthread_mutex_init(&mutex->mutex, NULL); } diff --git a/programs/test/metatest.c b/programs/test/metatest.c index c52e579661..11f6eb80ec 100644 --- a/programs/test/metatest.c +++ b/programs/test/metatest.c @@ -261,7 +261,7 @@ void mutex_lock_not_initialized(const char *name) mbedtls_threading_mutex_t mutex; memset(&mutex, 0, sizeof(mutex)); /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ TEST_ASSERT(mbedtls_mutex_lock(&mutex) == 0); @@ -277,7 +277,7 @@ void mutex_unlock_not_initialized(const char *name) mbedtls_threading_mutex_t mutex; memset(&mutex, 0, sizeof(mutex)); /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ TEST_ASSERT(mbedtls_mutex_unlock(&mutex) == 0); @@ -293,7 +293,7 @@ void mutex_free_not_initialized(const char *name) mbedtls_threading_mutex_t mutex; memset(&mutex, 0, sizeof(mutex)); /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ mbedtls_mutex_free(&mutex); @@ -307,7 +307,7 @@ void mutex_double_init(const char *name) mbedtls_threading_mutex_t mutex; mbedtls_mutex_init(&mutex); /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ mbedtls_mutex_init(&mutex); @@ -323,7 +323,7 @@ void mutex_double_free(const char *name) mbedtls_mutex_init(&mutex); mbedtls_mutex_free(&mutex); /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ mbedtls_mutex_free(&mutex); @@ -338,7 +338,7 @@ void mutex_leak(const char *name) mbedtls_mutex_init(&mutex); #endif /* This mutex usage error is detected by our test framework's mutex usage - * verification framework. See tests/src/threading_helpers.c. Other + * verification framework. See framework/src/threading_helpers.c. Other * threading implementations (e.g. pthread without our instrumentation) * might consider this normal usage. */ } @@ -361,7 +361,7 @@ typedef struct { * - "msan": triggers MSan (Memory Sanitizer). * - "pthread": requires MBEDTLS_THREADING_PTHREAD and MBEDTLS_TEST_HOOKS, * which enables MBEDTLS_TEST_MUTEX_USAGE internally in the test - * framework (see tests/src/threading_helpers.c). + * framework (see framework/src/threading_helpers.c). */ const char *platform; diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl index a0dfc57bff..d0d18a30b5 100755 --- a/scripts/generate_visualc_files.pl +++ b/scripts/generate_visualc_files.pl @@ -25,10 +25,10 @@ my $programs_dir = 'programs'; my $mbedtls_header_dir = 'include/mbedtls'; my $psa_header_dir = 'include/psa'; my $source_dir = 'library'; -my $test_source_dir = 'tests/src'; +my $test_source_dir = 'framework/src'; my $test_header_dir = 'tests/include/test'; my $test_drivers_header_dir = 'tests/include/test/drivers'; -my $test_drivers_source_dir = 'tests/src/drivers'; +my $test_drivers_source_dir = 'framework/src/drivers'; my @thirdparty_header_dirs = qw( 3rdparty/everest/include/everest diff --git a/tests/include/test/constant_flow.h b/tests/include/test/constant_flow.h index c5658eb408..2aa5a99f9d 100644 --- a/tests/include/test/constant_flow.h +++ b/tests/include/test/constant_flow.h @@ -37,7 +37,7 @@ * * \note #TEST_CF_SECRET must be called directly from within a .function file, * not indirectly via a macro defined under tests/include or a function - * under tests/src. This is because we only run Valgrind for constant + * under framework/src. This is because we only run Valgrind for constant * flow on test suites that have greppable annotations inside them (see * `skip_suites_without_constant_flow` in `tests/scripts/all.sh`). */ diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index 3aabec41d4..d1413ac416 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -2172,7 +2172,7 @@ component_test_full_cmake_clang () { skip_suites_without_constant_flow () { # Skip the test suites that don't have any constant-flow annotations. # This will need to be adjusted if we ever start declaring things as - # secret from macros or functions inside tests/include or tests/src. + # secret from macros or functions inside tests/include or framework/src. SKIP_TEST_SUITES=$( git -C tests/suites grep -L TEST_CF_ 'test_suite_*.function' | sed 's/test_suite_//; s/\.function$//' | diff --git a/tests/scripts/generate_test_cert_macros.py b/tests/scripts/generate_test_cert_macros.py index a3bca7e6f6..7db8fdd5a2 100755 --- a/tests/scripts/generate_test_cert_macros.py +++ b/tests/scripts/generate_test_cert_macros.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ -Generate `tests/src/test_certs.h` which includes certficaties/keys/certificate list for testing. +Generate `framework/src/test_certs.h` which includes certficaties/keys/certificate list for testing. """ #