xref: /aosp_15_r20/external/virglrenderer/tests/meson.build (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1#############################################################################
2#
3# Copyright (C) 2019 Collabora Ltd
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom the
10# Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21# OTHER DEALINGS IN THE SOFTWARE.
22#
23
24check_dep = dependency('check')
25
26libvrtest_sources = [
27   'testvirgl.c',
28   'testvirgl.h',
29   'testvirgl_encode.c',
30   'testvirgl_encode.h',
31]
32
33libvrtest_depends = [
34   libvirgl_dep,
35   gallium_dep,
36   check_dep,
37]
38
39if with_tracing == 'percetto'
40   libvrtest_depends += [percetto_dep]
41endif
42
43libvrtest = static_library(
44   'vrtest',
45   libvrtest_sources,
46   dependencies : libvrtest_depends
47)
48
49tests = [
50   ['test_virgl_init', 'test_virgl_init.c'],
51   ['test_virgl_fence', 'test_virgl_fence.c'],
52   ['test_virgl_resource', 'test_virgl_resource.c'],
53   ['test_virgl_transfer', 'test_virgl_transfer.c'],
54   ['test_virgl_cmd', 'test_virgl_cmd.c'],
55   ['test_virgl_strbuf', 'test_virgl_strbuf.c']
56]
57
58fuzzy_tests = [
59   ['test_fuzzer_formats', 'test_fuzzer_formats.c'],
60]
61
62test_depends = [
63   libvirglrenderer_dep,
64   check_dep,
65]
66
67if with_tracing == 'percetto'
68   test_depends += [percetto_dep]
69endif
70
71foreach t : tests
72   test_virgl = executable(t[0], t[1], link_with: libvrtest,
73                           dependencies : test_depends)
74   test(t[0], test_virgl)
75endforeach
76
77
78fuzzytest_depends = [
79   libvirglrenderer_dep,
80   epoxy_dep,
81]
82
83if with_tracing == 'percetto'
84   fuzzytest_depends += [percetto_dep]
85endif
86
87foreach t : fuzzy_tests
88   test_virgl_fuzzy = executable(t[0], t[1], link_with: libvrtest,
89                                 dependencies : fuzzytest_depends)
90   test(t[0], test_virgl)
91endforeach
92
93
94if with_valgrind
95   valgrind = find_program('valgrind')
96   surpression_path = join_paths(meson.current_source_dir(), 'valgrind.suppressions')
97   args = ['--leak-check=full', '--quiet', '--error-exitcode=3',
98           '--suppressions='+ surpression_path]
99   foreach t : tests
100      test('valgrind-' + t[0],
101           valgrind,
102           args : args + [join_paths(meson.current_build_dir(), t[0])],
103           timeout : 1800)
104   endforeach
105endif
106
107if with_fuzzer
108   subdir('fuzzer')
109endif
110