1// Build the unit tests for audio_utils
2
3package {
4    default_team: "trendy_team_android_media_audio_framework",
5    // http://go/android-license-faq
6    // A large-scale-change added 'default_applicable_licenses' to import
7    // the below license kinds from "system_media_license":
8    //   SPDX-license-identifier-Apache-2.0
9    default_applicable_licenses: ["system_media_license"],
10}
11
12cc_test {
13    name: "audio_commandthread_tests",
14    host_supported: true,
15    srcs: ["audio_commandthread_tests.cpp"],
16    shared_libs: [
17        "libbase",
18        "libbinder",
19    ],
20    header_libs: [
21        "libaudioutils_headers",
22    ],
23    cflags: [
24        "-Wall",
25        "-Werror",
26        "-Wthread-safety",
27    ],
28}
29
30cc_test {
31    name: "audio_float_tests",
32    host_supported: true,
33    srcs: ["audio_float_tests.cpp"],
34    shared_libs: [
35        "libbase",
36        "libbinder",
37    ],
38    header_libs: [
39        "libaudioutils_headers",
40    ],
41    cflags: [
42        "-Wall",
43        "-Werror",
44        "-Wthread-safety",
45    ],
46}
47
48cc_defaults {
49    name: "audio_math_test_defaults",
50    host_supported: true,
51
52    srcs: [
53        "audio_math_tests.cpp",
54    ],
55
56    shared_libs: [
57        "libbase",
58        "liblog",
59        "libutils",
60    ],
61
62    static_libs: [
63        "libaudioutils",
64    ],
65
66    cflags: [
67        "-Wall",
68        "-Werror",
69        "-Wextra",
70    ],
71}
72
73cc_test {
74    name: "audio_fast_math_tests",
75    defaults: [
76        "audio_math_test_defaults",
77    ],
78    cflags: [
79        "-DFAST_MATH_ENABLED",
80        "-ffast-math",
81        "-fhonor-infinities",
82        "-fhonor-nans",
83    ],
84}
85
86cc_test {
87    name: "audio_math_tests",
88    defaults: [
89        "audio_math_test_defaults",
90    ],
91}
92
93cc_test {
94    name: "audio_mutex_tests",
95    host_supported: true,
96
97    srcs: [
98        "audio_mutex_tests.cpp",
99    ],
100
101    shared_libs: [
102        "libaudioutils",
103        "libbase",
104        "liblog",
105        "libutils",
106    ],
107
108    cflags: [
109        "-Wall",
110        "-Werror",
111        "-Wextra",
112        "-Wthread-safety",
113    ],
114}
115
116cc_test {
117    name: "audio_thread_tests",
118
119    srcs: [
120        "audio_thread_tests.cpp",
121    ],
122
123    shared_libs: [
124        "libbase",
125        "liblog",
126        "libutils",
127    ],
128
129    static_libs: [
130        "libaudioutils",
131    ],
132
133    cflags: [
134        "-Wall",
135        "-Werror",
136        "-Wextra",
137        "-Wthread-safety",
138    ],
139}
140
141cc_test {
142    name: "audio_nnapi_tests",
143
144    srcs: [
145        "audio_nnapi2_tests.cpp",
146        "audio_nnapi_tests.cpp",
147    ],
148
149    header_libs: [
150        "libaudioutils_headers",
151    ],
152
153    shared_libs: [
154        "libandroid",
155        "libbase",
156        "liblog",
157        "libnativewindow",
158        "libneuralnetworks",
159    ],
160
161    cflags: [
162        "-Wall",
163        "-Werror",
164        "-Wextra",
165        "-Wno-deprecated-declarations",
166    ],
167}
168
169cc_test {
170    name: "audio_tflite_tests",
171
172    srcs: [
173        "audio_tflite_tests.cpp",
174    ],
175
176    header_libs: [
177        "flatbuffer_headers",
178        "tensorflow_headers",
179    ],
180
181    shared_libs: [
182        "libandroid",
183        "libbase",
184        "liblog",
185    ],
186
187    static_libs: [
188        "libgmock",
189        "libtflite_static",
190    ],
191
192    cflags: [
193        "-Wall",
194        "-Werror",
195        "-Wextra",
196    ],
197}
198
199cc_test {
200    name: "balance_tests",
201    host_supported: true,
202
203    srcs: [
204        "balance_tests.cpp",
205    ],
206
207    static_libs: [
208        "libaudioutils",
209    ],
210
211    cflags: [
212        "-Wall",
213        "-Werror",
214        "-Wextra",
215    ],
216}
217
218cc_binary {
219    name: "biquad_filter",
220    host_supported: true,
221
222    srcs: [
223        "biquad_filter.cpp",
224    ],
225
226    shared_libs: [
227        "libaudioutils",
228    ],
229
230    cflags: [
231        "-Wall",
232        "-Werror",
233        "-Wextra",
234    ],
235}
236
237cc_test {
238    name: "circular_buffer_tests",
239    host_supported: true,
240
241    srcs: [
242        "circular_buffer_tests.cpp",
243    ],
244
245    static_libs: [
246        "libaudioutils",
247    ],
248
249    cflags: [
250        "-Wall",
251        "-Werror",
252        "-Wextra",
253    ],
254}
255
256cc_test {
257    name: "mel_aggregator_tests",
258    host_supported: true,
259
260    srcs: [
261        "mel_aggregator_tests.cpp",
262    ],
263
264    shared_libs: [
265        "libaudioutils",
266        "liblog",
267        "libutils",
268    ],
269
270    static_libs: [
271        "libgmock",
272    ],
273
274    cflags: [
275        "-Wall",
276        "-Werror",
277        "-Wextra",
278    ],
279}
280
281cc_test {
282    name: "mel_processor_tests",
283    host_supported: true,
284
285    srcs: [
286        "mel_processor_tests.cpp",
287    ],
288
289    shared_libs: [
290        "libaudioutils",
291        "liblog",
292        "libutils",
293    ],
294
295    static_libs: [
296        "libgmock",
297    ],
298
299    cflags: [
300        "-Wall",
301        "-Werror",
302        "-Wextra",
303    ],
304}
305
306cc_test {
307    name: "biquad_filter_tests",
308    host_supported: true,
309
310    srcs: [
311        "biquad_filter_tests.cpp",
312    ],
313
314    header_libs: [
315        "libaudioutils_headers",
316    ],
317
318    static_libs: [
319        "libgmock",
320    ],
321
322    cflags: [
323        "-Wall",
324        "-Werror",
325        "-Wextra",
326    ],
327}
328
329cc_test {
330    name: "channelmix_tests",
331    host_supported: true,
332
333    shared_libs: [
334        "libcutils",
335        "liblog",
336    ],
337
338    static_libs: [
339        "libaudioutils",
340    ],
341
342    srcs: ["channelmix_tests.cpp"],
343    cflags: [
344        "-Wall",
345        "-Werror",
346        "-Wextra",
347    ],
348}
349
350cc_test {
351    name: "fdtostring_tests",
352    host_supported: true,
353
354    shared_libs: [
355        "libaudioutils",
356        "libcutils",
357        "liblog",
358        "libutils", //for systemTime
359    ],
360    srcs: ["fdtostring_tests.cpp"],
361    cflags: [
362        "-Wall",
363        "-Werror",
364        "-Wextra",
365    ],
366}
367
368cc_test {
369    name: "hal_smoothness_tests",
370    host_supported: true,
371
372    srcs: [
373        "hal_smoothness_tests.cpp",
374    ],
375
376    static_libs: [
377        "libaudioutils",
378        "liblog",
379    ],
380
381    cflags: [
382        "-Wall",
383        "-Werror",
384        "-Wextra",
385    ],
386}
387
388cc_test {
389    name: "intrinsic_tests",
390    host_supported: true,
391
392    srcs: [
393        "intrinsic_tests.cpp",
394    ],
395
396    header_libs: [
397        "libaudioutils_headers",
398    ],
399
400    cflags: [
401        "-Wall",
402        "-Werror",
403        "-Wextra",
404    ],
405}
406
407cc_test {
408    name: "primitives_tests",
409    host_supported: true,
410
411    shared_libs: [
412        "libcutils",
413        "liblog",
414    ],
415    srcs: ["primitives_tests.cpp"],
416    cflags: [
417        "-Wall",
418        "-Werror",
419    ],
420    target: {
421        android: {
422            shared_libs: ["libaudioutils"],
423        },
424        host: {
425            static_libs: ["libaudioutils"],
426        },
427    },
428}
429
430cc_binary {
431    name: "fifo_tests",
432    host_supported: true,
433    srcs: ["fifo_tests.cpp"],
434    shared_libs: ["libaudioutils"],
435    static_libs: ["libsndfile"],
436    cflags: [
437        "-Wall",
438        "-Werror",
439    ],
440}
441
442cc_binary {
443    name: "fifo_multiprocess",
444    host_supported: true,
445    srcs: ["fifo_multiprocess.cpp"],
446    shared_libs: [
447        "libaudioutils",
448        "libcutils",
449    ],
450    static_libs: ["libsndfile"],
451    cflags: [
452        "-Wall",
453        "-Werror",
454    ],
455}
456
457cc_binary_host {
458    name: "fifo_threads",
459    // TODO move getch.c and .h to a utility library
460    srcs: [
461        "fifo_threads.cpp",
462        "getch.c",
463    ],
464    static_libs: [
465        "libaudioutils",
466        "liblog",
467    ],
468    cflags: [
469        "-Wall",
470        "-Werror",
471    ],
472}
473
474cc_binary_host {
475    name: "limiter_tests",
476    srcs: ["limiter_tests.c"],
477    static_libs: ["libaudioutils"],
478    cflags: [
479        "-UNDEBUG",
480        "-Wall",
481        "-Werror",
482    ],
483}
484
485cc_test {
486    name: "power_tests",
487    host_supported: true,
488
489    shared_libs: [
490        "libcutils",
491        "liblog",
492    ],
493    srcs: ["power_tests.cpp"],
494    cflags: [
495        "-Wall",
496        "-Werror",
497        "-Wextra",
498    ],
499    target: {
500        android: {
501            shared_libs: ["libaudioutils"],
502        },
503        host: {
504            static_libs: ["libaudioutils"],
505        },
506    },
507}
508
509cc_test {
510    name: "errorlog_tests",
511    host_supported: true,
512
513    shared_libs: [
514        "libcutils",
515        "liblog",
516    ],
517    srcs: ["errorlog_tests.cpp"],
518    cflags: [
519        "-Wall",
520        "-Werror",
521        "-Wextra",
522    ],
523    target: {
524        android: {
525            shared_libs: ["libaudioutils"],
526        },
527        host: {
528            static_libs: ["libaudioutils"],
529        },
530    },
531}
532
533cc_test {
534    name: "metadata_tests",
535    host_supported: false,
536
537    shared_libs: [
538        "libcutils",
539        "liblog",
540    ],
541    srcs: ["metadata_tests.cpp"],
542    cflags: [
543        "-Wall",
544        "-Werror",
545        "-Wextra",
546    ],
547    target: {
548        android: {
549            shared_libs: ["libaudioutils"],
550        },
551        host: {
552            static_libs: ["libaudioutils"],
553        },
554    },
555}
556
557cc_binary {
558    name: "metadata_c_tests",
559    host_supported: true,
560    srcs: ["metadata_tests_c.c"],
561    cflags: [
562        "-Wall",
563        "-Werror",
564        "-Wextra",
565    ],
566    shared_libs: ["libaudioutils"],
567}
568
569cc_test {
570    name: "powerlog_tests",
571    host_supported: true,
572
573    shared_libs: [
574        "libcutils",
575        "liblog",
576    ],
577    srcs: ["powerlog_tests.cpp"],
578    cflags: [
579        "-Wall",
580        "-Werror",
581        "-Wextra",
582    ],
583    target: {
584        android: {
585            shared_libs: ["libaudioutils"],
586        },
587        host: {
588            static_libs: ["libaudioutils"],
589        },
590    },
591}
592
593cc_test {
594    name: "simplelog_tests",
595    host_supported: true,
596
597    shared_libs: [
598        "libcutils",
599        "liblog",
600    ],
601    srcs: ["simplelog_tests.cpp"],
602    cflags: [
603        "-Wall",
604        "-Werror",
605        "-Wextra",
606    ],
607    target: {
608        android: {
609            shared_libs: ["libaudioutils"],
610        },
611        host: {
612            static_libs: ["libaudioutils"],
613        },
614    },
615}
616
617cc_test {
618    name: "channels_tests",
619    host_supported: true,
620
621    shared_libs: [
622        "libcutils",
623        "liblog",
624    ],
625    srcs: ["channels_tests.cpp"],
626    cflags: [
627        "-Wall",
628        "-Werror",
629    ],
630    target: {
631        android: {
632            shared_libs: ["libaudioutils"],
633        },
634        host: {
635            static_libs: ["libaudioutils"],
636        },
637    },
638}
639
640cc_test {
641    name: "string_tests",
642    host_supported: true,
643
644    shared_libs: ["libaudioutils"],
645    srcs: ["string_tests.cpp"],
646    cflags: [
647        "-Wall",
648        "-Werror",
649    ],
650    target: {
651        host: {
652            shared_libs: ["libcutils"],
653        },
654    },
655}
656
657cc_test {
658    name: "format_tests",
659    host_supported: true,
660
661    shared_libs: [
662        "liblog",
663    ],
664    srcs: ["format_tests.cpp"],
665    cflags: [
666        "-Wall",
667        "-Werror",
668    ],
669    target: {
670        android: {
671            shared_libs: ["libaudioutils"],
672        },
673        host: {
674            static_libs: ["libaudioutils"],
675        },
676    },
677}
678
679cc_test {
680    name: "statistics_tests",
681    host_supported: true,
682
683    header_libs: ["libaudioutils_headers"],
684    srcs: ["statistics_tests.cpp"],
685    cflags: [
686        "-Wall",
687        "-Werror",
688        "-Wextra",
689    ],
690}
691
692cc_test {
693    name: "timestampverifier_tests",
694    host_supported: true,
695
696    header_libs: ["libaudioutils_headers"],
697    srcs: ["timestampverifier_tests.cpp"],
698    cflags: [
699        "-Wall",
700        "-Werror",
701        "-Wextra",
702    ],
703}
704
705cc_test {
706    name: "variadic_tests",
707    host_supported: true,
708
709    shared_libs: ["libaudioutils"],
710    srcs: ["variadic_tests.cpp"],
711    cflags: [
712        "-Wall",
713        "-Werror",
714        "-Wextra",
715    ],
716}
717
718cc_test {
719    name: "logplot_tests",
720    host_supported: true,
721
722    shared_libs: [
723        "libcutils",
724        "liblog",
725    ],
726    srcs: ["logplot_tests.cpp"],
727    cflags: [
728        "-Wall",
729        "-Werror",
730    ],
731    target: {
732        android: {
733            shared_libs: ["libaudioutils"],
734        },
735        host: {
736            static_libs: ["libaudioutils"],
737        },
738    },
739}
740
741cc_test {
742    name: "sample_tests",
743    host_supported: true,
744
745    shared_libs: [
746        "libcutils",
747        "liblog",
748    ],
749    srcs: ["sample_tests.cpp"],
750    cflags: [
751        "-Wall",
752        "-Werror",
753    ],
754    target: {
755        android: {
756            shared_libs: ["libaudioutils"],
757        },
758        host: {
759            static_libs: ["libaudioutils"],
760        },
761    },
762}
763
764cc_test {
765    name: "spatializer_utils_tests",
766    host_supported: true,
767
768    shared_libs: [
769        "libaudioutils",
770        "libcutils",
771        "liblog",
772    ],
773    srcs: ["spatializer_utils_tests.cpp"],
774    cflags: [
775        "-Wall",
776        "-Werror",
777    ],
778}
779
780cc_test {
781    name: "spdif_tests",
782    host_supported: true,
783
784    shared_libs: [
785        "libaudiospdif",
786        "libaudioutils",
787        "libcutils",
788        "liblog",
789    ],
790    srcs: ["spdif_tests.cpp"],
791    cflags: [
792        "-Wall",
793        "-Werror",
794    ],
795}
796