Skip to content

Commit bf4ec4a

Browse files
committed
CMake: Refactor lorawan unittest cmake
- Add CMakeLists.txt file to all lorawan test suite
1 parent 37d4bc2 commit bf4ec4a

File tree

20 files changed

+580
-0
lines changed

20 files changed

+580
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(features)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(lorawan)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(lorawaninterface)
5+
add_subdirectory(loraphyus915)
6+
add_subdirectory(loraphykr920)
7+
add_subdirectory(loraphyin865)
8+
add_subdirectory(loraphyeu868)
9+
add_subdirectory(loraphyeu433)
10+
add_subdirectory(loraphycn779)
11+
add_subdirectory(loraphycn470)
12+
add_subdirectory(loraphyau915)
13+
add_subdirectory(loraphyas923)
14+
add_subdirectory(loraphy)
15+
add_subdirectory(loramaccrypto)
16+
add_subdirectory(loramaccommand)
17+
add_subdirectory(loramacchannelplan)
18+
add_subdirectory(loramac)
19+
add_subdirectory(lorawantimer)
20+
add_subdirectory(lorawanstack)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loramac-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_ADR_ON=true
11+
MBED_CONF_LORA_PUBLIC_NETWORK=true
12+
MBED_CONF_LORA_NB_TRIALS=2
13+
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
14+
MBED_CONF_LORA_DUTY_CYCLE_ON=true
15+
MBED_CONF_LORA_MAX_SYS_RX_ERROR=10
16+
MBED_CONF_LORA_TX_MAX_SIZE=255
17+
MBED_CONF_LORA_DEVICE_ADDRESS=0x00000000
18+
)
19+
20+
target_compile_options(${TEST_NAME}
21+
PRIVATE
22+
"-DMBED_CONF_LORA_NWKSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
23+
"-DMBED_CONF_LORA_NWKSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
24+
"-DMBED_CONF_LORA_APPSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
25+
"-DMBED_CONF_LORA_APPSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}"
26+
)
27+
28+
target_sources(${TEST_NAME}
29+
PRIVATE
30+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMac.cpp
31+
Test_LoRaMac.cpp
32+
)
33+
34+
target_link_libraries(${TEST_NAME}
35+
PRIVATE
36+
mbed-headers
37+
mbed-stubs
38+
mbed-stubs-headers
39+
gmock_main
40+
)
41+
42+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
43+
44+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loramac-channel-plan-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_TX_MAX_SIZE=255
11+
)
12+
13+
target_sources(${TEST_NAME}
14+
PRIVATE
15+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacChannelPlan.cpp
16+
Test_LoRaMacChannelPlan.cpp
17+
)
18+
19+
target_link_libraries(${TEST_NAME}
20+
PRIVATE
21+
mbed-headers
22+
mbed-stubs
23+
mbed-stubs-headers
24+
gmock_main
25+
)
26+
27+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
28+
29+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loramac-command-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_TX_MAX_SIZE=255
11+
)
12+
13+
target_sources(${TEST_NAME}
14+
PRIVATE
15+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacCommand.cpp
16+
Test_LoRaMacCommand.cpp
17+
)
18+
19+
target_link_libraries(${TEST_NAME}
20+
PRIVATE
21+
mbed-headers
22+
mbed-stubs
23+
mbed-stubs-headers
24+
gmock_main
25+
)
26+
27+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
28+
29+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loramac-crypto-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_TX_MAX_SIZE=255
11+
)
12+
13+
target_sources(${TEST_NAME}
14+
PRIVATE
15+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/mac/LoRaMacCrypto.cpp
16+
Test_LoRaMacCrypto.cpp
17+
)
18+
19+
target_link_libraries(${TEST_NAME}
20+
PRIVATE
21+
mbed-headers
22+
mbed-stubs
23+
mbed-stubs-headers
24+
gmock_main
25+
)
26+
27+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
28+
29+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loraphy-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_WAKEUP_TIME=5
11+
MBED_CONF_LORA_DUTY_CYCLE_ON_JOIN=true
12+
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
13+
MBED_CONF_LORA_TX_MAX_SIZE=255
14+
MBED_CONF_LORA_NB_TRIALS=2
15+
)
16+
17+
target_sources(${TEST_NAME}
18+
PRIVATE
19+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHY.cpp
20+
Test_LoRaPHY.cpp
21+
)
22+
23+
target_link_libraries(${TEST_NAME}
24+
PRIVATE
25+
mbed-headers
26+
mbed-stubs
27+
mbed-stubs-headers
28+
gmock_main
29+
)
30+
31+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
32+
33+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loraphy-as923-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
11+
MBED_CONF_LORA_TX_MAX_SIZE=255
12+
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
13+
)
14+
15+
target_sources(${TEST_NAME}
16+
PRIVATE
17+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYAS923.cpp
18+
Test_LoRaPHYAS923.cpp
19+
)
20+
21+
target_link_libraries(${TEST_NAME}
22+
PRIVATE
23+
mbed-headers
24+
mbed-stubs
25+
mbed-stubs-headers
26+
gmock_main
27+
)
28+
29+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
30+
31+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
set(TEST_NAME lorawan-loraphy-au915-unittest)
5+
6+
add_executable(${TEST_NAME})
7+
8+
target_compile_definitions(${TEST_NAME}
9+
PRIVATE
10+
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5
11+
MBED_CONF_LORA_TX_MAX_SIZE=255
12+
MBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8
13+
)
14+
15+
target_compile_options(${TEST_NAME}
16+
PRIVATE
17+
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
18+
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}"
19+
)
20+
21+
target_sources(${TEST_NAME}
22+
PRIVATE
23+
${mbed-os_SOURCE_DIR}/connectivity/lorawan/lorastack/phy/LoRaPHYAU915.cpp
24+
Test_LoRaPHYAU915.cpp
25+
)
26+
27+
target_link_libraries(${TEST_NAME}
28+
PRIVATE
29+
mbed-headers
30+
mbed-stubs
31+
mbed-stubs-headers
32+
gmock_main
33+
)
34+
35+
add_test(NAME "${TEST_NAME}" COMMAND ${TEST_NAME})
36+
37+
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "lorawan")

0 commit comments

Comments
 (0)