Skip to content

Move unittest paths to hyphens #8066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions UNITTESTS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mbed test --unittests

A subset of tests can be run by providing `-r` flag for the tool which runs tests matching a regular expression.

e.g. `mbed test --unittests --run -r features_netsocket`
e.g. `mbed test --unittests --run -r features-netsocket`

### Build manually without Python tools

Expand All @@ -105,7 +105,7 @@ mingw32-make

#### Custom CMake variables

Usage:
Usage:
`cmake [RELATIVE PATH TO UNITTESTS DIR] [OPTIONS]`

Keyword variables (usage `cmake -D<VARIABLE>(:<TYPE>)=<value>`:
Expand Down Expand Up @@ -157,17 +157,17 @@ mkdir UNITTESTS/build
cd UNITTESTS/build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE:STRING=html ..
make
./features_netsocket_InternetSocket
gcovr -r ../.. --html --html-detail -o ./index.html ./CMakeFiles/features_netsocket_InternetSocket.MbedOS.dir/
./features-netsocket-InternetSocket
gcovr -r ../.. --html --html-detail -o ./index.html ./CMakeFiles/features-netsocket-InternetSocket.MbedOS.dir/
```
Windows:
```
mkdir UNITTESTS/build
cd UNITTESTS/build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE:STRING=html -g "MinGW Makefiles" ..
mingw32-make
features_netsocket_InternetSocket.exe
gcovr -r ..\.. --html --html-detail -o .\index.html .\CMakeFiles\features_netsocket_InternetSocket.MbedOS.dir\
features-netsocket-InternetSocket.exe
gcovr -r ..\.. --html --html-detail -o .\index.html .\CMakeFiles\features-netsocket-InternetSocket.MbedOS.dir\
```

## The structure of unit tests
Expand Down Expand Up @@ -203,7 +203,7 @@ Each class to be tested requires two files for unit testing:

A unit test definition file `unittest.cmake` requires variables to be set for a test to be configured. File source paths in `unittest.cmake` files need to be relative to the unit test folder and `CMakeLists.txt`.

* **TEST_SUITE_NAME** - Identifier for the test suite. Use naming convention *PATH_TO_THE_TESTABLE_FILE* e.g. *features_netsocket_InternetSocket*
* **TEST_SUITE_NAME** - Identifier for the test suite. Use naming convention *PATH_TO_THE_TESTABLE_FILE* e.g. *features-netsocket-InternetSocket*
* **unittest-includes** - Include paths for headers needed to build the tests in addition to the base include paths listed in [CMakeLists.txt](CMakeLists.txt). Optional.
* **unittest-sources** - Mbed OS source files and stubs included for the build.
* **unittest-test-sources** - Unit test source files.
Expand All @@ -225,7 +225,7 @@ For example to create a unit test for `rtos/Semaphore.cpp`:
1. Create a directory for unit test files in `UNITTESTS/rtos/Semaphore`.
2. Create a test definition file `UNITTESTS/rtos/Semaphore/unittest.cmake` with the following content:
```
set(TEST_SUITE_NAME "rtos_Semaphore")
set(TEST_SUITE_NAME "rtos-Semaphore")

set(unittest-sources
stubs/mbed_assert.c
Expand Down Expand Up @@ -291,4 +291,4 @@ TEST_F(TestSemaphore, constructor)

**Problem:** virus protection identifies files generated by CMake as malicious and quarantines the files on Windows.

* **Solution**: restore the false positive files from the quarantine.
* **Solution**: restore the false positive files from the quarantine.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "cellular_framework_AT_AT_CellularBase")
set(TEST_SUITE_NAME "cellular-framework-AT-AT_CellularBase")

# Add test specific include paths
set(unittest-includes ${unittest-includes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "cellular_framework_common_util")
set(TEST_SUITE_NAME "cellular-framework-common-util")

# Add test specific include paths
set(unittest-includes ${unittest-includes}
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/features/netsocket/InternetSocket/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "features_netsocket_InternetSocket")
set(TEST_SUITE_NAME "features-netsocket-InternetSocket")

set(unittest-sources
../features/netsocket/SocketAddress.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "features_netsocket_NetworkInterface")
set(TEST_SUITE_NAME "features-netsocket-NetworkInterface")

# Source files
set(unittest-sources
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/features/netsocket/TCPSocket/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "features_netsocket_TCPSocket")
set(TEST_SUITE_NAME "features-netsocket-TCPSocket")

set(unittest-sources
../features/netsocket/SocketAddress.cpp
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/features/netsocket/UDPSocket/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "features_netsocket_UDPSocket")
set(TEST_SUITE_NAME "features-netsocket-UDPSocket")

set(unittest-sources
../features/netsocket/SocketAddress.cpp
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/platform/CircularBuffer/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
####################

# Unit test suite name
set(TEST_SUITE_NAME "platform_CircularBuffer")
set(TEST_SUITE_NAME "platform-CircularBuffer")

set(unittest-sources
)
Expand Down