summaryrefslogtreecommitdiffstats
path: root/test/nbft/meson.build
blob: 919bf83138dd0423ba6f3ddb3e211fbf8c10ea18 (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
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of libnvme.
# Copyright (c) 2023 Red Hat Inc.
#
# Authors: Tomas Bzatek <tbzatek@redhat.com>

# NBFT parser tests over supplied NBFT ACPI table dumps

tables_dir     = 'tables'
tables_bad_dir = 'tables_bad'
diff_dir       = 'diffs'

tables = [
    'NBFT-auto-ipv6',
    'NBFT-dhcp-ipv6',
    'NBFT-rhpoc',
    'NBFT-static-ipv4',
    'NBFT-static-ipv4-discovery',
    'NBFT-static-ipv6',
    'NBFT-Dell.PowerEdge.R760',
    'NBFT-Dell.PowerEdge.R660-fw1.5.5-single'
]

tables_bad = [
    'NBFT-bad-oldspec',
    'NBFT-random-noise',
]

nbft_dump = executable(
    'nbft-dump',
    ['nbft-dump.c'],
    dependencies: libnvme_dep,
    include_directories: [incdir, internal_incdir]
)


helper_data = configuration_data()
helper_data.set('NBFT_DUMP_PATH', nbft_dump.full_path())
helper_data.set('TABLES_DIR', meson.current_source_dir()/tables_dir)
helper_data.set('DIFF_DIR', meson.current_source_dir()/diff_dir)

dump_helper = configure_file(
    input: 'nbft-dump-diff.sh.in',
    output: '@BASENAME@',
    configuration: helper_data
)

gen_diffs_helper = configure_file(
    input: 'gen-nbft-diffs.sh.in',
    output: '@BASENAME@',
    configuration: helper_data
)


run_target(
    'nbft-diffs',
    depends: nbft_dump,
    command: [gen_diffs_helper]
)


diffcmd = find_program(
    'diff',
    required: false
)
if diffcmd.found()
    foreach table: tables
        test(
            table,
            dump_helper,
            args: [files(tables_dir/table),
                   files(diff_dir/table)]
        )
    endforeach
endif

foreach table: tables_bad
    test(
        table,
        nbft_dump,
        args: [files(tables_bad_dir/table)],
        should_fail: true
    )
endforeach