Merge pull request #23246 from medhefgo/check-compilation

meson: Improve public header tests
This commit is contained in:
Evgeny Vereshchagin 2022-05-05 01:53:28 +03:00 committed by GitHub
commit 51cef2b56f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 14 deletions

View file

@ -61,6 +61,7 @@ if conf.get('ENABLE_HWDB') == 1
parse_hwdb_py = find_program('parse_hwdb.py')
test('parse-hwdb',
parse_hwdb_py,
suite : 'dist-check',
args : [hwdb_files_test,
auto_suspend_rules],
timeout : 90)

View file

@ -226,6 +226,7 @@ update_dbus_docs = custom_target(
if conf.get('BUILD_MODE_DEVELOPER') == 1
test('dbus-docs-fresh',
update_dbus_docs_py,
suite : 'dist-check',
args : ['--build-dir', project_build_root, '--test', dbus_docs],
depends : dbus_programs)
endif

View file

@ -289,7 +289,6 @@ conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format
cc = meson.get_compiler('c')
pkgconfig = import('pkgconfig')
check_compilation_sh = find_program('tools/check-compilation.sh')
meson_build_sh = find_program('tools/meson-build.sh')
want_tests = get_option('tests')
@ -3519,6 +3518,7 @@ if conf.get('ENABLE_HWDB') == 1
if want_tests != 'false'
test('hwdb-test',
hwdb_test_sh,
suite : 'dist-check',
args : [systemd_hwdb.full_path()],
timeout : 90)
endif
@ -3879,6 +3879,7 @@ foreach tuple : fuzzers
if b == name
test('@0@_@1@'.format(b, c),
exe,
suite : 'fuzzers',
args : [project_source_root / p])
endif
endforeach
@ -3941,6 +3942,7 @@ jekyll = find_program('jekyll', required : false)
if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
test('github-pages',
jekyll,
suite : 'dist-check',
args : ['build',
'--source', project_source_root / 'docs',
'--destination', project_build_root / '_site'])
@ -3956,11 +3958,13 @@ foreach exec : public_programs
if want_tests != 'false'
test('check-help-' + name,
check_help,
suite : 'dist-check',
args : exec.full_path(),
depends: exec)
test('check-version-' + name,
check_version,
suite : 'dist-check',
args : [exec.full_path(),
meson.project_version()],
depends: exec)
@ -3974,6 +3978,7 @@ check_directives_sh = find_program('tools/check-directives.sh')
if want_tests != 'false'
test('check-directives',
check_directives_sh,
suite : 'dist-check',
args : [project_source_root, project_build_root])
endif
@ -4013,6 +4018,7 @@ foreach tuple : sanitizers
if fuzz_tests
test('@0@_@1@_@2@'.format(b, c, sanitizer),
env,
suite : 'fuzz+san',
env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
timeout : 60,
args : [exe.full_path(),

View file

@ -46,6 +46,10 @@ install_headers(
############################################################
if want_tests == 'false'
subdir_done()
endif
opts = [['c'],
['c', '-ansi'],
['c', '-std=iso9899:1990'],
@ -73,13 +77,17 @@ endif
foreach header : _systemd_headers + _not_installed_headers + [libudev_h_path]
foreach opt : opts
std_name = opt.length() == 2 ? '_'.join(opt[1].split(':')) : ''
name = ''.join(['cc-', header.split('/')[-1], '_', opt[0], std_name])
if want_tests != 'false'
test(name,
check_compilation_sh,
args : cc.cmd_array() + ['-c', '-x'] + opt +
['-Werror', '-include',
meson.current_source_dir() / header])
endif
test('cc-' + header.split('/')[-1] + '_' + opt[0] + std_name,
env,
suite : 'headers',
args : [cc.cmd_array(),
'-c',
'-x', opt,
'-Wall',
'-Wextra',
'-Werror',
'-include', meson.current_source_dir() / header,
'-o/dev/null',
'/dev/null'])
endforeach
endforeach

View file

@ -112,6 +112,7 @@ rule_syntax_check_py = find_program('rule-syntax-check.py')
if want_tests != 'false'
test('rule-syntax-check',
rule_syntax_check_py,
suite : 'dist-check',
args : all_rules)
endif
@ -162,6 +163,7 @@ if rpm.found() and rpmspec.found()
if want_tests != 'false'
test('test-rpm-macros',
test_rpm_macros,
suite : 'dist-check',
args : [project_build_root])
endif
else
@ -191,6 +193,7 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
test(name,
udev_dmi_memory_id_test,
suite : 'dist-check',
args : [udev_prog_paths['dmi_memory_id'].full_path(),
source,
source + '.txt'],

View file

@ -1,5 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
"$@" '-' -o/dev/null </dev/null