aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests
diff options
context:
space:
mode:
authorIgor K <[email protected]>2019-03-14 04:39:12 +0300
committerBrian Behlendorf <[email protected]>2019-03-13 18:39:12 -0700
commit508c5527d0b6d53347b5643456444ea377b84c7a (patch)
tree4b26a28dcdb8e855d7322e1302881d30ad71be9a /tests/zfs-tests
parent1af240f3b51c080376bb6ae1efc13d62b087b65d (diff)
Use 'printf %s' instead of 'echo -n' for compatibility
The ksh 'echo -n' behavior on Illumos and Linux differs. For compatibility with others platforms switch to "printf '%s' ". Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Igor Kozhukhov <[email protected]> Closes #8501
Diffstat (limited to 'tests/zfs-tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_change-key/zfs_change-key_format.ksh5
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh3
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh5
3 files changed, 8 insertions, 5 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/zfs_change-key_format.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/zfs_change-key_format.ksh
index af5e145f9..6344b8d05 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/zfs_change-key_format.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/zfs_change-key_format.ksh
@@ -16,6 +16,7 @@
#
# Copyright (c) 2017 Datto, Inc. All rights reserved.
+# Copyright (c) 2019 DilOS
#
. $STF_SUITE/include/libtest.shlib
@@ -61,11 +62,11 @@ log_must verify_keyformat $TESTPOOL/$TESTFS1 "hex"
log_must zfs unload-key $TESTPOOL/$TESTFS1
log_must eval "echo $HEXKEY | zfs load-key $TESTPOOL/$TESTFS1"
-log_must eval "echo -n $RAWKEY | zfs change-key -o keyformat=raw" \
+log_must eval "printf '%s' $RAWKEY | zfs change-key -o keyformat=raw" \
"$TESTPOOL/$TESTFS1"
log_must verify_keyformat $TESTPOOL/$TESTFS1 "raw"
log_must zfs unload-key $TESTPOOL/$TESTFS1
-log_must eval "echo -n $RAWKEY | zfs load-key $TESTPOOL/$TESTFS1"
+log_must eval "printf '%s' $RAWKEY | zfs load-key $TESTPOOL/$TESTFS1"
log_pass "'zfs change-key -o' changes the key format"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh
index d915c5f57..a46cb55f3 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh
@@ -16,6 +16,7 @@
#
# Copyright (c) 2017, Datto, Inc. All rights reserved.
+# Copyright (c) 2019, DilOS
#
. $STF_SUITE/include/libtest.shlib
@@ -75,7 +76,7 @@ typeset -i i=0
while (( i < ${#ENCRYPTION_ALGS[*]} )); do
typeset -i j=0
while (( j < ${#KEYFORMATS[*]} )); do
- log_must eval "echo -n ${USER_KEYS[j]} | zfs create" \
+ log_must eval "printf '%s' ${USER_KEYS[j]} | zfs create" \
"-o ${ENCRYPTION_ALGS[i]} -o ${KEYFORMATS[j]}" \
"$TESTPOOL/$TESTFS1"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh
index 8b7ca4799..d28d5953c 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh
@@ -16,6 +16,7 @@
#
# Copyright (c) 2017, Datto, Inc. All rights reserved.
+# Copyright (c) 2019, DilOS
#
. $STF_SUITE/include/libtest.shlib
@@ -70,13 +71,13 @@ typeset -i i=0
while (( i < ${#ENCRYPTION_ALGS[*]} )); do
typeset -i j=0
while (( j < ${#KEYFORMATS[*]} )); do
- log_must eval "echo -n ${USER_KEYS[j]} | zpool create" \
+ log_must eval "printf '%s' ${USER_KEYS[j]} | zpool create" \
"-O ${ENCRYPTION_ALGS[i]} -O ${KEYFORMATS[j]}" \
"$TESTPOOL $DISKS"
propertycheck $TESTPOOL ${ENCRYPTION_PROPS[i]} || \
log_fail "failed to set ${ENCRYPTION_ALGS[i]}"
- propertycheck $TESTPOOL ${KEY_FORMATS[j]} || \
+ propertycheck $TESTPOOL ${KEYFORMATS[j]} || \
log_fail "failed to set ${KEYFORMATS[j]}"
log_must zpool destroy $TESTPOOL