Merging upstream version 1.11.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
fc25ba7fb2
commit
bdf865565e
946 changed files with 4896 additions and 1272 deletions
52
test/config/config-diff.sh
Normal file → Executable file
52
test/config/config-diff.sh
Normal file → Executable file
|
@ -1,24 +1,48 @@
|
|||
#!/bin/bash -e
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
BUILD_DIR=$1
|
||||
CONFIG_DUMP=$2
|
||||
SYSDIR_INPUT=$3
|
||||
CONFIG_JSON=$4
|
||||
EXPECTED_OUTPUT=$5
|
||||
positional_args=()
|
||||
sysfs_tar=""
|
||||
config_json=""
|
||||
|
||||
ACTUAL_OUTPUT="${BUILD_DIR}"/$(basename "${EXPECTED_OUTPUT}")
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--sysfs-tar)
|
||||
sysfs_tar=$2
|
||||
shift 1
|
||||
;;
|
||||
--config-json)
|
||||
config_json=$2
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
positional_args+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
TEST_NAME="$(basename -s .tar.xz $SYSDIR_INPUT)"
|
||||
TEST_DIR="$BUILD_DIR/$TEST_NAME"
|
||||
set -- "${positional_args[@]}"
|
||||
|
||||
rm -rf "${TEST_DIR}"
|
||||
mkdir "${TEST_DIR}"
|
||||
tar -x -f "${SYSDIR_INPUT}" -C "${TEST_DIR}"
|
||||
test_binary="$1"
|
||||
build_dir="$2"
|
||||
expected_output="$3"
|
||||
|
||||
LIBNVME_SYSFS_PATH="$TEST_DIR" \
|
||||
sysfs_path=""
|
||||
if [[ -n "${sysfs_tar}" ]]; then
|
||||
test_name="$(basename -s .tar.xz ${sysfs_tar})"
|
||||
sysfs_path="${build_dir}/${test_name}"
|
||||
|
||||
rm -rf "${sysfs_path}"
|
||||
mkdir "${sysfs_path}"
|
||||
tar -x -f "${sysfs_tar}" -C "${sysfs_path}"
|
||||
fi
|
||||
|
||||
output="${build_dir}"/$(basename "${expected_output}")
|
||||
|
||||
LIBNVME_SYSFS_PATH="${sysfs_path}" \
|
||||
LIBNVME_HOSTNQN=nqn.2014-08.org.nvmexpress:uuid:ce4fee3e-c02c-11ee-8442-830d068a36c6 \
|
||||
LIBNVME_HOSTID=ce4fee3e-c02c-11ee-8442-830d068a36c6 \
|
||||
"${CONFIG_DUMP}" "${CONFIG_JSON}" > "${ACTUAL_OUTPUT}" || echo "test failed"
|
||||
"${test_binary}" "${config_json}" > "${output}" || echo "test failed"
|
||||
|
||||
diff -u "${EXPECTED_OUTPUT}" "${ACTUAL_OUTPUT}"
|
||||
diff -u "${expected_output}" "${output}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue