Skip to content

Commit 3a24305

Browse files
committed
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.
1 parent 8d3fc33 commit 3a24305

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

connectivity/cellular/tests/UNITTESTS/framework/device/athandler/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ target_compile_definitions(${TEST_NAME}
1313
DEVICE_INTERRUPTIN=1
1414
MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=115200
1515
MBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32
16+
MBED_CONF_RTOS_PRESENT=1
1617
)
1718

1819
target_sources(${TEST_NAME}

rtos/include/rtos/Thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "rtos/Semaphore.h"
3434
#include "rtos/Mutex.h"
3535

36-
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) || defined(UNITTEST)
36+
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
3737

3838
namespace rtos {
3939
/** \addtogroup rtos-public-api */

rtos/include/rtos/internal/mbed_rtos1_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef MBED_RTOS_RTX1_TYPES_H
1818
#define MBED_RTOS_RTX1_TYPES_H
1919

20-
#if MBED_CONF_RTOS_PRESENT || defined(UNITTEST)
20+
#if MBED_CONF_RTOS_PRESENT
2121

2222
#include "cmsis_os.h"
2323

rtos/include/rtos/internal/mbed_rtos_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef MBED_RTOS_STORAGE_H
1818
#define MBED_RTOS_STORAGE_H
1919

20-
#if MBED_CONF_RTOS_PRESENT || defined(UNITTEST)
20+
#if MBED_CONF_RTOS_PRESENT
2121

2222
#include "mbed_rtx_storage.h"
2323

rtos/include/rtos/mbed_rtos_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef RTOS_TYPES_H_
1818
#define RTOS_TYPES_H_
1919

20-
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) || defined(UNITTEST)
20+
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
2121
#include "cmsis_os2.h"
2222
#else
2323

rtos/tests/UNITTESTS/doubles/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ target_include_directories(mbed-stubs-rtos-headers
1818

1919
add_library(mbed-stubs-rtos)
2020

21-
add_definitions(-DUNITTEST)
21+
target_compile_definitions(mbed-stubs-rtos
22+
PRIVATE
23+
MBED_CONF_RTOS_PRESENT=1
24+
)
2225

2326
target_sources(mbed-stubs-rtos
2427
PRIVATE

0 commit comments

Comments
 (0)