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.
Move the header-only mbed-headers-hal library the unit test stubs
depend on into the hal component directory. This makes the events
stubs more self-contained and improves the composition of the library.
- Previously all cellular header made as a part of the
mbed-headers-connectivity library. To make it easier to separate all
the cellular headers into the separate mbed-headers-cellular library
and keep them as part of cellular stub CMake. This makes the cellular
stubs more self-contained and improves the composition of the library.
- Update all unit test that depends on cellular headers with mbed-headers-cellular library
Move the connectivity cellular into the connectivity/cellular component
directory. So we can avoid duplicating the mbed-os source tree in a
central UNITTESTS folder.
mbed-stubs-connectivity now depends on the mbed-stubs-rtos and
mbed-stubs-rtos-headers because it requires some headers and sources
which were moved to mbed-stubs-rtos and mbed-stubs-rtos-headers.
Move the header-only mbed-headers-rtos library the unit test stubs
depend on into the rtos component directory. This makes the rtos
stubs more self-contained and improves the composition of the library.
Move rtos stubs headers to the mbed-os/rtos/tests/UNITTESTS/double
directory and update CMake to create a mbed-stubs-rtos-headers
library for rtos stub headers
Move the header-only mbed-headers-drivers library the unit test stubs
depend on into the drivers component directory. This makes the drivers
stubs more self-contained and improves the composition of the library.
googletest now follows the "Abseil Live at HEAD" philosophy, which means
they recommend using the latest commit on the master branch and always
compiling from source. They recommend this to avoid version mismatch
issues and "diamond dependency" problems which are common in dependency
graphs with pinned versions. Google make the "promise" that future
changes won't break downstream code if it follows the "Abseil
compatability guidelines".
Upping the version to master also fixes some CMake configure time
warnings that were present with the older tagged releases of googletest:
CMake Deprecation Warning at __build/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at __build/_deps/googletest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at __build/_deps/googletest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Many test stub functions are meant to return a value, but weren't. Clang
would generate a warning for each instance where we weren't returning
anything in a function that was meant to return a value.
warning: non-void function does not return a value [-Wreturn-type]
For a specific example, my_radio::time_on_air() is supposed to return a
uint32_t, but wasn't returning anything. We'll return a zero instead of
relying on undefined behavior.
Without this, clang 11.0.1 was generating a virtual function
implementation with a `ud2` instruction to abort at run-time, causing
some execution of some unit tests to abort.
Running main() from gmock_main.cc
[==========] Running 10 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 10 tests from Test_LoRaPHYUS915
[ RUN ] Test_LoRaPHYUS915.constructor
[ OK ] Test_LoRaPHYUS915.constructor (0 ms)
[ RUN ] Test_LoRaPHYUS915.restore_default_channels
[ OK ] Test_LoRaPHYUS915.restore_default_channels (0 ms)
[ RUN ] Test_LoRaPHYUS915.rx_config
[ OK ] Test_LoRaPHYUS915.rx_config (0 ms)
[ RUN ] Test_LoRaPHYUS915.tx_config
Process 35669 stopped
* thread #1, name = 'lorawan-loraphy-', stop reason = signal SIGILL: privileged instruction
frame #0: 0x0000000000276f73 lorawan-loraphy-us915-unittest`my_radio::time_on_air(this=0x0000000800c2b048, modem=MODEM_LORA, pkt_len='\0') at Test_LoRaPHYUS915.cpp:90:5
87 };
88
89 virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len)
-> 90 {
91 };
92
93 virtual bool perform_carrier_sense(radio_modems_t modem,
(lldb) disassemble --pc
lorawan-loraphy-us915-unittest`my_radio::time_on_air:
-> 0x276f73 <+67>: ud2
0x276f75: int3
0x276f76: int3
0x276f77: int3
(lldb)
- Remove redundant cmake script as already added the CMake configuration file
- Remove redundant empty_baseline as it is no longer needed with the help of CMake configuration file
- Armclang is not working when we add gcov as target_link_libraries,
modified to pass as linker options with --coverage so it can work armclang and gcc
- Add a new MbedOS project in mbed os root CMake which can be used along with
BUILD_TESTING conditional check for enabling the unittest build
- Update UNITTEST CMake for setting the CMake configuration like c, cxx flags etc.,
- Add if CMAKE_CROSSCOMPILING conditional check wherever target configuration check
and toolchain configuration to avoid such configuration gets included for unittest build.
- Avoid using cmsis headers as it brings more redundant dependency into unittest build and for unittest build, all the required OS flags can provide from mbed rtos types header so replaced cmsis header with mbed os types header
```
connectivity
├── netsocket
├── lorawan
│ ├── mbed_lib.json // nanostack-interface's mbed_lib.json
│ ├── lorastack
│ ├── tests
├── nanostack
├── cellular
├── ...
```
This PR is a part of a wider \connectivity refactoring and implements the above new directory structure for \lorawan.
Note that documentation for random_max_start_delay config setting has
been changed to indicate that the setting is in seconds, and always has
been. No functional change.