Commit Graph

55 Commits (refactor_storage_greentea_cmake)

Author SHA1 Message Date
Robert Walton 5afc3f8efa CMake: Add option to enable greentea tests
Add an option to enable the greentea tests independently from the unit
tests.
2021-07-18 22:01:12 +01: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 cb343f9ba9 CMake: Update netsocket, cellular unittest to use mbed-stubs-netsocket
Update netsocket and cellular unit tests to link with a mbed-stubs-netsocket
library that it depends on instead of link with mbed-stubs
which is a group of stubs libraries.
2021-07-07 01:33:36 -07:00
Lingkai Dong 3a24305916 rtos: Remove UNITTEST macro from rtos
Production code should not contain any test-specific checks. Rather
than checking `UNITTEST`, unit tests can directly set
`MBED_CONF_RTOS_PRESENT=1` to make RTOS available for testing.

Note: The cellular ATHandler test also has `MBED_CONF_RTOS_PRESENT=1`
added because `ATHandler.cpp` contains a check of this variable.
2021-07-06 16:50:49 +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
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
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
Rajkumar Kanagaraj d8add9e1a1 CMake: unit-tests: Make cellular stub only depend on headers it uses
Previously the connectivity cellular stub library depended on
`mbed-headers`, which is a collection of all available headers
in mbed-os. To make it easier to separate the library, only depend
on the headers we're using.
2021-06-30 06:01:42 -07:00
Rajkumar Kanagaraj ee67310922 CMake: unit-tests: Add mbed-headers-cellular headers 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
2021-06-30 06:01:42 -07:00
Rajkumar Kanagaraj fa0ab53692 CMake: Move connectivity/cellular stubs to the mbed-os/connectivity/cellular dir
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.
2021-06-30 06:01:42 -07:00
Martin Kojtal 8902a0c866
Merge pull request #14819 from ARMmbed/move_rtos_stubs
Move rtos stubs to the rtos directory
2021-06-30 11:49:41 +02:00
Martin Kojtal 16acae3bd0
Merge pull request #14716 from boraozgen/at-handler-buffer-size-config
Cellular: Add AT handler buffer size to configuration
2021-06-29 11:29:48 +02:00
Rajkumar Kanagaraj 8efb322e15 CMake: unit-tests: Update connectivity stubs and their unittests
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.
2021-06-28 06:31:37 -07:00
Bora Özgen 8705a6a510 Cellular: Add AT handler buffer size to configuration 2021-06-15 15:03:57 +02:00
Robert Walton a0befae2d4 CMake: Only build unit tests if Mbed OS is the current project
Typically when adding a unit test directory to a CMake project a check
will be used to ensure the subdirectory is added only if the following
are true:

* The BUILD_TESTING option is set to ON.
* The current CMake project is the top-level project.

The reason being, if a downstream project includes our project they
generally don't want to build our unit tests.

In mbed-os, we do correctly specify the above condition before adding
the central UNITTEST subdirectory, which fetches googletest and adds the
"stub" libraries the unit tests depend on. However, we only check if
CMAKE_CROSSCOMPILING is OFF (or undefined) before actually adding the
unit tests. This mismatched logic would lead to unexpected build
failures in various scenarios. One likely case could be: a downstream
project including mbed-os happens to set CMAKE_CROSSCOMPILING to
OFF/undefined for any reason (possibly to build its own unit tests).
mbed-os would go ahead and attempt to build its tests without fetching
googletest or adding the required stub targets.

To fix the issue replace the check for CMAKE_CROSSCOMPILING in the unit
tests with the same BUILD_TESTING idiom we use for adding the central
UNITTESTS subdirectory.
2021-06-10 23:34:14 +01:00
Martin Kojtal bc7fc2b2e7
Merge pull request #14708 from Patater/fix-test-function-return
test: Fix function does not return a value warnings
2021-05-31 12:20:00 +02:00
Jaeden Amero 8ce03867c2 test: at: Remove dead code
Remove two expressions from at_cellularcontexttest that do nothing. This
fixes the following two warnings.

    connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp:61:67: warning: expression result unused [-Wunused-value]            ATHandler_stub::int_valid_count_table[kRead_int_table_size];                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~^
    connectivity/cellular/tests/UNITTESTS/framework/AT/at_cellularcontext/at_cellularcontexttest.cpp:64:66: warning: expression result unused [-Wunused-value]            ATHandler_stub::read_string_table[kRead_string_table_size];
2021-05-27 09:38:18 +01:00
Jaeden Amero 7f7571657e test: Fix function does not return a value warnings
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)
2021-05-27 09:38:18 +01:00
Rajkumar Kanagaraj 50fc85dc44 CMake: Remove all unittest.cmake script from test suite
- 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
2021-05-26 07:09:14 -07:00
Rajkumar Kanagaraj f096b3b3c3 Fix missing newline 2021-05-11 04:22:26 -07:00
Paul Szczepanek 452c45b37a CMake: Update target_h stub headers
- 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
2021-05-11 02:29:56 -07:00
Rajkumar Kanagaraj 37d4bc2d9e CMake: Refactore cellular framework unittest
- Add CMake configuration file into framework AT, device, common
unittest
2021-05-11 02:29:56 -07:00
Rajkumar Kanagaraj ba04c1cf76 CMake: Add add_subdirectory of unittests
- add every libraries unittest directory into respective CMake
  which allows to include unittest source into build based on
  MBED_BUILD_UNITTESTS flag
2021-05-11 02:29:56 -07:00
jeromecoutant 8e58d64e13 Remove Cellular dependency in netsocket
Tip: Create a .mbedignore file with

connectivity/cellular*
connectivity/drivers/cellular*
2020-12-03 18:16:33 +01:00
Hugues Kamba 794e32df74 CMake: Use relative paths to list source files and directories
The absolute path is still required for listing linker
files as they are referenced from a function in the top
level CMake input source file.
2020-11-09 12:32:30 +00:00
Hugues Kamba bf84a5b329 CMake: Rename CMake targets
* mbed-os renamed mbed-core
* mbed-os-<COMPONENT> renamed mbed-<COMPONENT>
2020-11-06 17:25:22 +00:00
Hugues Kamba fa98689639 CMake: Componentize Mbed OS into multiple CMake targets (#13732)
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
2020-11-06 17:25:21 +00:00
Hugues Kamba bd45acba8c CMake: Fix failure due to kvstore and cellular dirs changes 2020-11-06 17:25:16 +00:00
Martin Kojtal 61aa6817f0
Merge pull request #13724 from harmut01/license_refactor
Add license notice to Arm copyrighted source files
2020-10-16 09:09:53 +01:00
Harrison Mutai 4fad1112e5 Add SPDX license identifier to Arm files
Add license identifier to files which Arm owns the copyright to,
and contain either BSD-3 or Apache-2.0 licenses. This is to address
license errors raised by scancode analysis.
2020-10-15 10:47:27 +01:00
Martin Kojtal 05489818e9
Merge pull request #13610 from boraozgen/bugfix/deactivate-context
Fix #13490 Cellular disconnect does not deactivate context
2020-10-13 11:22:33 +01:00
Bora Özgen 0604c49a2e Apply suggestion from review 2020-09-23 16:04:23 +02:00
Bora Özgen 9f24c045d7 Apply astyle 2020-09-21 14:37:56 +02:00
Bora Özgen 8483d59879 Fix #13490 Cellular disconnect does not deactivate context
(for some cases)
2020-09-10 16:19:31 +02:00
Martin Kojtal b2ac60924c
Merge pull request #13476 from talorion/bugfix/fix-warnings
Fix trivial compiler Warnings
2020-09-07 09:58:41 +01:00
Lingkai Dong d6a2269de3 Restructure platform/randlib
* Move mbed-client-randlib/ headers into include/
  (Note: we don't rename it to "randlib" because this library
   is mirrored to https://github.com/ARMmbed/mbed-client-randlib,
   and "mbed-client-randlib" may be reference by some projects)
* Move the standalone local unit test into tests/unit
2020-09-02 12:31:00 +01:00
Lingkai Dong 9b1e0a38fe Move mbed-client-randlib -> platform/randlib 2020-09-02 12:31:00 +01:00
talorion d11ce60d83 fixed warnings: printf format missmatch 2020-08-24 11:55:23 +02:00
talorion fcb81d3015 fixed warnings: comparison of integer expressions of different signedness 2020-08-24 11:55:23 +02:00
George Psimenos 76f37fb2bc Restructure events directory & move tests 2020-07-28 09:17:19 +01:00
Rajkumar Kanagaraj a4c1071c5b Apply suggestions from code review
Commit the reviewer suggestions

Co-authored-by: Lingkai Dong <lingkai.dong@arm.com>
2020-07-23 06:24:04 -07:00
Rajkumar Kanagaraj 21325e281a Update netsocket header and source reference in other libraries 2020-07-23 06:22:15 -07:00
Rajkumar Kanagaraj 354bfaa840 Update header reference 2020-07-23 06:15:13 -07:00
Lingkai Dong 22ea1e8846 Update unittest.cmake files for cellular 2020-07-22 11:06:23 +01:00