1
0
Fork 0

[meson] Do not build test programs by default

If you want run tests, pass -Dtest=true to meson
and run "meson test" at the end.
This commit is contained in:
Witold Filipczyk 2022-11-30 10:17:49 +01:00
parent c18525f481
commit f03d1ea44d
9 changed files with 32 additions and 17 deletions

View File

@ -72,3 +72,4 @@ option('source-date-epoch', type: 'string', value: '', description: 'source date
option('dgi', type: 'boolean', value: false, description: 'DOS Gateway Interface support')
option('mujs', type: 'boolean', value: false, description: 'use mujs library')
option('codepoint', type: 'boolean', value: true, description: 'whether check codepoints on Linux console')
option('test', type: 'boolean', value: false, description: 'whether build test programs')

View File

@ -1,10 +1,12 @@
srcs += files('cookies.c', 'dialogs.c', 'path.c', 'parser.c')
exe = executable('cookies-t', 'cookies-t.c', 'path.c', include_directories:['..'], build_by_default:false)
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})
t = find_program('test-cookies-t')
test('cookies', t, depends:[exe], env:test_lib, workdir:meson.current_build_dir())
if get_option('test')
exe = executable('cookies-t', 'cookies-t.c', 'path.c', include_directories:['..'], build_by_default:false)
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})
t = find_program('test-cookies-t')
test('cookies', t, depends:[exe], env:test_lib, workdir:meson.current_build_dir())
parsetstdeps = files('parser.c', 'parsetst.c')
parsetstdeps = files('parser.c', 'parsetst.c')
executable('parsetst', parsetstdeps, testdeps, dependencies:[iconvdeps], c_args:['-DHAVE_CONFIG_H'], include_directories:['.', '..', '../..'])
executable('parsetst', parsetstdeps, testdeps, dependencies:[iconvdeps], c_args:['-DHAVE_CONFIG_H'], include_directories:['.', '..', '../..'])
endif

View File

@ -1,3 +1,5 @@
subdir('parser')
subdir('test')
if get_option('test')
subdir('test')
endif
srcs += files('frames.c', 'iframes.c', 'parse-meta-refresh.c', 'parser.c', 'renderer.c', 'tables.c')

View File

@ -1,4 +1,7 @@
subdir('css')
subdir('sgml')
srcs += files('configuration.c', 'node.c', 'select.c', 'stack.c', 'scanner.c')
subdir('test')
if get_option('test')
subdir('test')
endif

View File

@ -28,6 +28,7 @@ meson.source_root()+'/src/dom/sgml/xbel/xbel.c',
testdeps,
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.', '../..', '../../..'],
build_by_default:false)
endif
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})

View File

@ -10,7 +10,7 @@ endif
srcs += files('common.c', 'default.c')
if conf_data.get('CONFIG_MAILCAP')
if conf_data.get('CONFIG_MAILCAP') and get_option('test')
mailcap_cache_files = files('common.c', 'mailcap.c', meson.source_root()+'/src/osdep/osdep.c')
if conf_data.get('CONFIG_NLS') and not conf_data.get('CONFIG_GETTEXT')

View File

@ -1,2 +1,4 @@
srcs += files('match-hostname.c', 'ssl.c', 'socket.c')
subdir('test')
if get_option('test')
subdir('test')
endif

View File

@ -1,9 +1,11 @@
srcs += files('ftp.c', 'parse.c')
exe = executable('ftp-parser', 'ftp-parser.c', 'parse.c', meson.source_root()+'/src/protocol/date.c', testdeps, dependencies:[iconvdeps],
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.','../..','../../..'],
build_by_default:false)
if get_option('test')
exe = executable('ftp-parser', 'ftp-parser.c', 'parse.c', meson.source_root()+'/src/protocol/date.c', testdeps, dependencies:[iconvdeps],
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.','../..','../../..'],
build_by_default:false)
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})
t = find_program('test-ftp-parser')
test('ftp-parser', t, depends:[exe], env:test_lib, workdir:meson.current_build_dir(), is_parallel:false)
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})
t = find_program('test-ftp-parser')
test('ftp-parser', t, depends:[exe], env:test_lib, workdir:meson.current_build_dir(), is_parallel:false)
endif

View File

@ -34,4 +34,6 @@ if conf_data.get('CONFIG_DATA')
endif
srcs += files('about.c', 'common.c', 'date.c', 'header.c', 'protocol.cpp', 'proxy.c', 'uri.c', 'user.c')
subdir('test')
if get_option('test')
subdir('test')
endif