From d6090a10f01e6daf5c66e7098a3b0f85560a80ce Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 16 Sep 2013 11:02:58 +0200 Subject: [PATCH] tests: add help function Add mkdev_md5sum to create and checksum given LV. Add dev_md5sum to verify device has matching md5 sum. --- test/lib/aux.sh | 6 ++++++ test/lib/check.sh | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index e07397d93..6194492c9 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -506,6 +506,12 @@ unhide_dev() { lvmconf "$filter" } +mkdev_md5sum() { + rm -f debug.log + mkfs.ext2 "$DM_DEV_DIR/$1/$2" || return 1 + md5sum "$DM_DEV_DIR/$1/$2" > "md5.$1-$2" +} + generate_config() { if test -n "$profile_name"; then config_values=PROFILE_VALUES_$profile_name diff --git a/test/lib/check.sh b/test/lib/check.sh index 8b2cfcebb..6eedb4727 100644 --- a/test/lib/check.sh +++ b/test/lib/check.sh @@ -280,5 +280,13 @@ pvlv_counts() { vg_field $local_vg snap_count $num_snaps } +# Compare md5 check generated from get dev_md5sum +dev_md5sum() { + md5sum -c "md5.$1-$2" || \ + (get lv_field $1/$2 "name,size,seg_pe_ranges" + die "LV $1/$2 has different MD5 check sum!") +} + +#set -x unset LVM_VALGRIND "$@" -- 2.43.5