18018391dSZane Shelley# Get the gtest/gmock dependencies. 28018391dSZane Shelleygtest_dep = dependency('gtest', main: true, disabler: true, required: false) 38018391dSZane Shelleygmock_dep = dependency('gmock', disabler: true, required: false) 48018391dSZane Shelleyif not gtest_dep.found() or not gmock_dep.found() 58018391dSZane Shelley cmake = import('cmake') 68018391dSZane Shelley gtest_proj = cmake.subproject('googletest', 78018391dSZane Shelley required: false) 88018391dSZane Shelley if gtest_proj.found() 98018391dSZane Shelley gtest_dep = declare_dependency( 108018391dSZane Shelley dependencies: [ 118018391dSZane Shelley dependency('threads'), 128018391dSZane Shelley gtest_proj.dependency('gtest'), 138018391dSZane Shelley gtest_proj.dependency('gtest_main'), 148018391dSZane Shelley ] 158018391dSZane Shelley ) 168018391dSZane Shelley gmock_dep = gtest_proj.dependency('gmock') 178018391dSZane Shelley else 188018391dSZane Shelley assert(not get_option('tests').enabled(), 198018391dSZane Shelley 'Googletest is required if tests are enabled') 208018391dSZane Shelley endif 218018391dSZane Shelleyendif 228018391dSZane Shelley 230c44c2feSZane Shelleytest_arg = [ 240c44c2feSZane Shelley '-DTEST_TRACE', 250c44c2feSZane Shelley] 260c44c2feSZane Shelley 27*afc6acdaSZane Shelley# Compile the test dts into a binary for pdbg. 28*afc6acdaSZane Shelleypdbg_test_dtb = custom_target('build_pdbg_test_dtb', 29*afc6acdaSZane Shelley input : files('pdbg_test.dts'), 30*afc6acdaSZane Shelley output : 'pdbg_test.dtb', 31*afc6acdaSZane Shelley command : [ find_program('dtc'), '-I', 'dts', '-O', 'dtb', 32*afc6acdaSZane Shelley '-o', '@OUTPUT@', '@INPUT@' ]) 33*afc6acdaSZane Shelley 349ae5ca41SBen Tyner# end2end code exerciser for experiment and testing 359ae5ca41SBen Tynersubdir('end2end') 369ae5ca41SBen Tyner 37248cbf83SZane Shelleytests = [ 38d26298b1SZane Shelley 'bin_stream_test', 39982f1722SZane Shelley 'ffdc_file_test', 400b8368cbSZane Shelley 'resolution_test', 41248cbf83SZane Shelley] 42248cbf83SZane Shelley 43979e2871SZane Shelleyanalyzer_src = files( 44979e2871SZane Shelley '../analyzer/service_data.cpp', 45979e2871SZane Shelley) 46979e2871SZane Shelley 47248cbf83SZane Shelleyforeach t : tests 48*afc6acdaSZane Shelley test(t, 49*afc6acdaSZane Shelley executable(t.underscorify(), 50*afc6acdaSZane Shelley [ files(t + '.cpp'), pdbg_test_dtb, analyzer_src ], 51982f1722SZane Shelley link_with : [ util_lib ], 528018391dSZane Shelley dependencies : [ libhei_dep, gtest_dep ], 538af9e46fSZane Shelley cpp_args : test_arg, 54*afc6acdaSZane Shelley include_directories : incdir), 55*afc6acdaSZane Shelley env : [ 'PDBG_DTB=' + pdbg_test_dtb.full_path() ]) 56248cbf83SZane Shelleyendforeach 57