tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

meson.build (2566B)


      1 # test suite
      2 
      3 # XXX: Makefile only runs test_srtp and srtp_driver with valgrind
      4 add_test_setup('valgrind',
      5  exe_wrapper: ['valgrind', '--leak-check=full'],
      6  timeout_multiplier: 10)
      7 
      8 test_apps = [
      9  ['srtp_driver', {'extra_sources': 'util.c', 'run_args': '-v'}],
     10  ['replay_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}],
     11  ['roc_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}],
     12  ['rdbx_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}],
     13  ['test_srtp', {'run_args': '-v'}],
     14  ['rtpw', {'extra_sources': ['rtp.c', 'util.c', '../crypto/math/datatypes.c'], 'define_test': false}],
     15 ]
     16 
     17 foreach t : test_apps
     18  test_name = t.get(0)
     19  test_dict = t.get(1, {})
     20  test_extra_sources = test_dict.get('extra_sources', [])
     21  test_run_args = test_dict.get('run_args', [])
     22 
     23  test_exe = executable(test_name,
     24    '@0@.c'.format(test_name), 'getopt_s.c', test_extra_sources,
     25    include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs],
     26    dependencies: [srtp2_deps, syslibs],
     27    link_with: libsrtp2_for_tests)
     28 
     29  if test_dict.get('define_test', true)
     30    test(test_name, test_exe, args: test_run_args)
     31  else
     32    set_variable(test_name + '_exe', test_exe)
     33  endif
     34 endforeach
     35 
     36 # rtpw test needs to be run using shell scripts
     37 can_run_rtpw = find_program('sh', 'bash', required: false).found()
     38 
     39 # Meson only passes the exe_wrapper to shell scripts starting 0.55
     40 if meson.is_cross_build() and meson.version().version_compare('<0.55')
     41  can_run_rtpw = false
     42 endif
     43 
     44 if can_run_rtpw
     45  words_txt = files('words.txt')
     46 
     47  rtpw_test_sh = find_program('rtpw_test.sh', required: false)
     48  if rtpw_test_sh.found()
     49    test('rtpw_test', rtpw_test_sh,
     50         args: ['-w', words_txt],
     51         depends: rtpw_exe,
     52         is_parallel: false,
     53         workdir: meson.current_build_dir())
     54  endif
     55 
     56  rtpw_test_gcm_sh = find_program('rtpw_test_gcm.sh', required: false)
     57  if (use_openssl or use_nss or use_mbedtls) and rtpw_test_gcm_sh.found()
     58    test('rtpw_test_gcm', rtpw_test_gcm_sh,
     59         args: ['-w', words_txt],
     60         depends: rtpw_exe,
     61         is_parallel: false,
     62         workdir: meson.current_build_dir())
     63  endif
     64 endif
     65 
     66 # rtp_decoder
     67 pcap_dep = dependency('libpcap', required: get_option('pcap-tests'))
     68 
     69 if pcap_dep.found()
     70  executable('rtp_decoder',
     71    'rtp_decoder.c', 'getopt_s.c', 'rtp.c', 'util.c', 'getopt_s.c',
     72    '../crypto/math/datatypes.c',
     73    include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs],
     74    dependencies: [srtp2_deps, pcap_dep, syslibs],
     75    link_with: libsrtp2,
     76    install: false)
     77 endif