| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
# |
| 3 |
# This file is part of libnvme. |
| 4 |
# Copyright (c) 2024 SUSE LLC. |
| 5 |
# |
| 6 |
# Authors: Daniel Wagner <[email protected]> |
| 7 |
|
| 8 |
diff = find_program('diff', required : false) |
| 9 |
if diff.found() |
| 10 |
|
| 11 |
srcdir = meson.current_source_dir() |
| 12 |
builddir = meson.current_build_dir() |
| 13 |
|
| 14 |
config_dump = executable( |
| 15 |
'test-config-dump', |
| 16 |
['config-dump.c'], |
| 17 |
dependencies: libnvme_dep, |
| 18 |
include_directories: [incdir], |
| 19 |
) |
| 20 |
|
| 21 |
config_data = [ |
| 22 |
'config-pcie', |
| 23 |
'config-pcie-with-tcp-config', |
| 24 |
] |
| 25 |
|
| 26 |
config_diff = find_program('config-diff.sh') |
| 27 |
|
| 28 |
foreach t_file : config_data |
| 29 |
test( |
| 30 |
t_file, |
| 31 |
config_diff, |
| 32 |
args : [ |
| 33 |
config_dump.full_path(), |
| 34 |
builddir, |
| 35 |
srcdir + '/data/' + t_file + '.out', |
| 36 |
'--sysfs-tar', srcdir + '/data/' + t_file + '.tar.xz', |
| 37 |
'--config-json', srcdir + '/data/' + t_file + '.json', |
| 38 |
], |
| 39 |
depends : config_dump, |
| 40 |
) |
| 41 |
endforeach |
| 42 |
|
| 43 |
test_hostnqn_order = executable( |
| 44 |
'test-hostnqn-order', |
| 45 |
['hostnqn-order.c'], |
| 46 |
dependencies: libnvme_dep, |
| 47 |
include_directories: [incdir], |
| 48 |
) |
| 49 |
|
| 50 |
test( |
| 51 |
'hostnqn-order', |
| 52 |
config_diff, |
| 53 |
args : [ |
| 54 |
test_hostnqn_order.full_path(), |
| 55 |
builddir, |
| 56 |
srcdir + '/data/hostnqn-order.out', |
| 57 |
'--sysfs-tar', srcdir + '/data/hostnqn-order.tar.xz', |
| 58 |
'--config-json', srcdir + '/data/hostnqn-order.json', |
| 59 |
], |
| 60 |
depends : test_hostnqn_order, |
| 61 |
) |
| 62 |
|
| 63 |
test_psk_json = executable( |
| 64 |
'test-psk-json', |
| 65 |
['psk-json.c'], |
| 66 |
dependencies: libnvme_dep, |
| 67 |
include_directories: [incdir], |
| 68 |
) |
| 69 |
|
| 70 |
config_data = [ |
| 71 |
'tls_key-1', |
| 72 |
'tls_key-2', |
| 73 |
] |
| 74 |
|
| 75 |
foreach t_file : config_data |
| 76 |
test( |
| 77 |
'psk-json-' + t_file, |
| 78 |
config_diff, |
| 79 |
args : [ |
| 80 |
test_psk_json.full_path(), |
| 81 |
builddir, |
| 82 |
srcdir + '/data/' + t_file + '.out', |
| 83 |
'--config-json', srcdir + '/data/' + t_file + '.json', |
| 84 |
], |
| 85 |
depends : test_psk_json, |
| 86 |
) |
| 87 |
endforeach |
| 88 |
endif |