blob: 908cb80a1be7514a91839eca98a0c4ad9f3ee75d [file] [log] [blame]
Brian Silverman100534c2015-09-07 15:51:23 -04001cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -08002 name = "aos_sync",
3 srcs = [
4 "aos_sync.cc",
5 ],
6 hdrs = [
7 "aos_sync.h",
8 ],
9 linkopts = [
10 "-lpthread",
11 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070012 visibility = ["//visibility:public"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080013 deps = [
John Park33858a32018-09-28 23:05:48 -070014 "//aos:macros",
John Park33858a32018-09-28 23:05:48 -070015 "//aos/util:compiler_memory_barrier",
Alex Perrycb7da4b2019-08-28 19:35:56 -070016 "@com_github_google_glog//:glog",
17 "@com_google_absl//absl/base",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080018 ],
Brian Silverman100534c2015-09-07 15:51:23 -040019)
20
21cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080022 name = "core_lib",
23 srcs = [
24 "core_lib.c",
25 ],
26 hdrs = [
27 "core_lib.h",
28 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070029 visibility = ["//visibility:public"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080030 deps = [
31 ":aos_sync",
32 ":shared_mem_types",
33 ],
Brian Silverman100534c2015-09-07 15:51:23 -040034)
35
36cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080037 name = "shared_mem",
38 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070039 "shared_mem.cc",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080040 ],
41 hdrs = [
42 "shared_mem.h",
43 ],
44 linkopts = [
45 "-lrt",
46 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070047 visibility = ["//visibility:public"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080048 deps = [
49 ":aos_sync",
50 ":core_lib",
51 ":shared_mem_types",
Alex Perrycb7da4b2019-08-28 19:35:56 -070052 "@com_github_google_glog//:glog",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080053 ],
Austin Schuh044e18b2015-10-21 20:17:09 -070054)
55
56cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080057 # TODO(Brian): This should be shared_mem{,.h}, and the other one should be
58 # shared_mem_init{,.cc,.h}.
59 name = "shared_mem_types",
60 hdrs = [
61 "shared_mem_types.h",
62 ],
63 deps = [
64 ":aos_sync",
65 ],
Brian Silverman100534c2015-09-07 15:51:23 -040066)
67
68cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080069 name = "queue",
70 srcs = [
71 "queue.cc",
72 ],
73 hdrs = [
74 "queue.h",
75 ],
76 linkopts = [
77 "-lrt",
78 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070079 visibility = ["//visibility:public"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080080 deps = [
81 ":core_lib",
82 ":shared_mem",
John Park33858a32018-09-28 23:05:48 -070083 "//aos:condition",
Brian Silverman16a923c2018-10-31 19:40:51 -070084 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -070085 "//aos/util:options",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080086 ],
Brian Silverman100534c2015-09-07 15:51:23 -040087)
88
89cc_test(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080090 name = "raw_queue_test",
91 srcs = [
92 "raw_queue_test.cc",
93 ],
94 deps = [
95 ":core_lib",
96 ":queue",
John Park33858a32018-09-28 23:05:48 -070097 "//aos:die",
John Park33858a32018-09-28 23:05:48 -070098 "//aos/logging",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080099 "//aos/testing:googletest",
100 "//aos/testing:prevent_exit",
101 "//aos/testing:test_shm",
Brian Silverman16a923c2018-10-31 19:40:51 -0700102 "//aos/time",
103 "//aos/util:death_test_log_implementation",
104 "//aos/util:thread",
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800105 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400106)
107
108cc_test(
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800109 name = "ipc_stress_test",
110 srcs = [
111 "ipc_stress_test.cc",
112 ],
113 tags = [
114 "manual",
115 ],
116 deps = [
117 ":core_lib",
John Park33858a32018-09-28 23:05:48 -0700118 "//aos:die",
John Park33858a32018-09-28 23:05:48 -0700119 "//aos/libc:aos_strsignal",
120 "//aos/libc:dirname",
121 "//aos/logging",
Brian Silverman16a923c2018-10-31 19:40:51 -0700122 "//aos/mutex",
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800123 "//aos/testing:googletest",
124 "//aos/testing:test_shm",
Brian Silverman16a923c2018-10-31 19:40:51 -0700125 "//aos/time",
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800126 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400127)
128
129cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800130 name = "scoped_message_ptr",
131 deps = [
132 ":queue",
133 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400134)
Brian Silvermane4d8b282015-12-24 13:44:48 -0800135
136cc_binary(
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800137 name = "ipc_comparison",
138 srcs = [
139 "ipc_comparison.cc",
140 ],
141 deps = [
142 ":queue",
John Park33858a32018-09-28 23:05:48 -0700143 "//aos:condition",
144 "//aos:event",
Brian Silverman16a923c2018-10-31 19:40:51 -0700145 "//aos:init",
John Park33858a32018-09-28 23:05:48 -0700146 "//aos/logging",
147 "//aos/logging:implementations",
Brian Silverman16a923c2018-10-31 19:40:51 -0700148 "//aos/mutex",
149 "@com_github_gflags_gflags//:gflags",
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800150 ],
Brian Silvermane4d8b282015-12-24 13:44:48 -0800151)
Austin Schuh6c590f82019-09-11 19:23:12 -0700152
153cc_library(
154 name = "signalfd",
155 srcs = [
156 "signalfd.cc",
157 ],
158 hdrs = [
159 "signalfd.h",
160 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700161 visibility = ["//visibility:public"],
Austin Schuh6c590f82019-09-11 19:23:12 -0700162 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700163 "@com_github_google_glog//:glog",
Austin Schuh6c590f82019-09-11 19:23:12 -0700164 ],
165)
Austin Schuh25356e22019-09-11 19:27:07 -0700166
167cc_library(
168 name = "index",
Austin Schuh20b2b082019-09-11 20:42:56 -0700169 srcs = ["index.cc"],
Austin Schuh25356e22019-09-11 19:27:07 -0700170 hdrs = ["index.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700171 visibility = ["//visibility:public"],
Austin Schuh25356e22019-09-11 19:27:07 -0700172)
173
174cc_test(
175 name = "index_test",
176 srcs = ["index_test.cc"],
177 deps = [
178 ":index",
179 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700180 "@com_github_google_glog//:glog",
Austin Schuh25356e22019-09-11 19:27:07 -0700181 ],
182)
Austin Schuh20b2b082019-09-11 20:42:56 -0700183
184cc_library(
185 name = "lockless_queue",
186 srcs = [
187 "lockless_queue.cc",
188 "lockless_queue_memory.h",
189 ],
190 hdrs = ["lockless_queue.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700191 visibility = ["//visibility:public"],
Austin Schuh20b2b082019-09-11 20:42:56 -0700192 deps = [
193 ":aos_sync",
194 ":index",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700195 "//aos:realtime",
Austin Schuh20b2b082019-09-11 20:42:56 -0700196 "//aos/time",
197 "//aos/util:compiler_memory_barrier",
Austin Schuhf257f3c2019-10-27 21:00:43 -0700198 "@com_github_google_glog//:glog",
Austin Schuh20b2b082019-09-11 20:42:56 -0700199 ],
200)
201
202cc_library(
203 name = "queue_racer",
204 testonly = True,
205 srcs = [
206 "queue_racer.cc",
207 ],
208 hdrs = [
209 "queue_racer.h",
210 ],
211 deps = [
212 ":lockless_queue",
213 "//aos:event",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700214 "//aos/testing:googletest",
Austin Schuh20b2b082019-09-11 20:42:56 -0700215 ],
216)
217
218cc_test(
219 name = "lockless_queue_test",
220 timeout = "eternal",
221 srcs = ["lockless_queue_test.cc"],
222 deps = [
223 ":lockless_queue",
224 ":queue_racer",
225 ":signalfd",
226 "//aos:event",
227 "//aos/events:epoll",
228 "//aos/libc:aos_strsignal",
229 "//aos/testing:googletest",
230 "//aos/testing:prevent_exit",
Austin Schuh20b2b082019-09-11 20:42:56 -0700231 ],
232)
233
234cc_test(
235 name = "lockless_queue_death_test",
236 srcs = ["lockless_queue_death_test.cc"],
237 deps = [
238 ":lockless_queue",
239 ":queue_racer",
240 ":signalfd",
241 "//aos:event",
242 "//aos/events:epoll",
243 "//aos/libc:aos_strsignal",
244 "//aos/testing:googletest",
245 "//aos/testing:prevent_exit",
246 "//aos/testing:test_logging",
247 ],
248)