blob: a7d7e029213b50702a683a657723194a2e8e9ca5 [file] [log] [blame]
James Kuszmaulf01da392023-12-14 11:22:14 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
James Kuszmaul293b2172021-11-10 16:20:48 -08002load("//aos:config.bzl", "aos_config")
Tyler Chatowa79419d2020-08-12 20:12:11 -07003
Xander Yee1ad2f7b2023-02-21 14:46:56 -08004exports_files(["roborio_irq_config.json"])
5
Brian Silverman96d12952015-10-12 13:36:42 -04006# This target is everything which should get deployed to the robot.
7filegroup(
Austin Schuhdde64052019-12-11 20:28:00 -08008 name = "starter",
9 srcs = [
Austin Schuh529ac592021-10-14 16:11:13 -070010 "aos_starter",
Austin Schuhdde64052019-12-11 20:28:00 -080011 "starter.sh",
Austin Schuh44e0b142021-10-16 15:51:10 -070012 "starterd.stripped",
13 ],
14 visibility = ["//visibility:public"],
15)
16
17filegroup(
18 name = "starter_stripped",
19 srcs = [
20 "aos_starter.stripped",
21 "starter.sh",
22 "starterd.stripped",
Austin Schuhdde64052019-12-11 20:28:00 -080023 ],
24 visibility = ["//visibility:public"],
Brian Silverman96d12952015-10-12 13:36:42 -040025)
Brian Silverman100534c2015-09-07 15:51:23 -040026
Tyler Chatowa79419d2020-08-12 20:12:11 -070027cc_library(
James Kuszmaul3224b8e2022-01-07 19:00:39 -080028 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 Kuszmaul6295a642022-03-22 15:23:59 -070038 "//aos/util:top",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080039 "@com_github_google_glog//:glog",
40 ],
41)
42
43cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070044 name = "starterd_lib",
45 srcs = ["starterd_lib.cc"],
46 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070048 deps = [
49 ":starter_fbs",
50 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080051 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070052 "//aos:configuration",
53 "//aos:macros",
54 "//aos/events:shm_event_loop",
55 "@com_github_google_glog//:glog",
56 ],
57)
58
James Kuszmaul293b2172021-11-10 16:20:48 -080059aos_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 Chatowa79419d2020-08-12 20:12:11 -070077cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080078 name = "subprocess_test",
79 srcs = ["subprocess_test.cc"],
80 data = [
81 "//aos/events:pingpong_config",
82 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080083 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080084 # 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 Schraderfa8fc492023-09-26 14:52:02 -070096# Similar to subprocess_test, but here are all the tests that are not flaky.
97cc_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 Kuszmauld42edb42022-01-07 18:00:16 -0800114cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700115 name = "starter_test",
116 srcs = ["starter_test.cc"],
117 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -0800118 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700119 "//aos/events:ping",
120 "//aos/events:pingpong_config",
121 "//aos/events:pong",
122 ],
James Kuszmaulbe55e1c2022-04-02 20:06:01 -0700123 # TODO(james): Fix tihs.
124 flaky = True,
James Kuszmaul293b2172021-11-10 16:20:48 -0800125 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800126 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800127 # 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 Chatowa79419d2020-08-12 20:12:11 -0700133 deps = [
134 ":starter_rpc_lib",
135 ":starterd_lib",
136 "//aos/events:ping_fbs",
137 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800138 "//aos/events:simulated_event_loop",
Austin Schuh59398d32023-05-03 08:10:55 -0700139 "//aos/ipc_lib:event",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700140 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700141 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700142 "//aos/testing:tmpdir",
143 ],
144)
145
146cc_binary(
147 name = "starterd",
148 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800149 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700150 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700151 deps = [
152 ":starterd_lib",
153 "//aos:init",
154 ],
155)
156
157cc_library(
158 name = "starter_rpc_lib",
159 srcs = ["starter_rpc_lib.cc"],
160 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800161 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800162 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700163 deps = [
164 ":starter_fbs",
165 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800166 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700167 "//aos:configuration",
168 "//aos:init",
169 "//aos/events:shm_event_loop",
170 ],
171)
172
173cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700174 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700175 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800176 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700177 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700178 deps = [
179 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700180 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700181 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800182 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700183 ],
184)
185
James Kuszmaulf01da392023-12-14 11:22:14 -0800186static_flatbuffer(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700187 name = "starter_fbs",
188 srcs = ["starter.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800189 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700190 visibility = ["//visibility:public"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800191 deps = ["//aos/util:process_info_fbs"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700192)
193
James Kuszmaulf01da392023-12-14 11:22:14 -0800194static_flatbuffer(
Austin Schuh608514f2022-12-30 15:51:30 -0800195 name = "kthread_fbs",
196 srcs = ["kthread.fbs"],
Austin Schuh608514f2022-12-30 15:51:30 -0800197 target_compatible_with = ["@platforms//os:linux"],
198 visibility = ["//visibility:public"],
199)
200
James Kuszmaulf01da392023-12-14 11:22:14 -0800201static_flatbuffer(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700202 name = "starter_rpc_fbs",
203 srcs = ["starter_rpc.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800204 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700205 visibility = ["//visibility:public"],
206)
James Kuszmaul77e19812021-05-19 21:36:10 -0700207
208py_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 Schuh529ac592021-10-14 16:11:13 -0700216 "$(rootpath :aos_starter)",
Austin Schuh48d10d62022-10-16 22:19:23 -0700217 "$(rootpath //aos:aos_dump)",
218 "$(rootpath //aos/events/logging:logger_main)",
James Kuszmaul60bb8682023-08-07 07:39:34 -0700219 "$(rootpath //aos/events:aos_timing_report_streamer)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700220 ],
221 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700222 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700223 ":starterd",
Austin Schuh48d10d62022-10-16 22:19:23 -0700224 "//aos:aos_dump",
James Kuszmaul60bb8682023-08-07 07:39:34 -0700225 "//aos/events:aos_timing_report_streamer",
James Kuszmaul77e19812021-05-19 21:36:10 -0700226 "//aos/events:ping",
227 "//aos/events:pingpong_config",
228 "//aos/events:pong",
Austin Schuh48d10d62022-10-16 22:19:23 -0700229 "//aos/events/logging:logger_main",
James Kuszmaul77e19812021-05-19 21:36:10 -0700230 ],
231)
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800232
233cc_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 Schuh608514f2022-12-30 15:51:30 -0800244cc_binary(
245 name = "irq_affinity",
246 srcs = [
247 "irq_affinity.cc",
248 ],
Austin Schuh9f164e92022-12-29 16:15:28 -0800249 visibility = ["//visibility:public"],
Austin Schuh608514f2022-12-30 15:51:30 -0800250 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 Schuh2ec71fd2022-12-30 14:48:59 -0800260cc_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 Kuszmaul9a816a72023-03-23 15:10:34 -0700268
269cc_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)