]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #26528 from keszybz/valgrind-simplification
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Feb 2023 14:04:12 +0000 (23:04 +0900)
committerGitHub <noreply@github.com>
Wed, 22 Feb 2023 14:04:12 +0000 (23:04 +0900)
Drop the -Dvalgrind configuration option

1  2 
meson.build

diff --combined meson.build
index 347e09b0e0b871a668f25fffc49e41533d7a7afb,8e37a06b310fbe9f75fff61ffb2895a9f89009b5..0476d972d009007bfa4ca24e56dd791e6a77c456
@@@ -1020,8 -1020,6 +1020,6 @@@ endforeac
  conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
  conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
  conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
- conf.set10('VALGRIND', get_option('valgrind'))
  conf.set10('LOG_TRACE', get_option('log-trace'))
  
  default_user_path = get_option('user-path')
@@@ -1936,9 -1934,7 +1934,9 @@@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT'
  ############################################################
  
  tests = []
 +simple_tests = []
  fuzzers = []
 +simple_fuzzers = []
  catalogs = []
  
  ############################################################
@@@ -4078,51 -4074,57 +4076,51 @@@ if '-O2' in c_args and '-flto=auto' in 
          test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
  endif
  
 -foreach tuple : tests
 -        sources = tuple[0]
 -        link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
 -        dependencies = tuple.length() > 2 ? tuple[2] : []
 -        incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
 -        condition = tuple.length() > 4 ? tuple[4] : ''
 -        type = tuple.length() > 5 ? tuple[5] : ''
 -        defs = tuple.length() > 6 ? tuple[6] : []
 -        defs += test_cflags
 -        parallel = tuple.length() > 7 ? tuple[7] : true
 -        timeout = 30
 +foreach test : simple_tests
 +        tests += { 'sources' : [test] }
 +endforeach
 +
 +foreach test : tests
 +        sources = test.get('sources')
 +        condition = test.get('condition', '')
 +        type = test.get('type', '')
 +        base = test.get('base', {})
  
          # FIXME: Use fs.stem() with meson >= 0.54.0
          name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
 -        if type.startswith('timeout=')
 -                timeout = type.split('=')[1].to_int()
 -                type = ''
 -        endif
  
          suite = fs.name(fs.parent('@0@'.format(sources[0])))
          # FIXME: Use str.replace() with meson >= 0.58.0
          suite = suite.split('sd-')[-1]
  
 -        if condition == '' or conf.get(condition) == 1
 -                exe = executable(
 -                        name,
 -                        sources,
 -                        include_directories : incs,
 -                        link_with : link_with,
 -                        dependencies : [versiondep,
 -                                        dependencies],
 -                        c_args : defs,
 -                        build_by_default : want_tests != 'false',
 -                        install_rpath : rootpkglibdir,
 -                        install : install_tests,
 -                        install_dir : testsdir / type,
 -                        link_depends : runtest_env)
 -
 -                if type == 'manual'
 -                        message('@0@ is a manual test'.format(name))
 -                elif type == 'unsafe' and want_tests != 'unsafe'
 -                        message('@0@ is an unsafe test'.format(name))
 -                elif want_tests != 'false'
 -                        test(name, exe,
 -                             env : test_env,
 -                             timeout : timeout,
 -                             suite : suite,
 -                             is_parallel : parallel)
 -                endif
 -        else
 +        if condition != '' and conf.get(condition) == 0
                  message('Not compiling @0@ because @1@ is not true'.format(name, condition))
 +                continue
 +        endif
 +
 +        exe = executable(
 +                name,
 +                sources,
 +                include_directories : [base.get('includes', []), test.get('includes', includes)],
 +                link_with : [base.get('link_with', []), test.get('link_with', libshared)],
 +                dependencies : [versiondep, base.get('dependencies', []), test.get('dependencies', [])],
 +                c_args : [test_cflags, test.get('c_args', [])],
 +                build_by_default : want_tests != 'false',
 +                install_rpath : rootpkglibdir,
 +                install : install_tests,
 +                install_dir : testsdir / type,
 +                link_depends : runtest_env)
 +
 +        if type == 'manual'
 +                message('@0@ is a manual test'.format(name))
 +        elif type == 'unsafe' and want_tests != 'unsafe'
 +                message('@0@ is an unsafe test'.format(name))
 +        elif want_tests != 'false'
 +                test(name, exe,
 +                        env : test_env,
 +                        timeout : test.get('timeout', 30),
 +                        suite : suite,
 +                        is_parallel : test.get('parallel', true))
          endif
  endforeach
  
@@@ -4180,16 -4182,14 +4178,16 @@@ endi
  
  ############################################################
  
 +foreach fuzzer : simple_fuzzers
 +        fuzzers += { 'sources' : [fuzzer] }
 +endforeach
 +
  fuzzer_exes = []
  
 -foreach tuple : fuzzers
 -        sources = tuple[0]
 -        link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
 -        dependencies = tuple.length() > 2 ? tuple[2] : []
 -        incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
 -        defs = tuple.length() > 4 ? tuple[4] : []
 +foreach fuzzer : fuzzers
 +        sources = fuzzer.get('sources')
 +        base = fuzzer.get('base', {})
 +        dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])]
          link_args = []
  
          if want_ossfuzz
                          link_args += ['-fsanitize=fuzzer']
                  endif
          else
 -                sources += 'src/fuzz/fuzz-main.c'
 +                sources += files('src/fuzz/fuzz-main.c')
          endif
          sources += fuzz_generated_directives
  
          exe = executable(
                  name,
                  sources,
 -                include_directories : [incs, include_directories('src/fuzz')],
 -                link_with : link_with,
 -                dependencies : [dependencies,
 -                                versiondep],
 -                c_args : defs + test_cflags,
 +                include_directories : [
 +                        base.get('includes', []),
 +                        fuzzer.get('includes', includes),
 +                        include_directories('src/fuzz'),
 +                ],
 +                link_with : [base.get('link_with', []), fuzzer.get('link_with', libshared)],
 +                dependencies : [dependencies, versiondep],
 +                c_args : [test_cflags, fuzzer.get('c_args', [])],
                  link_args: link_args,
                  install : false,
                  build_by_default : fuzzer_build)
@@@ -4609,7 -4606,6 +4607,6 @@@ foreach tuple : 
          ['debug hashmap'],
          ['debug mmap cache'],
          ['debug siphash'],
-         ['valgrind',               conf.get('VALGRIND') == 1],
          ['trace logging',          conf.get('LOG_TRACE') == 1],
          ['install tests',          install_tests],
          ['link-udev-shared',       get_option('link-udev-shared')],