From: Yu Watanabe Date: Tue, 26 Nov 2024 15:06:39 +0000 (+0900) Subject: TEST-67-INTEGRITY: modernize test code X-Git-Tag: v257-rc3~2^2~1 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=d5c4f1997a5672999618d410f8d76c1929dac05b;p=systemd%2F.git TEST-67-INTEGRITY: modernize test code - make udevd generate debugging logs for loopback and DM devices, - insert 'udevadm wait' at several places to make the device processed by udevd, - cleanup generated integritysetup service before moving to next algorithm, - drop unnecessary exit on command failure, - also test data splitting mode for all algorithms. --- diff --git a/test/units/TEST-67-INTEGRITY.sh b/test/units/TEST-67-INTEGRITY.sh index eb3082d132..d13f9071ac 100755 --- a/test/units/TEST-67-INTEGRITY.sh +++ b/test/units/TEST-67-INTEGRITY.sh @@ -2,120 +2,121 @@ # SPDX-License-Identifier: LGPL-2.1-or-later set -euxo pipefail -export DM_NAME="integrity_test" -export FULL_DM_DEV_NAME="/dev/mapper/${DM_NAME}" -export FS_UUID="01234567-ffff-eeee-eeee-0123456789ab" -export GEN="/var/run/systemd/generator" +DM_NAME="integrity_test" +DM_NODE="/dev/mapper/${DM_NAME}" +DM_SERVICE="systemd-integritysetup@${DM_NAME}.service" +FS_UUID="01234567-ffff-eeee-eeee-0123456789ab" -image_dir="" +TMP_DIR= +LOOP= -cleanup() -{ - if [ -z "${image_dir}" ]; then - return +cleanup() ( + set +e + + if [[ -n "${LOOP}" ]]; then + losetup -d "${LOOP}" fi - if [ -f "${image_dir}/image" ]; then - if [ -e "${FULL_DM_DEV_NAME}" ]; then - integritysetup close "${DM_NAME}" - fi - losetup -d "${loop}" + if [[ -n "${TMP_DIR}" ]]; then + rm -rf "${TMP_DIR}" fi - rm -rf "${image_dir}" -} + rm -rf /run/udev/rules.d/ + udevadm control --reload +) trap cleanup EXIT -build_integrity_tab() -{ -cat <"/etc/integritytab" -${DM_NAME} ${loop} - integrity-algorithm=$1 +udevadm settle + +# Enable debugging logs for loop and dm block devices. +mkdir -p /run/udev/rules.d/ +cat >/run/udev/rules.d/00-integrity-test.rules <"/etc/integritytab" <