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 23*9491cdb4SZane Shelley################################################################################ 24*9491cdb4SZane Shelley 2508c21c25SZane Shelley# NOTE: We cannot link to `util_lib` because that is built without 2608c21c25SZane Shelley# `-DTEST_TRACE` and any of the util functions that use `trace.hpp` will 2708c21c25SZane Shelley# throw a linker error because we don't have access to phosphor-logging 2808c21c25SZane Shelley# in test ... yet. 2908c21c25SZane Shelley 300c44c2feSZane Shelleytest_arg = [ 310c44c2feSZane Shelley '-DTEST_TRACE', 32*9491cdb4SZane Shelley package_args, 330c44c2feSZane Shelley] 340c44c2feSZane Shelley 35afc6acdaSZane Shelley# Compile the test dts into a binary for pdbg. 36afc6acdaSZane Shelleypdbg_test_dtb = custom_target('build_pdbg_test_dtb', 3708c21c25SZane Shelley input : files('pdbg-test.dts'), 3808c21c25SZane Shelley output : 'pdbg-test.dtb', 39afc6acdaSZane Shelley command : [ find_program('dtc'), '-I', 'dts', '-O', 'dtb', 40afc6acdaSZane Shelley '-o', '@OUTPUT@', '@INPUT@' ]) 41afc6acdaSZane Shelley 42d195b716SZane Shelleypdbg_env = 'PDBG_DTB=' + pdbg_test_dtb.full_path() 43d195b716SZane Shelley 449ae5ca41SBen Tyner# end2end code exerciser for experiment and testing 459ae5ca41SBen Tynersubdir('end2end') 469ae5ca41SBen Tyner 4708c21c25SZane Shelley################################################################################ 4808c21c25SZane Shelley 4908c21c25SZane Shelleytc = 'test-bin-stream' 5008c21c25SZane Shelley 5108c21c25SZane Shelleysrc = [ 5208c21c25SZane Shelley files( 5308c21c25SZane Shelley tc + '.cpp', 5408c21c25SZane Shelley ), 55248cbf83SZane Shelley] 56248cbf83SZane Shelley 5708c21c25SZane Shelleydep = [ gtest_dep ] 5808c21c25SZane Shelley 5908c21c25SZane Shelleyvar = [ ] 6008c21c25SZane Shelley 6108c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 6208c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 6308c21c25SZane Shelley 6408c21c25SZane Shelleytest(tc, exe, env: var) 6508c21c25SZane Shelley 6608c21c25SZane Shelley################################################################################ 6708c21c25SZane Shelley 6808c21c25SZane Shelleytc = 'test-ffdc-file' 6908c21c25SZane Shelley 7008c21c25SZane Shelleysrc = [ 7108c21c25SZane Shelley files( 7208c21c25SZane Shelley tc + '.cpp', 7308c21c25SZane Shelley '../util/ffdc_file.cpp', 7408c21c25SZane Shelley '../util/temporary_file.cpp', 7508c21c25SZane Shelley ), 7608c21c25SZane Shelley] 7708c21c25SZane Shelley 7808c21c25SZane Shelleydep = [ gtest_dep ] 7908c21c25SZane Shelley 8008c21c25SZane Shelleyvar = [ ] 8108c21c25SZane Shelley 8208c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 8308c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 8408c21c25SZane Shelley 8508c21c25SZane Shelleytest(tc, exe, env: var) 8608c21c25SZane Shelley 8708c21c25SZane Shelley################################################################################ 8808c21c25SZane Shelley 8908c21c25SZane Shelleytc = 'test-lpc-timeout' 9008c21c25SZane Shelley 9108c21c25SZane Shelleysrc = [ 9208c21c25SZane Shelley files( 9308c21c25SZane Shelley tc + '.cpp', 942c228cdcSZane Shelley '../analyzer/plugins/p10-plugins.cpp', 95979e2871SZane Shelley '../analyzer/service_data.cpp', 96cb766a45SZane Shelley '../util/pdbg.cpp', 97e90b85dcSZane Shelley 'pdbg-sim-only.cpp', 9808c21c25SZane Shelley ), 9908c21c25SZane Shelley pdbg_test_dtb, 10008c21c25SZane Shelley] 101e90b85dcSZane Shelley 10208c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ] 10308c21c25SZane Shelley 10408c21c25SZane Shelleyvar = [ pdbg_env ] 10508c21c25SZane Shelley 10608c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 10708c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 10808c21c25SZane Shelley 10908c21c25SZane Shelleytest(tc, exe, env: var) 11008c21c25SZane Shelley 11108c21c25SZane Shelley################################################################################ 11208c21c25SZane Shelley 11308c21c25SZane Shelleytc = 'test-pdbg-dts' 11408c21c25SZane Shelley 11508c21c25SZane Shelleysrc = [ 11608c21c25SZane Shelley files( 11708c21c25SZane Shelley tc + '.cpp', 11808c21c25SZane Shelley '../util/pdbg.cpp', 11908c21c25SZane Shelley ), 12008c21c25SZane Shelley pdbg_test_dtb, 12108c21c25SZane Shelley] 12208c21c25SZane Shelley 12308c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ] 12408c21c25SZane Shelley 12508c21c25SZane Shelleyvar = [ pdbg_env ] 12608c21c25SZane Shelley 12708c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 12808c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 12908c21c25SZane Shelley 13008c21c25SZane Shelleytest(tc, exe, env: var) 13108c21c25SZane Shelley 13208c21c25SZane Shelley################################################################################ 13308c21c25SZane Shelley 13408c21c25SZane Shelleytc = 'test-pll-unlock' 13508c21c25SZane Shelley 13608c21c25SZane Shelleysrc = [ 13708c21c25SZane Shelley files( 13808c21c25SZane Shelley tc + '.cpp', 13908c21c25SZane Shelley '../analyzer/plugins/p10-plugins.cpp', 140*9491cdb4SZane Shelley '../analyzer/ras-data/ras-data-parser.cpp', 141*9491cdb4SZane Shelley '../analyzer/resolution.cpp', 14208c21c25SZane Shelley '../analyzer/service_data.cpp', 143*9491cdb4SZane Shelley '../util/data_file.cpp', 14408c21c25SZane Shelley '../util/pdbg.cpp', 14508c21c25SZane Shelley 'pdbg-sim-only.cpp', 14608c21c25SZane Shelley ), 14708c21c25SZane Shelley pdbg_test_dtb, 14808c21c25SZane Shelley] 14908c21c25SZane Shelley 15008c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ] 15108c21c25SZane Shelley 15208c21c25SZane Shelleyvar = [ pdbg_env ] 15308c21c25SZane Shelley 15408c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 15508c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 15608c21c25SZane Shelley 15708c21c25SZane Shelleytest(tc, exe, env: var) 15808c21c25SZane Shelley 15908c21c25SZane Shelley################################################################################ 16008c21c25SZane Shelley 16108c21c25SZane Shelleytc = 'test-resolution' 16208c21c25SZane Shelley 16308c21c25SZane Shelleysrc = [ 16408c21c25SZane Shelley files( 16508c21c25SZane Shelley tc + '.cpp', 16608c21c25SZane Shelley '../analyzer/resolution.cpp', 16708c21c25SZane Shelley '../analyzer/service_data.cpp', 16808c21c25SZane Shelley '../util/pdbg.cpp', 16908c21c25SZane Shelley ), 17008c21c25SZane Shelley pdbg_test_dtb, 17108c21c25SZane Shelley] 17208c21c25SZane Shelley 17308c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ] 17408c21c25SZane Shelley 17508c21c25SZane Shelleyvar = [ pdbg_env ] 17608c21c25SZane Shelley 17708c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 17808c21c25SZane Shelley cpp_args: test_arg, include_directories: incdir) 17908c21c25SZane Shelley 18008c21c25SZane Shelleytest(tc, exe, env: var) 181d195b716SZane Shelley 182d195b716SZane Shelley################################################################################ 183d195b716SZane Shelley 184d195b716SZane Shelleytc = 'test-tod-step-check-fault' 185d195b716SZane Shelley 186d195b716SZane Shelleysrc = [ 187d195b716SZane Shelley files( 188d195b716SZane Shelley tc + '.cpp', 189d195b716SZane Shelley '../analyzer/plugins/p10-tod-plugins.cpp', 190d195b716SZane Shelley '../analyzer/service_data.cpp', 191d195b716SZane Shelley '../util/pdbg.cpp', 192d195b716SZane Shelley ), 193d195b716SZane Shelley pdbg_test_dtb, 194d195b716SZane Shelley] 195d195b716SZane Shelley 196d195b716SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ] 197d195b716SZane Shelley 198d195b716SZane Shelleyvar = [ pdbg_env ] 199d195b716SZane Shelley 200d195b716SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep, 201d195b716SZane Shelley cpp_args: test_arg, include_directories: incdir) 202d195b716SZane Shelley 203d195b716SZane Shelleytest(tc, exe, env: var) 204d195b716SZane Shelley 205