Skip to content

Commit e4cebc8

Browse files
committed
Do not build tests in release mode
Assertions would not be executed. And as a side effect, it causes "unused variable" warnings.
1 parent ba1b367 commit e4cebc8

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

app/meson.build

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -141,40 +141,43 @@ install_man('scrcpy.1')
141141

142142
### TESTS
143143

144-
tests = [
145-
['test_buffer_util', [
146-
'tests/test_buffer_util.c'
147-
]],
148-
['test_cbuf', [
149-
'tests/test_cbuf.c',
150-
]],
151-
['test_cli', [
152-
'tests/test_cli.c',
153-
'src/cli.c',
154-
'src/util/str_util.c',
155-
]],
156-
['test_control_event_serialize', [
157-
'tests/test_control_msg_serialize.c',
158-
'src/control_msg.c',
159-
'src/util/str_util.c',
160-
]],
161-
['test_device_event_deserialize', [
162-
'tests/test_device_msg_deserialize.c',
163-
'src/device_msg.c',
164-
]],
165-
['test_queue', [
166-
'tests/test_queue.c',
167-
]],
168-
['test_strutil', [
169-
'tests/test_strutil.c',
170-
'src/util/str_util.c',
171-
]],
172-
]
144+
# do not build tests in release (assertions would not be executed at all)
145+
if get_option('buildtype') == 'debug'
146+
tests = [
147+
['test_buffer_util', [
148+
'tests/test_buffer_util.c'
149+
]],
150+
['test_cbuf', [
151+
'tests/test_cbuf.c',
152+
]],
153+
['test_cli', [
154+
'tests/test_cli.c',
155+
'src/cli.c',
156+
'src/util/str_util.c',
157+
]],
158+
['test_control_event_serialize', [
159+
'tests/test_control_msg_serialize.c',
160+
'src/control_msg.c',
161+
'src/util/str_util.c',
162+
]],
163+
['test_device_event_deserialize', [
164+
'tests/test_device_msg_deserialize.c',
165+
'src/device_msg.c',
166+
]],
167+
['test_queue', [
168+
'tests/test_queue.c',
169+
]],
170+
['test_strutil', [
171+
'tests/test_strutil.c',
172+
'src/util/str_util.c',
173+
]],
174+
]
173175

174-
foreach t : tests
175-
exe = executable(t[0], t[1],
176-
include_directories: src_dir,
177-
dependencies: dependencies,
178-
c_args: ['-DSDL_MAIN_HANDLED'])
179-
test(t[0], exe)
180-
endforeach
176+
foreach t : tests
177+
exe = executable(t[0], t[1],
178+
include_directories: src_dir,
179+
dependencies: dependencies,
180+
c_args: ['-DSDL_MAIN_HANDLED'])
181+
test(t[0], exe)
182+
endforeach
183+
endif

0 commit comments

Comments
 (0)