CMake: Refactor lorawan unittest cmake

- Add CMakeLists.txt file to all lorawan test suite
pull/14426/head
Rajkumar Kanagaraj 2021-03-02 07:28:56 -08:00
parent 37d4bc2d9e
commit bf4ec4a290
20 changed files with 580 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(features)

View File

@ -0,0 +1,4 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(lorawan)

View File

@ -0,0 +1,20 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(lorawaninterface)
add_subdirectory(loraphyus915)
add_subdirectory(loraphykr920)
add_subdirectory(loraphyin865)
add_subdirectory(loraphyeu868)
add_subdirectory(loraphyeu433)
add_subdirectory(loraphycn779)
add_subdirectory(loraphycn470)
add_subdirectory(loraphyau915)
add_subdirectory(loraphyas923)
add_subdirectory(loraphy)
add_subdirectory(loramaccrypto)
add_subdirectory(loramaccommand)
add_subdirectory(loramacchannelplan)
add_subdirectory(loramac)
add_subdirectory(lorawantimer)
add_subdirectory(lorawanstack)

View File

@ -0,0 +1,44 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loramac-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_ADR_ON=true
MBED_CONF_LORA_PUBLIC_NETWORK=true
MBED_CONF_LORA_NB_TRIALS=2
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_DUTY_CYCLE_ON=true
MBED_CONF_LORA_MAX_SYS_RX_ERROR=10
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_DEVICE_ADDRESS=0x00000000
)
target_compile_options(${TEST_NAME}
PRIVATE
"-DMBED_CONF_LORA_NWKSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
"-DMBED_CONF_LORA_NWKSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
"-DMBED_CONF_LORA_APPSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
"-DMBED_CONF_LORA_APPSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMac.cpp
Test_LoRaMac.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,29 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loramac-channel-plan-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacChannelPlan.cpp
Test_LoRaMacChannelPlan.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,29 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loramac-command-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacCommand.cpp
Test_LoRaMacCommand.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,29 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loramac-crypto-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacCrypto.cpp
Test_LoRaMacCrypto.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,33 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_WAKEUP_TIME=5
MBED_CONF_LORA_DUTY_CYCLE_ON_JOIN=true
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_NB_TRIALS=2
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHY.cpp
Test_LoRaPHY.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-as923-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYAS923.cpp
Test_LoRaPHYAS923.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,37 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-au915-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_compile_options(${TEST_NAME}
PRIVATE
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYAU915.cpp
Test_LoRaPHYAU915.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,37 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-cn470-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_compile_options(${TEST_NAME}
PRIVATE
"-DMBED_CONF_LORA_FSB_MASK_CHINA={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
"-DMBED_CONF_LORA_FSB_MASK_CHINA={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYCN470.cpp
Test_LoRaPHYCN470.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-cn779-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYCN779.cpp
Test_LoRaPHYCN779.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-eu433-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYEU433.cpp
Test_LoRaPHYEU433.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-eu868-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYEU868.cpp
Test_LoRaPHYEU868.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-in865-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYIN865.cpp
Test_LoRaPHYIN865.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-kr920-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYKR920.cpp
Test_LoRaPHYKR920.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,37 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-loraphy-us915-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
MBED_CONF_LORA_TX_MAX_SIZE=255
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
)
target_compile_options(${TEST_NAME}
PRIVATE
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYUS915.cpp
Test_LoRaPHYUS915.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,30 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-lorawan-interface-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_PHY=EU868
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/source/LoRaWANInterface.cpp
Test_LoRaWANInterface.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,31 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-lorawan-stack-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
MBED_CONF_LORA_OVER_THE_AIR_ACTIVATION=true
MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE=true
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/source/LoRaWANStack.cpp
Test_LoRaWANStack.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

View File

@ -0,0 +1,30 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(TEST_NAME lorawan-lorawan-timer-unittest)
add_executable(${TEST_NAME})
target_compile_definitions(${TEST_NAME}
PRIVATE
NDEBUG=1
MBED_CONF_LORA_TX_MAX_SIZE=255
)
target_sources(${TEST_NAME}
PRIVATE
${mbed-os_SOURCE_DIR}/connectivity/lorawan/system/LoRaWANTimer.cpp
Test_LoRaWANTimer.cpp
)
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs
mbed-stubs-headers
gmock_main
)
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")