Commit Graph

640 Commits (15a17dc0533f937c96cdb1f114f29313c69ab7c1)

Author SHA1 Message Date
Lingkai Dong dca2aa79a0 Unit tests: Remove redundant CMake target mbed-headers-base
Individual libraries' `target_h` stub headers have now all been moved
from `mbed-headers-base` to `mbed-headers-<library>`.

Note: Even though headers previously in `target_h` are technically
stubs/fakes too, they are used by not only unit tests but also regular
libraries when compiled for unit tests, because no target-specific HAL
implementation exists in this case. In order for regular library
sources to pick up `target_h` headers, those headers must

* have the same names as regular headers
* appear first in include paths

This is why those headers are part of `mbed-headers-<library>` and not
`mbed-stubs-<library>`. Before this refactoring, `mbed-headers-base`
was the first in unit tests' include paths.
2021-08-02 17:42:43 +01:00
Lingkai Dong 825e3491b0 Unit tests: Move hal target_h stubs
Stubs previously in UNITTESTS/target_h/ have the same names as
regular Mbed OS headers, intending to override the latter directly.
We move hal target_h stubs into hal/tests/UNITTESTS/doubles/.

Note: In Mbed OS, the standard include format requires each header to
be prefixed with its module name, for example "hal/gpio_api.h". This
requires headers to be organized in a module directory. But unit tests
stubs for hal correspond to what a real Mbed target would have
implemented (in a non-test scenario), and targets do not currently put
headers in hal/, so we similary put stub headers directly in
hal/tests/UNITTESTS/doubles/ instead of add a hal/ subdirectory there.
2021-08-02 17:42:43 +01:00
Lingkai Dong c775e30b2d Unit tests: Move randLIB.h
The stub header randLIB.h overrides the header of the same name in
platform/randlib/ which is an external repository vendored into
the mbed-os codebase. As the repository is synchronized regularly,
it is better not to put overrides there, so we put the randLIB.h
stub into the regular platform doubles directory.
2021-08-02 17:42:43 +01:00
Lingkai Dong e75a45d041 Unit tests: Move drivers target_h stubs 2021-08-02 17:42:43 +01:00
Lingkai Dong 1f99729474 Unit tests: Move rtos target_h stubs 2021-08-02 17:42:42 +01:00
Lingkai Dong 71962481a4 Unit tests: Remove mbed.h stub from target_h
The header `mbed.h` is a convenient wrapper that pre-includes some
platform headers, for use by user applications. Libraries and tests
internal to Mbed OS should not use it, and they should explicitly
include headers they need. So a stub is not needed.
2021-08-02 17:42:42 +01:00
Lingkai Dong 4011e2ef85 Unit tests: Move platform target_h stubs
Stubs previously in UNITTESTS/target_h/ have the same names as
regular Mbed OS headers, intending to override the latter directly.
We move platform target_h stubs into
platform/tests/UNITTESTS/doubles/platform/.

Note: nvic_wrapper.h is normally implemented and used by Mbed targets
as needed. But as unit tests do not have a real target, we treat it
as a stub for the platform.
2021-08-02 17:42:42 +01:00
Lingkai Dong 7e3565b5f5 Unit tests: Move cmsis target_h stubs
This creates a new mbed-headers-cmsis which is always and only used
by mbed-headers-platform, so we add the former to the laters' linked
targets.
2021-08-02 17:42:42 +01:00
Lingkai Dong 57dd6812c3 Unit tests: Move cellular target_h stubs
We move test-specific files from the top-level UNITTESTS directory
into individual components' UNITTESTS/doubles subdirectories.
2021-08-02 13:47:57 +01:00
Lingkai Dong dcc240d578 Unit tests: Remove unused syslimits.h 2021-08-02 13:47:57 +01:00
Lingkai Dong 34656e8a92 Unit tests: Remove unused nsapi_ppp.h stub 2021-08-02 13:47:57 +01:00
Lingkai Dong 56d7bb9941 Unit tests: Remove unused arm_math.h 2021-08-02 13:47:57 +01:00
Rajkumar Kanagaraj 9df7a50f39 CMake: Move ble fakes into FEATURE_BLE double dir
Previously ble fakes as part of UNITTESTS/fakes, this PR moves
ble fakes to FEATURE_BLE double directory to make ble stubs
to be self-contained.
2021-07-21 01:56:29 -07:00
Rajkumar Kanagaraj 1b5f5970a2 CMake: fakes ble: Remove trailing whitespace 2021-07-21 01:56:29 -07:00
Rajkumar Kanagaraj a61392ae30 CMake: Create mbed-headers-ble library
Previously ble headers are part of mbed-headers-connectivity, this PR
moves ble headers into new mbed-headers-ble to make ble stubs to be
more self-contained and improves the composition of the library.
2021-07-21 01:51:48 -07:00
Rajkumar Kanagaraj 22b2e9f800 CMake: Add mbed-headers-nanostack-libservice library
Previously all nanostack libservice headers part of
mbed-headers-connectivity. This PR moves all the nanostack
libservice headers into newly added mbed-headers-nanostack-libraries.
This makes the nanostack libservice stubs more self-contained and
improves the composition of the library.
2021-07-13 05:49:53 -07:00
Rajkumar Kanagaraj d95bf96bbf CMake: Move nanostack libservice stubs to the connectivity/libraries dir
Move the connectivity nanostack-libservice stubs into the connectivity/libraries
directory where the nanostack libservice component present as nanostack
libservice source copied from the external repo. So we can avoid duplicating
the mbed-os source tree in a central UNITTESTS folder.
2021-07-13 05:49:53 -07:00
Rajkumar Kanagaraj d57ed8d95a CMake: Move mbedtls stub headers to the mbedtls doubles dir
Previously all the mbedtls stubs headers under mbed-stubs-headers,
so this PR move all mbedtls stubs headers under
mbedtls/tests/UNITTESTS/double directory and update CMake to include
stubs headers into mbed-stubs-mbedtls library to make mbedtls stubs
to be self-contained.
2021-07-12 07:19:04 -07:00
Rajkumar Kanagaraj ef7699d824 CMake: Update netsocket, lorawan unittest to use mbed-stubs-mbedtls
Update netsocket and lorawan unit tests to link with a mbed-stubs-mbedtls
library that it depends on instead of link with mbed-stubs
which is a group of stubs libraries.
2021-07-12 07:18:41 -07:00
Rajkumar Kanagaraj 66019cb80e CMake: Move mbedtls stubs to the mbedtls dir
Move the connectivity mbedtls stubs into the connectivity/mbedtls
component directory. So we can avoid duplicating the mbed-os source
tree in a central UNITTESTS folder.
2021-07-12 07:18:41 -07:00
Martin Kojtal 3c2c5be298
Merge pull request #14824 from paul-szczepanek-arm/persistence-fix
BLE: Manual BLE security manager db synchronisation
2021-07-12 13:51:50 +02:00
Rajkumar Kanagaraj 863ef79ed4 CMake: Move events fakes into events double dir
Previously events fakes as part of UNITTESTS/fakes, this PR moves
events fakes to events double directory to make events stubs
to be self-contained.
2021-07-09 02:56:26 -07:00
Rajkumar Kanagaraj 99e16c2ff0 Remove trailing space 2021-07-09 02:56:26 -07:00
Rajkumar Kanagaraj 447754f6cf CMake: Move events stub headers to the events/tests/UNITTESTS/double dir
Move events stubs headers to the mbed-os/events/tests/UNITTESTS/double
directory and update double CMake to include stub headers
2021-07-09 02:56:26 -07:00
Rajkumar Kanagaraj 65d202b93b CMake: unit-tests: Move mbed-headers-events to the events directory
Move the header-only mbed-headers-events library the unit test stubs
depend on into the events component directory. This makes the events
stubs more self-contained and improves the composition of the library.
2021-07-09 02:56:26 -07:00
Rajkumar Kanagaraj 88410a5f85 CMake: Move events stubs sources to the mbed-os/events directory
Move the events stub into the events component directory.
so we can avoid duplicating the mbed-os source tree in a central
UNITTESTS folder.
2021-07-09 02:56:26 -07:00
Rajkumar Kanagaraj bb3cd37a5e CMake: Remove mbed-stubs-rtos-headers library
- Previous changes moved all rtos stubs headers into mbed-stubs-rtos-headers
lib, but the decision to keep all stubs headers under the respective
component stubs library so moved all stubs rtos headers under
mbed-stubs-rtos and updated it depend component CMake
- Remove unnecessary add_definition call for UNITTEST as any of the stubs library
added from UNITTEST/CMakeLists.txt is not required this macro
2021-07-08 07:14:56 -07:00
Martin Kojtal feb48fca2b
Merge pull request #14873 from ARMmbed/move_connectivity_netsocket_stubs
Move connectivity netsocket stubs
2021-07-07 17:45:47 +02:00
Jaeden Amero 8287c5221b
Merge pull request #14773 from rwalton-arm/move_platform_stub
Move mbed-stubs-platform to the platform directory
2021-07-07 16:33:35 +01:00
Jaeden Amero dc6dd17bb0
Merge pull request #14884 from LDong-Arm/rm_UNITTEST_macro
Remove the `UNITTEST` macro from production code
2021-07-07 15:20:31 +01:00
Martin Kojtal fea4e928d0
Merge pull request #14835 from ARMmbed/move_stubs_cellular_headers
Move stubs cellular headers
2021-07-07 11:29:37 +02:00
Rajkumar Kanagaraj ef0e3f99e4 CMake: Move netsocket stub headers to the netsocket doubles dir
Previously all the netsocket stubs headers under mbed-stubs-headers,
so this PR move all netsocket stubs headers under
netsocket/tests/UNITTESTS/double directory and update CMake to include
stubs headers into mbed-stubs-netsocket library to make netsocket stubs
to be self-contained.
2021-07-07 01:33:36 -07:00
Rajkumar Kanagaraj 68b46f6199 CMake: Add mbed-headers-netsocket headers library
- Previously, all netsocket headers made as a part of the
mbed-headers-connectivity library. To make it easier to separate all
the netsocket headers into the separate mbed-headers-netsocket library
and keep them, as part of netsocket stubs CMake. This makes the
netsocket stubs more self-contained and improves the composition of the library.
- Update cellular, netsocket unit tests to link only with a mbed-headers-netsocket
library that it depends on instead of link with mbed-headers
which is a group of headers libraries.
2021-07-07 01:33:36 -07:00
Rajkumar Kanagaraj 5433365b81 CMake: Move netsocket stubs to the netsocket dir
Move the connectivity netsocket stubs into the connectivity/netsocket
component directory. So we can avoid duplicating the mbed-os source
tree in a central UNITTESTS folder.
2021-07-07 01:33:36 -07:00
Martin Kojtal 44d5416785
Merge pull request #14842 from ARMmbed/move_connectivity_lora_stubs
Move connectivity lora stubs
2021-07-07 09:54:58 +02:00
Lingkai Dong dd81b536da Unit tests: Update <mstd_type_traits> stub
The stub version of <mstd_type_traits> is mostly identical to the
production file of the same name, except the former lags behind
and doesn't contain the recent "is_constant_evaluated" feature.
It's safe to update the stub file, because "is_constant_evaluated"
only checks generic GCC and Clang versions that also apply to
compilers on PCs.

This enables MbedCRC.h to include <mstd_type_traits> without
distinguishing between Mbed applications and unit tests.
2021-07-06 17:19:19 +01:00
Lingkai Dong eb6d1aa03e Unit tests: Remove `#ifndef UNITTEST` from the mbed_assert.h stub
The stub version of mbed_assert.h is never used outside unit tests,
so the check on `UNITTEST` is redundant.
2021-07-06 16:58:06 +01:00
Robert Walton 021baa68e7 CMake: unit-tests: Split platform headers out of mbed-stubs-headers
We have a central collection of "stub headers", which makes reasoning
about dependencies rather difficult, as it forces every stub library to
depend on all available stub headers. The standard approach would be for
each stub library to expose its public headers, and its dependents to
explicitly specify a dependency on the stub library containing the
headers it needs. This is a more modular design than creating a
header-only monolith library. Move the platform stub headers from this
central library into the mbed-stubs-platform library to increase
modularity.

mbed-stubs-connectivity now depends on the mbed-stubs-platform because
it requires some headers which were moved to mbed-stubs-platform.
2021-07-06 13:50:46 +01:00
Robert Walton e2704749f1 CMake: unit-tests: Move mbed-headers-platform to platform directory
Move the header-only mbed-headers-platform library the unit test stubs
depend on into the platform component directory. This makes the platform
stubs more self contained and improves composition of the library.
2021-07-06 13:50:46 +01:00
Robert Walton 40435fd9b3 CMake: Move platform stubs to the mbed-os/platform directory
Move the platform stub library into the platform component directory.
This change is so we can avoid duplicating the mbed-os source tree in a
central UNITTESTS folder.
2021-07-06 13:50:42 +01:00
Lingkai Dong f8e3f71ea5 Unit tests: Remove mbed-headers-storage 2021-07-02 16:29:41 +01:00
Lingkai Dong e1331d5873 Unit tests: Create mbed-headers-kvstore
Create a CMake target mbed-headers-kvstore to separate KVStore headers
from the generic mbed-headers-storage. Update tests to use it.
2021-07-02 16:27:00 +01:00
Lingkai Dong 7c74d31c57 Unit tests: Create mbed-headers-filesystem
Create a CMake target mbed-headers-filesystem to separate FileSystem
headers from the generic mbed-headers-storage. Update tests to use it.
2021-07-02 16:25:43 +01:00
Lingkai Dong 90446a0345 Unit tests: Create mbed-headers-blockdevice
Create a CMake target mbed-headers-blockdevice to separate BlockDevice
headers from the generic mbed-headers-storage. Update tests to use it.
2021-07-02 16:25:00 +01:00
Rajkumar Kanagaraj a60869da85 CMake: Move cellular stub headers to the cellular/tests/UNITTESTS/double dir
Previously all the stubs headers under mbed-stubs-headers,
so this PR move all cellular stubs headers under
cellular/tests/UNITTESTS/double directory and update CMake
to include headers into mbed-stubs-cellular library to make
cellular stubs to be self-contained
2021-07-02 06:30:32 -07:00
Lingkai Dong b1645b2afa Move storage stubs into subdirectories of Mbed OS storage
Move storage stubs from UNITTESTS/stubs into components inside the
top-level storage directory. Specifically,
* storage/blockdevice/tests/UNITTESTS/doubles/ for BlockDevice stubs.
* storage/kvstore/filesystemstore/tests/UNITTESTS/ for a stub used by
the FileSystemStore test. The stub has been renamed from
kv_config_stub.cpp to filesystemstore_kv_config_stub.cpp, to make it
evident why it doesn't go into storage/kvstore/kv_config/.
2021-07-02 13:44:28 +01:00
Lingkai Dong 71b179d12d Unit tests: Remove unused EmulatedSD 2021-07-02 13:44:28 +01:00
Rajkumar Kanagaraj 46d4247b58 CMake: Move lorawan stub headers to the lorawan/tests/UNITTESTS/double dir
Previously all the lorawan stubs headers under mbed-stubs-headers,
so this PR move all lorawan stubs headers under
cellular/tests/UNITTESTS/double directory and update CMake to include
stubs headers into mbed-stubs-lorawan library to make lorawan stubs to be self-contained
2021-07-02 05:06:09 -07:00
Rajkumar Kanagaraj 8c580489f6 CMake: unit-tests: Add mbed-headers-lorawan headers library
Previously, all lorawan headers made as a part of the
mbed-headers-connectivity library. To make it easier to separate all
the lorawan headers into the separate mbed-headers-lorawan library
and keep them, as part of lorawan stubs CMake. This makes the lorawan
stubs more self-contained and improves the composition of the library.
2021-07-02 05:06:09 -07:00
Rajkumar Kanagaraj 8f238f13b1 CMake: Move lorawan stubs to the lorawan dir
Move the connectivity lorawan stubs into the connectivity/lorawan
component directory. So we can avoid duplicating the mbed-os source
tree in a central UNITTESTS folder.
2021-07-02 05:06:09 -07:00