meson.build 2.5 KB

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