aboutsummaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: 37bfd473fb59dc1bc3fab7234ec1044ded7a46dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
trees = static_library('trees', files('trees.S'),
                       build_by_default: false,
                       include_directories: libfdt_inc)

dumptrees = executable('dumptrees', files('dumptrees.c'),
                       build_by_default: false,
                       link_with: trees, dependencies: libfdt_dep)

dumptrees_dtb = custom_target(
  'dumptrees',
  command: [dumptrees, meson.current_build_dir()],
  output: [
    'test_tree1.dtb',
    'bad_node_char.dtb',
    'bad_node_format.dtb',
    'bad_prop_char.dtb',
    'ovf_size_strings.dtb',
    'truncated_property.dtb',
    'truncated_string.dtb',
    'truncated_memrsv.dtb',
  ]
)

testutil_dep = declare_dependency(sources: ['testutils.c'], link_with: trees)

tests = [
  'add_subnode_with_nops',
  'addr_size_cells',
  'addr_size_cells2',
  'appendprop1',
  'appendprop2',
  'appendprop_addrrange',
  'boot-cpuid',
  'char_literal',
  'check_full',
  'check_header',
  'check_path',
  'del_node',
  'del_property',
  'dtb_reverse',
  'dtbs_equal_ordered',
  'dtbs_equal_unordered',
  'extra-terminating-null',
  'find_property',
  'fs_tree1',
  'get_alias',
  'get_mem_rsv',
  'get_name',
  'get_path',
  'get_phandle',
  'get_prop_offset',
  'get_next_tag_invalid_prop_len',
  'getprop',
  'incbin',
  'integer-expressions',
  'mangle-layout',
  'move_and_save',
  'node_check_compatible',
  'node_offset_by_compatible',
  'node_offset_by_phandle',
  'node_offset_by_prop_value',
  'nop_node',
  'nop_property',
  'nopulate',
  'notfound',
  'open_pack',
  'overlay',
  'overlay_bad_fixup',
  'parent_offset',
  'path-references',
  'path_offset',
  'path_offset_aliases',
  'phandle_format',
  'property_iterate',
  'propname_escapes',
  'references',
  'relref_merge',
  'root_node',
  'rw_oom',
  'rw_tree1',
  'set_name',
  'setprop',
  'setprop_inplace',
  'sized_cells',
  'string_escapes',
  'stringlist',
  'subnode_iterate',
  'subnode_offset',
  'supernode_atdepth_offset',
  'sw_states',
  'sw_tree1',
  'utilfdt_test',
]

tests += [
  'truncated_memrsv',
  'truncated_property',
  'truncated_string',
]

test_deps = [testutil_dep, util_dep, libfdt_dep]

dl = cc.find_library('dl', required: false)
if dl.found()
  tests += [
    'asm_tree_dump',
    'value-labels',
  ]
  test_deps += [dl]
endif

tests_exe = []
foreach t: tests
  tests_exe += executable(t, files(t + '.c'), dependencies: test_deps, build_by_default: false)
endforeach

run_tests = find_program('run_tests.sh')

env = []
if not py.found()
  env += 'NO_PYTHON=1'
else
  env += [
    'PYTHON=' + py.full_path(),
    'PYTHONPATH=' + meson.project_source_root() / 'pylibfdt',
    'NO_PYTHON=0',
  ]
endif
if not yaml.found()
  env += 'NO_YAML=1'
else
  env += 'NO_YAML=0'
endif

run_test_types = [
  'libfdt',
  'utilfdt',
  'dtc',
  'dtbs_equal',
  'fdtget',
  'fdtput',
  'fdtdump',
  'fdtoverlay'
]
run_test_deps = [
  dtc_tools, dumptrees_dtb, tests_exe
]
if pylibfdt_enabled
  run_test_types += 'pylibfdt'
  run_test_deps += pylibfdt
endif
foreach test_type : run_test_types
  test(
    test_type,
    run_tests,
    args: ['-t', test_type],
    is_parallel: false,
    workdir: meson.current_build_dir(),
    depends: run_test_deps,
    env: env,
    timeout: 1800, # mostly for valgrind
  )
endforeach