blob: 7a5e468216d5461052f2d6bc7c3820bd88ac4dc1 [file] [log] [blame]
Zane Shelley80183912021-12-21 11:52:25 -06001# Get the gtest/gmock dependencies.
2gtest_dep = dependency('gtest', main: true, disabler: true, required: false)
3gmock_dep = dependency('gmock', disabler: true, required: false)
4if not gtest_dep.found() or not gmock_dep.found()
5 cmake = import('cmake')
6 gtest_proj = cmake.subproject('googletest',
7 required: false)
8 if gtest_proj.found()
9 gtest_dep = declare_dependency(
10 dependencies: [
11 dependency('threads'),
12 gtest_proj.dependency('gtest'),
13 gtest_proj.dependency('gtest_main'),
14 ]
15 )
16 gmock_dep = gtest_proj.dependency('gmock')
17 else
18 assert(not get_option('tests').enabled(),
19 'Googletest is required if tests are enabled')
20 endif
21endif
22
Zane Shelley0c44c2f2020-06-05 17:14:31 -050023test_arg = [
24 '-DTEST_TRACE',
25]
26
Zane Shelleyafc6acd2022-01-12 14:32:56 -060027# Compile the test dts into a binary for pdbg.
28pdbg_test_dtb = custom_target('build_pdbg_test_dtb',
29 input : files('pdbg_test.dts'),
30 output : 'pdbg_test.dtb',
31 command : [ find_program('dtc'), '-I', 'dts', '-O', 'dtb',
32 '-o', '@OUTPUT@', '@INPUT@' ])
33
Ben Tyner9ae5ca42020-02-28 13:13:50 -060034# end2end code exerciser for experiment and testing
35subdir('end2end')
36
Zane Shelley248cbf82019-05-03 17:07:18 -050037tests = [
Zane Shelleyd26298b2021-01-28 16:49:19 -060038 'bin_stream_test',
Zane Shelley982f1722021-03-25 10:56:37 -050039 'ffdc_file_test',
Zane Shelley0b8368c2021-03-18 17:33:41 -050040 'resolution_test',
Zane Shelley248cbf82019-05-03 17:07:18 -050041]
42
Zane Shelley979e2872021-09-20 22:46:06 -050043analyzer_src = files(
44 '../analyzer/service_data.cpp',
45)
46
Zane Shelley80183912021-12-21 11:52:25 -060047foreach t : tests
Zane Shelleyafc6acd2022-01-12 14:32:56 -060048 test(t,
49 executable(t.underscorify(),
50 [ files(t + '.cpp'), pdbg_test_dtb, analyzer_src ],
51 link_with : [ util_lib ],
52 dependencies : [ libhei_dep, gtest_dep ],
53 cpp_args : test_arg,
54 include_directories : incdir),
55 env : [ 'PDBG_DTB=' + pdbg_test_dtb.full_path() ])
Zane Shelley80183912021-12-21 11:52:25 -060056endforeach