os: if inet_ntop() is available, use it for IPv4 addresses as well
[xserver.git] / test / meson.build
blob7c16631759f7e78f106ff6d5c279ad0e40901fff
1 simple_xinit = executable(
2     'simple-xinit',
3     'simple-xinit.c',
4     include_directories: inc,
5     dependencies: [ xproto_dep ],
8 piglit_env = environment()
9 piglit_env.set('XSERVER_DIR', meson.project_source_root())
10 piglit_env.set('XSERVER_BUILDDIR', meson.project_build_root())
12 gles20_env = environment()
13 gles20_env.set('XSERVER_DIR', meson.project_source_root())
14 gles20_env.set('XSERVER_BUILDDIR', meson.project_build_root())
15 gles20_env.set('MESA_GLES_VERSION_OVERRIDE', '2.0')
17 some_ops = ' -o clear,src,dst,over,xor,disjointover'
18 gles2_working_formats = ' -f '+ ','.join(['a8',
19                                           'a8r8g8b8',
20                                           'x8r8g8b8',
21                                           'b8g8r8a8',
22                                           'b8g8r8x8',
23                                           'r8g8b8',
24                                           'r5g5b5',
25                                           'b5g5r5',
26                                           'r5g6b5',
27                                           'b5g6r5',
28                                           'b8g8r8',
29                                           'x8b8g8r8',
30                                           'x2r10g10b10',
31                                           'x2b10g10r10'])
32 rendercheck_tests_noblend = [
33     ['blend/All/a8r8g8b8', '-t blend -f a8r8g8b8'],
34     ['blend/All/x8r8g8b8', '-t blend -f a8r8g8b8,x8r8g8b8'],
35     ['blend/All/a2r10g10b10', '-t blend -f a8r8g8b8,a2r10g10b10'],
36     ['composite/Some/a8r8g8b8', '-t composite -f a8r8g8b8' + some_ops],
37     ['composite/Some/x8r8g8b8', '-t composite -f a8r8g8b8,x8r8g8b8' + some_ops],
38     ['composite/Some/a2r10g10b10', '-t composite -f a8r8g8b8,a2r10g10b10' + some_ops],
39     ['ca composite/Some/a8r8g8b8', '-t cacomposite -f a8r8g8b8' + some_ops],
40     ['ca composite/Some/x8r8g8b8', '-t cacomposite -f a8r8g8b8,x8r8g8b8' + some_ops],
41     ['ca composite/Some/a2r10g10b10', '-t cacomposite -f a8r8g8b8,a2r10g10b10' + some_ops],
42     ['fill', '-t fill'],
43     ['bug7366', '-t bug7366'],
44     ['destination coordinates', '-t dcoords'],
45     ['source coordinates', '-t scoords'],
46     ['mask coordinates', '-t mcoords'],
47     ['translated source coordinates', '-t tscoords'],
48     ['translated mask coordinates', '-t tmcoords'],
49     ['triangles', '-t triangles'],
50     ['LibreOffice xRGB', '-t libreoffice_xrgb'],
51     ['GTK ARGB vs xBGR', '-t gtk_argb_xbgr'],
53 rendercheck_blend = [
54     ['blend/Clear', '-t blend -o clear'],
55     ['blend/Src', '-t blend -o src'],
56     ['blend/Over', '-t blend -o over'],
58 #A8 test failing on GLES 2.0 llvmpipe before mesa 23.
59 rendercheck_a8 = [
60     ['ca composite/Some/a8', '-t cacomposite -f a8r8g8b8,a8' + some_ops],
62 #Exclude 15bpp for now due to GLES limitation (see glamor.c:470)
63 rendercheck_blend_gles2 = [
64     ['blend/Clear', '-t blend -o clear' + gles2_working_formats],
65     ['blend/Src', '-t blend -o src' + gles2_working_formats],
66     ['blend/Over', '-t blend -o over' + gles2_working_formats],
68 rendercheck_tests = rendercheck_blend + rendercheck_tests_noblend + rendercheck_a8
69 rendercheck_tests_gles2_success = rendercheck_blend_gles2 + rendercheck_tests_noblend
70 rendercheck_tests_gles3 = rendercheck_blend_gles2 + rendercheck_tests_noblend + rendercheck_a8
71 rendercheck = find_program('rendercheck', required:false)
73 if get_option('xvfb')
74     xvfb_args = [
75         xvfb_server.full_path(),
76         '-screen',
77         'scrn',
78         '1280x1024x24',
79     ]
81     test('XTS',
82         find_program('scripts/xvfb-piglit.sh'),
83         env: piglit_env,
84         timeout: 1200,
85         suite: 'xvfb'
86     )
88     if rendercheck.found()
89         foreach rctest: rendercheck_tests
90             test(rctest[0],
91                  simple_xinit,
92                  # Use full_path so people can copy and paste the
93                  # command line from testlog.txt easily.
94                  args: [
95                      rendercheck.full_path(),
96                      rctest[1].split(' '),
97                      '--',
98                      xvfb_args,
99                  ],
100                  suite: 'xvfb'
101                 )
102         endforeach
103     endif
105     if get_option('xephyr') and build_glamor
106         foreach testsuite : ['','-gles2','-gles3']
107             test_env = piglit_env
108             if(testsuite == '-gles2')
109                 test_env = gles20_env
110             endif
111             test('XTS',
112                 find_program('scripts/xephyr-glamor' + testsuite + '-piglit.sh'),
113                 env: piglit_env,
114                 timeout: 1200,
115                 suite: 'xephyr-glamor' + testsuite,
116             )
117         endforeach
118         test_parameters = [
119                 [rendercheck_tests, '', piglit_env, '', false],
120                 [rendercheck_tests_gles2_success, '_gles2', gles20_env, '-gles2', false],
121                 [rendercheck_a8, '_gles2', gles20_env, '-gles2', true],
122                 [rendercheck_tests_gles3, '_gles2', piglit_env, '-gles3', false]
123             ]
125         if rendercheck.found()
126             foreach testsuite : test_parameters
127                 foreach rctest : testsuite[0]
128                     test(rctest[0],
129                         simple_xinit,
130                         args: [simple_xinit.full_path(),
131                                 rendercheck.full_path(),
132                                 rctest[1].split(' '),
133                                 '----',
134                                 xephyr_server.full_path(),
135                                 '-glamor' + testsuite[1],
136                                 '-glamor-skip-present',
137                                 '-schedMax', '2000',
138                                 '--',
139                                 xvfb_args,
140                             ],
141                         env: testsuite[2],
142                         suite: 'xephyr-glamor' + testsuite[3],
143                         should_fail: testsuite[4],
144                         timeout: 300,
145                         )
146                 endforeach
147             endforeach
148         endif
149     endif
150 endif
152 if build_xwayland
153     xwayland_args = [
154         xwayland_server.full_path(),
155     ]
157     test('XTS',
158         find_program('scripts/xwayland-piglit.sh'),
159         env: piglit_env,
160         timeout: 1200,
161         suite: 'xwayland'
162     )
163 endif
165 subdir('bigreq')
166 subdir('damage')
167 subdir('sync')
168 subdir('bugs')
170 if build_xorg
171 # Tests that require at least some DDX functions in order to fully link
172 # For now, requires xf86 ddx, could be adjusted to use another
173     unit_sources = [
174      '../mi/miinitext.c',
175      '../mi/miinitext.h',
176      '../mi/micmap.c',
177      '../mi/micmap.h',
178      'fixes.c',
179      'input.c',
180      'list.c',
181      'misc.c',
182      'signal-logging.c',
183      'string.c',
184      'test_xkb.c',
185      'tests-common.c',
186      'tests.c',
187      'touch.c',
188      'xfree86.c',
189      'xtest.c',
190     ]
191     unit_c_args = ['-DXORG_TESTS']
192     unit_includes = [inc, xorg_inc]
194     if build_res
195         unit_sources += ['hashtabletest.c']
196         unit_c_args += ['-DRES_TESTS']
197     endif
199     if meson.get_compiler('c').has_link_argument('-Wl,-wrap')
200        # LTO breaks with -Wl,-wrap on certain configurations
201        unit_c_args += ['-fno-lto']
202        unit_sources += [
203         'xi1/protocol-xchangedevicecontrol.c',
204         'xi2/protocol-common.c',
205         'xi2/protocol-xiqueryversion.c',
206         'xi2/protocol-xiquerydevice.c',
207         'xi2/protocol-xiselectevents.c',
208         'xi2/protocol-xigetselectedevents.c',
209         'xi2/protocol-xisetclientpointer.c',
210         'xi2/protocol-xigetclientpointer.c',
211         'xi2/protocol-xiquerypointer.c',
212         'xi2/protocol-xipassivegrabdevice.c',
213         'xi2/protocol-xiwarppointer.c',
214         'xi2/protocol-eventconvert.c',
215         'xi2/xi2.c',
216        ]
217        unit_c_args += ['-DLDWRAP_TESTS']
218        unit_includes += [include_directories('xi1', 'xi2')]
219        ldwraps = [
220         '-Wl,-wrap,dixLookupWindow',
221         '-Wl,-wrap,dixLookupClient',
222         '-Wl,-wrap,WriteToClient',
223         '-Wl,-wrap,dixLookupWindow',
224         '-Wl,-wrap,XISetEventMask',
225         '-Wl,-wrap,AddResource',
226         '-Wl,-wrap,GrabButton',
227        ]
228     else
229        ldwraps = []
230        message('ld -wrap required for xi1 & xi2 unit tests, skipping')
231     endif
233     unit = executable('tests',
234          unit_sources,
235          c_args: unit_c_args,
236          dependencies: [x11_dep, pixman_dep, randrproto_dep, inputproto_dep, libxcvt_dep],
237          include_directories: unit_includes,
238          link_args: ldwraps,
239          link_with: xorg_link,
240     )
242     test('unit', unit)
243 endif