[lvm-devel] master - tests: properly quote heredoc

Zdenek Kabelac zkabelac at fedoraproject.org
Sat Jan 21 18:30:24 UTC 2017


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2fa90bf38461a5de63cd11ffcc01fb984c8193b
Commit:        e2fa90bf38461a5de63cd11ffcc01fb984c8193b
Parent:        1a2b88516bd213a912ba6c5133a977a5003f3a16
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Sat Jan 21 19:21:08 2017 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Sat Jan 21 19:28:06 2017 +0100

tests: properly quote heredoc

Prepend \$ for vars which should remain in script.
Also drop --lazy umount.
Move inittest call up, so mntdir and mntusedir have proper full path.
---
 test/shell/thin-autoumount-dmeventd.sh |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/test/shell/thin-autoumount-dmeventd.sh b/test/shell/thin-autoumount-dmeventd.sh
index 363efe2..eacad0a 100644
--- a/test/shell/thin-autoumount-dmeventd.sh
+++ b/test/shell/thin-autoumount-dmeventd.sh
@@ -16,6 +16,8 @@ SKIP_WITH_LVMPOLLD=1
 
 export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
 
+. lib/inittest
+
 mntdir="${PREFIX}mnt with space"
 mntusedir="${PREFIX}mntuse"
 
@@ -32,8 +34,6 @@ is_lv_opened_()
 	test $(get lv_field "$1" lv_device_open --binary) = "1"
 }
 
-. lib/inittest
-
 #
 # Main
 #
@@ -48,15 +48,17 @@ aux lvmconf "dmeventd/thin_command = \"$PWD/testcmd.sh\""
 cat <<- EOF >testcmd.sh
 #!/bin/sh
 
-echo "Data $DMEVENTD_THIN_POOL_DATA"
-echo "Metadata $DMEVENTD_THIN_POOL_METADATA"
+echo "Data: \$DMEVENTD_THIN_POOL_DATA"
+echo "Metadata: \$DMEVENTD_THIN_POOL_METADATA"
 
-lvextend --use-policies $1 || {
-	umount --lazy "$mntdir"  || true
-	umount --lazy "$mntusedir" || true
+$TESTDIR/lib/lvextend --use-policies \$1 || {
+	umount "$mntdir"  || true
+	umount "$mntusedir" || true
 }
 EOF
 chmod +x testcmd.sh
+# Show prepared script
+cat testcmd.sh
 
 aux prepare_dmeventd
 




More information about the lvm-devel mailing list