|
1 | 1 | # |
2 | | -# Copyright (c) 2021, The OpenThread Authors. |
| 2 | +# Copyright (c) 2025, The OpenThread Authors. |
3 | 3 | # All rights reserved. |
4 | 4 | # |
5 | 5 | # Redistribution and use in source and binary forms, with or without |
|
28 | 28 |
|
29 | 29 | set(COMMON_INCLUDES |
30 | 30 | ${PROJECT_SOURCE_DIR}/include |
| 31 | + ${PROJECT_SOURCE_DIR}/src |
31 | 32 | ${PROJECT_SOURCE_DIR}/src/core |
| 33 | + ${PROJECT_SOURCE_DIR}/tests/nexus |
32 | 34 | ) |
33 | 35 |
|
34 | 36 | set(COMMON_COMPILE_OPTIONS |
35 | 37 | -DOPENTHREAD_FTD=1 |
36 | 38 | -DOPENTHREAD_MTD=0 |
37 | 39 | -DOPENTHREAD_RADIO=0 |
38 | | - -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 |
39 | | -) |
40 | | - |
41 | | -set(COMMON_SOURCES |
42 | | - fuzzer_platform.cpp |
43 | 40 | ) |
44 | 41 |
|
45 | 42 | set(COMMON_LIBS |
46 | 43 | openthread-ftd |
| 44 | + ot-nexus-platform |
47 | 45 | ${OT_MBEDTLS} |
48 | 46 | $ENV{LIB_FUZZING_ENGINE} |
49 | 47 | ot-config |
50 | 48 | ) |
51 | 49 |
|
52 | | -add_executable(ot-cli-received-fuzzer |
53 | | - cli_received.cpp |
54 | | - ${COMMON_SOURCES} |
55 | | -) |
56 | | - |
57 | | -target_compile_options(ot-cli-received-fuzzer |
58 | | - PRIVATE |
59 | | - ${COMMON_COMPILE_OPTIONS} |
60 | | -) |
61 | | - |
62 | | -target_include_directories(ot-cli-received-fuzzer |
63 | | - PRIVATE |
64 | | - ${COMMON_INCLUDES} |
65 | | -) |
| 50 | +#---------------------------------------------------------------------------------------------------------------------- |
66 | 51 |
|
67 | | -target_link_libraries(ot-cli-received-fuzzer |
68 | | - PRIVATE |
69 | | - openthread-cli-ftd |
70 | | - ${COMMON_LIBS} |
71 | | -) |
| 52 | +macro(ot_nexus_test name) |
72 | 53 |
|
73 | | -add_executable(ot-ip6-send-fuzzer |
74 | | - ip6_send.cpp |
75 | | - ${COMMON_SOURCES} |
76 | | -) |
| 54 | + # Macro to add an OpenThread nexus test. |
| 55 | + # |
| 56 | + # Nexus test name will be `nexus_{name}`. Test source file of |
| 57 | + # `test_{name}.cpp` is used. Optional extra arguments can be |
| 58 | + # passed to provide additional source files. |
77 | 59 |
|
78 | | -target_compile_options(ot-ip6-send-fuzzer |
79 | | - PRIVATE |
80 | | - ${COMMON_COMPILE_OPTIONS} |
81 | | -) |
| 60 | + add_executable(${name}-fuzzer |
| 61 | + ${name}.cpp ${ARGN} |
| 62 | + ) |
82 | 63 |
|
83 | | -target_include_directories(ot-ip6-send-fuzzer |
| 64 | + target_include_directories(${name}-fuzzer |
84 | 65 | PRIVATE |
85 | 66 | ${COMMON_INCLUDES} |
86 | | -) |
| 67 | + ) |
87 | 68 |
|
88 | | -target_link_libraries(ot-ip6-send-fuzzer |
| 69 | + target_link_libraries(${name}-fuzzer |
89 | 70 | PRIVATE |
90 | 71 | ${COMMON_LIBS} |
91 | | -) |
92 | | - |
93 | | -add_executable(ot-radio-receive-done-fuzzer |
94 | | - radio_receive_done.cpp |
95 | | - ${COMMON_SOURCES} |
96 | | -) |
| 72 | + ) |
97 | 73 |
|
98 | | -target_compile_options(ot-radio-receive-done-fuzzer |
| 74 | + target_compile_options(${name}-fuzzer |
99 | 75 | PRIVATE |
100 | 76 | ${COMMON_COMPILE_OPTIONS} |
101 | | -) |
| 77 | + ) |
| 78 | +endmacro() |
102 | 79 |
|
103 | | -target_include_directories(ot-radio-receive-done-fuzzer |
104 | | - PRIVATE |
105 | | - ${COMMON_INCLUDES} |
106 | | -) |
| 80 | +#---------------------------------------------------------------------------------------------------------------------- |
107 | 81 |
|
108 | | -target_link_libraries(ot-radio-receive-done-fuzzer |
109 | | - PRIVATE |
110 | | - ${COMMON_LIBS} |
111 | | -) |
112 | | - |
113 | | -add_executable(ot-ncp-hdlc-received-fuzzer |
114 | | - ncp_hdlc_received.cpp |
115 | | - ${COMMON_SOURCES} |
116 | | -) |
117 | | - |
118 | | -target_compile_options(ot-ncp-hdlc-received-fuzzer |
119 | | - PRIVATE |
120 | | - ${COMMON_COMPILE_OPTIONS} |
121 | | -) |
122 | | - |
123 | | -target_include_directories(ot-ncp-hdlc-received-fuzzer |
124 | | - PRIVATE |
125 | | - ${COMMON_INCLUDES} |
126 | | -) |
127 | | - |
128 | | -target_link_libraries(ot-ncp-hdlc-received-fuzzer |
129 | | - PRIVATE |
130 | | - openthread-ncp-ftd |
131 | | - ${COMMON_LIBS} |
132 | | -) |
| 82 | +ot_nexus_test(radio-one-node) |
0 commit comments