From 97e3d220503a676acd81839dea289f4e700d8bd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 Jul 2023 00:36:07 +0200 Subject: Adding upstream version 1.5. Signed-off-by: Daniel Baumann --- test/nbft/meson.build | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test/nbft/meson.build (limited to 'test/nbft/meson.build') diff --git a/test/nbft/meson.build b/test/nbft/meson.build new file mode 100644 index 0000000..67b2d95 --- /dev/null +++ b/test/nbft/meson.build @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of libnvme. +# Copyright (c) 2023 Red Hat Inc. +# +# Authors: Tomas Bzatek + +# 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', +] + +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 -- cgit v1.2.3