James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 1 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 2 | load("//aos:config.bzl", "aos_config") |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 3 | |
Xander Yee | 1ad2f7b | 2023-02-21 14:46:56 -0800 | [diff] [blame] | 4 | exports_files(["roborio_irq_config.json"]) |
| 5 | |
Brian Silverman | 96d1295 | 2015-10-12 13:36:42 -0400 | [diff] [blame] | 6 | # This target is everything which should get deployed to the robot. |
| 7 | filegroup( |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 8 | name = "starter", |
| 9 | srcs = [ |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 10 | "aos_starter", |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 11 | "starter.sh", |
Austin Schuh | 44e0b14 | 2021-10-16 15:51:10 -0700 | [diff] [blame] | 12 | "starterd.stripped", |
| 13 | ], |
| 14 | visibility = ["//visibility:public"], |
| 15 | ) |
| 16 | |
| 17 | filegroup( |
| 18 | name = "starter_stripped", |
| 19 | srcs = [ |
| 20 | "aos_starter.stripped", |
| 21 | "starter.sh", |
| 22 | "starterd.stripped", |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 23 | ], |
| 24 | visibility = ["//visibility:public"], |
Brian Silverman | 96d1295 | 2015-10-12 13:36:42 -0400 | [diff] [blame] | 25 | ) |
Brian Silverman | 100534c | 2015-09-07 15:51:23 -0400 | [diff] [blame] | 26 | |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 27 | cc_library( |
James Kuszmaul | 3224b8e | 2022-01-07 19:00:39 -0800 | [diff] [blame] | 28 | name = "subprocess", |
| 29 | srcs = ["subprocess.cc"], |
| 30 | hdrs = ["subprocess.h"], |
| 31 | visibility = ["//visibility:public"], |
| 32 | deps = [ |
| 33 | ":starter_fbs", |
| 34 | ":starter_rpc_fbs", |
| 35 | "//aos/events:event_loop", |
| 36 | "//aos/events:shm_event_loop", |
| 37 | "//aos/util:scoped_pipe", |
James Kuszmaul | 6295a64 | 2022-03-22 15:23:59 -0700 | [diff] [blame] | 38 | "//aos/util:top", |
James Kuszmaul | 3224b8e | 2022-01-07 19:00:39 -0800 | [diff] [blame] | 39 | "@com_github_google_glog//:glog", |
| 40 | ], |
| 41 | ) |
| 42 | |
| 43 | cc_library( |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 44 | name = "starterd_lib", |
| 45 | srcs = ["starterd_lib.cc"], |
| 46 | hdrs = ["starterd_lib.h"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 47 | target_compatible_with = ["@platforms//os:linux"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 48 | deps = [ |
| 49 | ":starter_fbs", |
| 50 | ":starter_rpc_fbs", |
James Kuszmaul | 3224b8e | 2022-01-07 19:00:39 -0800 | [diff] [blame] | 51 | ":subprocess", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 52 | "//aos:configuration", |
| 53 | "//aos:macros", |
| 54 | "//aos/events:shm_event_loop", |
| 55 | "@com_github_google_glog//:glog", |
| 56 | ], |
| 57 | ) |
| 58 | |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 59 | aos_config( |
| 60 | name = "multinode_pingpong_config", |
| 61 | src = "multinode_pingpong.json", |
| 62 | flatbuffers = [ |
| 63 | "//aos/events:ping_fbs", |
| 64 | "//aos/events:pong_fbs", |
| 65 | ":starter_rpc_fbs", |
| 66 | ":starter_fbs", |
| 67 | "//aos/logging:log_message_fbs", |
| 68 | "//aos/events:event_loop_fbs", |
| 69 | "//aos/network:message_bridge_client_fbs", |
| 70 | "//aos/network:remote_message_fbs", |
| 71 | "//aos/network:timestamp_fbs", |
| 72 | "//aos/network:message_bridge_server_fbs", |
| 73 | ], |
| 74 | target_compatible_with = ["@platforms//os:linux"], |
| 75 | ) |
| 76 | |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 77 | cc_test( |
James Kuszmaul | d42edb4 | 2022-01-07 18:00:16 -0800 | [diff] [blame] | 78 | name = "subprocess_test", |
| 79 | srcs = ["subprocess_test.cc"], |
| 80 | data = [ |
| 81 | "//aos/events:pingpong_config", |
| 82 | ], |
James Kuszmaul | a03bdf0 | 2022-02-26 16:39:45 -0800 | [diff] [blame] | 83 | flaky = True, |
James Kuszmaul | d42edb4 | 2022-01-07 18:00:16 -0800 | [diff] [blame] | 84 | # The roborio compiler doesn't support <filesystem>. |
| 85 | target_compatible_with = |
| 86 | ["@platforms//os:linux"], |
| 87 | deps = [ |
| 88 | ":subprocess", |
| 89 | "//aos/events:shm_event_loop", |
| 90 | "//aos/testing:googletest", |
| 91 | "//aos/testing:path", |
| 92 | "//aos/testing:tmpdir", |
| 93 | ], |
| 94 | ) |
| 95 | |
Philipp Schrader | fa8fc49 | 2023-09-26 14:52:02 -0700 | [diff] [blame] | 96 | # Similar to subprocess_test, but here are all the tests that are not flaky. |
| 97 | cc_test( |
| 98 | name = "subprocess_reliable_test", |
| 99 | srcs = ["subprocess_reliable_test.cc"], |
| 100 | data = [ |
| 101 | "//aos/events:pingpong_config", |
| 102 | ], |
| 103 | # The roborio compiler doesn't support <filesystem>. |
| 104 | target_compatible_with = ["@platforms//os:linux"], |
| 105 | deps = [ |
| 106 | ":subprocess", |
| 107 | "//aos/events:shm_event_loop", |
| 108 | "//aos/testing:googletest", |
| 109 | "//aos/testing:path", |
| 110 | "//aos/testing:tmpdir", |
| 111 | ], |
| 112 | ) |
| 113 | |
James Kuszmaul | d42edb4 | 2022-01-07 18:00:16 -0800 | [diff] [blame] | 114 | cc_test( |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 115 | name = "starter_test", |
| 116 | srcs = ["starter_test.cc"], |
| 117 | data = [ |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 118 | ":multinode_pingpong_config", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 119 | "//aos/events:ping", |
| 120 | "//aos/events:pingpong_config", |
| 121 | "//aos/events:pong", |
| 122 | ], |
James Kuszmaul | be55e1c | 2022-04-02 20:06:01 -0700 | [diff] [blame] | 123 | # TODO(james): Fix tihs. |
| 124 | flaky = True, |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 125 | linkopts = ["-lstdc++fs"], |
James Kuszmaul | e7c7e58 | 2022-01-07 18:50:01 -0800 | [diff] [blame] | 126 | shard_count = 4, |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 127 | # The roborio compiler doesn't support <filesystem>. |
| 128 | target_compatible_with = |
| 129 | select({ |
| 130 | "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"], |
| 131 | "//conditions:default": ["@platforms//os:linux"], |
| 132 | }), |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 133 | deps = [ |
| 134 | ":starter_rpc_lib", |
| 135 | ":starterd_lib", |
| 136 | "//aos/events:ping_fbs", |
| 137 | "//aos/events:pong_fbs", |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 138 | "//aos/events:simulated_event_loop", |
Austin Schuh | 59398d3 | 2023-05-03 08:10:55 -0700 | [diff] [blame] | 139 | "//aos/ipc_lib:event", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 140 | "//aos/testing:googletest", |
Austin Schuh | 373f176 | 2021-06-02 21:07:09 -0700 | [diff] [blame] | 141 | "//aos/testing:path", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 142 | "//aos/testing:tmpdir", |
| 143 | ], |
| 144 | ) |
| 145 | |
| 146 | cc_binary( |
| 147 | name = "starterd", |
| 148 | srcs = ["starterd.cc"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 149 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 150 | visibility = ["//visibility:public"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 151 | deps = [ |
| 152 | ":starterd_lib", |
| 153 | "//aos:init", |
| 154 | ], |
| 155 | ) |
| 156 | |
| 157 | cc_library( |
| 158 | name = "starter_rpc_lib", |
| 159 | srcs = ["starter_rpc_lib.cc"], |
| 160 | hdrs = ["starter_rpc_lib.h"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 161 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 162 | visibility = ["//visibility:public"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 163 | deps = [ |
| 164 | ":starter_fbs", |
| 165 | ":starter_rpc_fbs", |
James Kuszmaul | 293b217 | 2021-11-10 16:20:48 -0800 | [diff] [blame] | 166 | ":starterd_lib", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 167 | "//aos:configuration", |
| 168 | "//aos:init", |
| 169 | "//aos/events:shm_event_loop", |
| 170 | ], |
| 171 | ) |
| 172 | |
| 173 | cc_binary( |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 174 | name = "aos_starter", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 175 | srcs = ["starter_cmd.cc"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 176 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 177 | visibility = ["//visibility:public"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 178 | deps = [ |
| 179 | ":starter_rpc_lib", |
Austin Schuh | c61e9c0 | 2021-04-26 12:10:40 -0700 | [diff] [blame] | 180 | "//aos/time", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 181 | "@com_github_google_glog//:glog", |
Philipp Schrader | 0853749 | 2021-01-23 16:17:55 -0800 | [diff] [blame] | 182 | "@com_google_absl//absl/strings:str_format", |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 183 | ], |
| 184 | ) |
| 185 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 186 | static_flatbuffer( |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 187 | name = "starter_fbs", |
| 188 | srcs = ["starter.fbs"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 189 | target_compatible_with = ["@platforms//os:linux"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 190 | visibility = ["//visibility:public"], |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 191 | deps = ["//aos/util:process_info_fbs"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 192 | ) |
| 193 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 194 | static_flatbuffer( |
Austin Schuh | 608514f | 2022-12-30 15:51:30 -0800 | [diff] [blame] | 195 | name = "kthread_fbs", |
| 196 | srcs = ["kthread.fbs"], |
Austin Schuh | 608514f | 2022-12-30 15:51:30 -0800 | [diff] [blame] | 197 | target_compatible_with = ["@platforms//os:linux"], |
| 198 | visibility = ["//visibility:public"], |
| 199 | ) |
| 200 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 201 | static_flatbuffer( |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 202 | name = "starter_rpc_fbs", |
| 203 | srcs = ["starter_rpc.fbs"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 204 | target_compatible_with = ["@platforms//os:linux"], |
Tyler Chatow | a79419d | 2020-08-12 20:12:11 -0700 | [diff] [blame] | 205 | visibility = ["//visibility:public"], |
| 206 | ) |
James Kuszmaul | 77e1981 | 2021-05-19 21:36:10 -0700 | [diff] [blame] | 207 | |
| 208 | py_binary( |
| 209 | name = "starter_demo", |
| 210 | srcs = ["starter_demo.py"], |
| 211 | args = [ |
| 212 | "$(rootpath :starterd)", |
| 213 | "\"$(rootpaths //aos/events:pingpong_config)\"", |
| 214 | "$(rootpath //aos/events:ping)", |
| 215 | "$(rootpath //aos/events:pong)", |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 216 | "$(rootpath :aos_starter)", |
Austin Schuh | 48d10d6 | 2022-10-16 22:19:23 -0700 | [diff] [blame] | 217 | "$(rootpath //aos:aos_dump)", |
| 218 | "$(rootpath //aos/events/logging:logger_main)", |
James Kuszmaul | 60bb868 | 2023-08-07 07:39:34 -0700 | [diff] [blame] | 219 | "$(rootpath //aos/events:aos_timing_report_streamer)", |
James Kuszmaul | 77e1981 | 2021-05-19 21:36:10 -0700 | [diff] [blame] | 220 | ], |
| 221 | data = [ |
Austin Schuh | 529ac59 | 2021-10-14 16:11:13 -0700 | [diff] [blame] | 222 | ":aos_starter", |
James Kuszmaul | 77e1981 | 2021-05-19 21:36:10 -0700 | [diff] [blame] | 223 | ":starterd", |
Austin Schuh | 48d10d6 | 2022-10-16 22:19:23 -0700 | [diff] [blame] | 224 | "//aos:aos_dump", |
James Kuszmaul | 60bb868 | 2023-08-07 07:39:34 -0700 | [diff] [blame] | 225 | "//aos/events:aos_timing_report_streamer", |
James Kuszmaul | 77e1981 | 2021-05-19 21:36:10 -0700 | [diff] [blame] | 226 | "//aos/events:ping", |
| 227 | "//aos/events:pingpong_config", |
| 228 | "//aos/events:pong", |
Austin Schuh | 48d10d6 | 2022-10-16 22:19:23 -0700 | [diff] [blame] | 229 | "//aos/events/logging:logger_main", |
James Kuszmaul | 77e1981 | 2021-05-19 21:36:10 -0700 | [diff] [blame] | 230 | ], |
| 231 | ) |
Austin Schuh | 2ec71fd | 2022-12-30 14:48:59 -0800 | [diff] [blame] | 232 | |
| 233 | cc_library( |
| 234 | name = "irq_affinity_lib", |
| 235 | srcs = ["irq_affinity_lib.cc"], |
| 236 | hdrs = ["irq_affinity_lib.h"], |
| 237 | deps = [ |
| 238 | "//aos/scoped:scoped_fd", |
| 239 | "@com_github_google_glog//:glog", |
| 240 | "@com_google_absl//absl/strings", |
| 241 | ], |
| 242 | ) |
| 243 | |
Austin Schuh | 608514f | 2022-12-30 15:51:30 -0800 | [diff] [blame] | 244 | cc_binary( |
| 245 | name = "irq_affinity", |
| 246 | srcs = [ |
| 247 | "irq_affinity.cc", |
| 248 | ], |
Austin Schuh | 9f164e9 | 2022-12-29 16:15:28 -0800 | [diff] [blame] | 249 | visibility = ["//visibility:public"], |
Austin Schuh | 608514f | 2022-12-30 15:51:30 -0800 | [diff] [blame] | 250 | deps = [ |
| 251 | ":irq_affinity_lib", |
| 252 | ":kthread_fbs", |
| 253 | "//aos:init", |
| 254 | "//aos:realtime", |
| 255 | "//aos/events:shm_event_loop", |
| 256 | "//aos/util:top", |
| 257 | ], |
| 258 | ) |
| 259 | |
Austin Schuh | 2ec71fd | 2022-12-30 14:48:59 -0800 | [diff] [blame] | 260 | cc_test( |
| 261 | name = "irq_affinity_lib_test", |
| 262 | srcs = ["irq_affinity_lib_test.cc"], |
| 263 | deps = [ |
| 264 | ":irq_affinity_lib", |
| 265 | "//aos/testing:googletest", |
| 266 | ], |
| 267 | ) |
James Kuszmaul | 9a816a7 | 2023-03-23 15:10:34 -0700 | [diff] [blame] | 268 | |
| 269 | cc_library( |
| 270 | name = "mock_starter", |
| 271 | srcs = ["mock_starter.cc"], |
| 272 | hdrs = ["mock_starter.h"], |
| 273 | visibility = ["//visibility:public"], |
| 274 | deps = [ |
| 275 | "//aos/events:simulated_event_loop", |
| 276 | "//aos/starter:starter_fbs", |
| 277 | "//aos/starter:starter_rpc_fbs", |
| 278 | "//aos/starter:starter_rpc_lib", |
| 279 | ], |
| 280 | ) |