From 678ba020337d93552251e2c05bd68c84218f8c8b Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Tue, 22 Feb 2022 10:49:46 +0000 Subject: [PATCH 1/3] meson: allow skipping optional dependencies mostly to make sure that systemd is buildable without some dependencies but other than that it should make it easier to build it with MSan without having to compile all the dependencies with MSan. --- meson.build | 2 +- meson_options.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 428ebb2102..371a9ce751 100644 --- a/meson.build +++ b/meson.build @@ -40,7 +40,7 @@ if want_ossfuzz and want_libfuzzer error('only one of oss-fuzz or llvm-fuzz can be specified') endif -skip_deps = want_ossfuzz +skip_deps = want_ossfuzz or get_option('skip-deps') fuzzer_build = want_ossfuzz or want_libfuzzer # Create a title-less summary section early, so it ends up first in the output. diff --git a/meson_options.txt b/meson_options.txt index fa8c0b5e3f..5d635748d5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -484,3 +484,6 @@ option('analyze', type: 'boolean', value: 'true', option('bpf-framework', type : 'combo', choices : ['auto', 'true', 'false'], description: 'build BPF programs from source code in restricted C') + +option('skip-deps', type : 'boolean', value : 'false', + description : 'skip optional dependencies') From ca57d11652c8d6c3fb012107c40b530e11cf30ac Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Tue, 22 Feb 2022 11:02:44 +0000 Subject: [PATCH 2/3] ci: build systemd without optional dependencies to catch issues like https://github.com/systemd/systemd/pull/22585#issuecomment-1047640155 --- .github/workflows/unit_tests.sh | 8 ++++++-- .github/workflows/unit_tests.yml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh index 37594cb95e..ec22bc081f 100755 --- a/.github/workflows/unit_tests.sh +++ b/.github/workflows/unit_tests.sh @@ -63,16 +63,20 @@ for phase in "${PHASES[@]}"; do ninja -C build -v meson test -C build --print-errorlogs ;; - RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN) + RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN_NO_DEPS) MESON_ARGS=(--optimization=1) - if [[ "$phase" = "RUN_CLANG_ASAN_UBSAN" ]]; then + if [[ "$phase" =~ ^RUN_CLANG_ASAN_UBSAN ]]; then export CC=clang export CXX=clang++ # Build fuzzer regression tests only with clang (for now), # see: https://github.com/systemd/systemd/pull/15886#issuecomment-632689604 # -Db_lundef=false: See https://github.com/mesonbuild/meson/issues/764 MESON_ARGS+=(-Db_lundef=false -Dfuzz-tests=true) + + if [[ "$phase" == "RUN_CLANG_ASAN_UBSAN_NO_DEPS" ]]; then + MESON_ARGS+=(-Dskip-deps=true) + fi fi run_meson --fatal-meson-warnings -Dnobody-group=nogroup --werror -Dtests=unsafe -Db_sanitize=address,undefined "${MESON_ARGS[@]}" build ninja -C build -v diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index d4a4f3c723..3c8fb54850 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_ASAN_UBSAN] + run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS] cryptolib: [auto] include: - run_phase: GCC From fb53316fde746f0c4bb4313a34f7cfb4e82e87cb Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Tue, 22 Feb 2022 17:47:48 +0000 Subject: [PATCH 3/3] meson: pass skip-deps on to the fuzzers as well they should be tested without optional dependecines as well. CIFuzz kind of covers that but let's just make sure local builds are fine as well. --- test/fuzz/meson.build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build index ccd66c0ccf..80362d4154 100644 --- a/test/fuzz/meson.build +++ b/test/fuzz/meson.build @@ -7,10 +7,11 @@ sanitize_address_undefined = custom_target( project_source_root, '@OUTPUT@', 'fuzzers', - '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dc_args=@2@ -Dcpp_args=@2@'.format( + '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dc_args=@2@ -Dcpp_args=@2@ -Dskip-deps=@3@'.format( get_option('optimization'), get_option('werror') ? '--werror' : '', - '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION' + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', + get_option('skip-deps') ), ' '.join(cc.cmd_array()), cxx_cmd])