All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: some aux corrections
Date: Tue, 25 Apr 2023 17:55:37 +0000 (GMT)	[thread overview]
Message-ID: <20230425175537.DF0793858D1E@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b88c9f6199499692c8b4b47488dffd0f187b9f7
Commit:        7b88c9f6199499692c8b4b47488dffd0f187b9f7
Parent:        4a003ba671bd4f38d9108f5dd174eccda1522c3b
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Apr 25 15:07:25 2023 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Tue Apr 25 18:59:04 2023 +0200

tests: some aux corrections

Keep backups within test_dir instead of dev_dir (so it doesn't
leak large files there if the tests are run over real /dev dir).

Move restoring of dm_mirror throttling before test_dir is removed.
---
 test/lib/aux.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6a0b9da93..c773485f5 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -448,6 +448,7 @@ teardown_devs_prefixed() {
 teardown_devs() {
 	# Delete any remaining dm/udev semaphores
 	teardown_udev_cookies
+	restore_dm_mirror
 
 	test ! -f MD_DEV || cleanup_md_dev
 	test ! -f DEVICES || teardown_devs_prefixed "$PREFIX"
@@ -483,7 +484,6 @@ teardown_devs() {
 			udev_wait
 		}
 	}
-	restore_dm_mirror
 }
 
 kill_sleep_kill_() {
@@ -1394,7 +1394,8 @@ backup_dev() {
 	local dev
 
 	for dev in "$@"; do
-		dd if="$dev" of="${dev}.backup" bs=1024
+		dd if="$dev" of="${dev##*/}.backup" bs=16K conv=fdatasync || \
+			die "Cannot backup device: \"$dev\"  with size $(blockdev --getsize64 "$dev" || true) bytes."
 	done
 }
 
@@ -1402,9 +1403,9 @@ restore_dev() {
 	local dev
 
 	for dev in "$@"; do
-		test -e "${dev}.backup" || \
+		test -e "${dev##*/}.backup" || \
 			die "Internal error: $dev not backed up, can't restore!"
-		dd of="$dev" if="${dev}.backup" bs=1024
+		dd of="$dev" if="${dev##*/}.backup" bs=16K
 	done
 }
 
@@ -1743,9 +1744,9 @@ udev_wait() {
 	pgrep udev >/dev/null || return 0
 	which udevadm &>/dev/null || return 0
 	if test -n "${1-}" ; then
-		udevadm settle --exit-if-exists="$1" || true
+		udevadm settle --exit-if-exists="$1" 2>/dev/null || true
 	else
-		udevadm settle --timeout=15 || true
+		udevadm settle --timeout=15 2>/dev/null || true
 	fi
 }
 


                 reply	other threads:[~2023-04-25 17:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230425175537.DF0793858D1E@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.