summaryrefslogtreecommitdiffstats
path: root/test/config/config-diff.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/config/config-diff.sh')
-rw-r--r--test/config/config-diff.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/config/config-diff.sh b/test/config/config-diff.sh
new file mode 100644
index 0000000..c15b42c
--- /dev/null
+++ b/test/config/config-diff.sh
@@ -0,0 +1,24 @@
+#!/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
+
+ACTUAL_OUTPUT="${BUILD_DIR}"/$(basename "${EXPECTED_OUTPUT}")
+
+TEST_NAME="$(basename -s .tar.xz $SYSDIR_INPUT)"
+TEST_DIR="$BUILD_DIR/$TEST_NAME"
+
+rm -rf "${TEST_DIR}"
+mkdir "${TEST_DIR}"
+tar -x -f "${SYSDIR_INPUT}" -C "${TEST_DIR}"
+
+LIBNVME_SYSFS_PATH="$TEST_DIR" \
+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"
+
+diff -u "${EXPECTED_OUTPUT}" "${ACTUAL_OUTPUT}"