1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: use well defined test

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

Apparently && and || "short-circuit" while -a and -o do not.
This commit is contained in:
Zdenek Kabelac 2017-07-07 21:31:38 +02:00
parent 9c0a92ee8d
commit 1c9789b0cc
4 changed files with 7 additions and 7 deletions

View File

@ -1442,13 +1442,13 @@ have_thin() {
declare -a CONF
# disable thin_check if not present in system
if test -n "$LVM_TEST_THIN_CHECK_CMD" -a ! -x "$LVM_TEST_THIN_CHECK_CMD" ; then
if test -n "$LVM_TEST_THIN_CHECK_CMD" && test ! -x "$LVM_TEST_THIN_CHECK_CMD"; then
CONF[0]="global/thin_check_executable = \"\""
fi
if test -n "$LVM_TEST_THIN_DUMP_CMD" -a ! -x "$LVM_TEST_THIN_DUMP_CMD" ; then
if test -n "$LVM_TEST_THIN_DUMP_CMD" && test ! -x "$LVM_TEST_THIN_DUMP_CMD"; then
CONF[1]="global/thin_dump_executable = \"\""
fi
if test -n "$LVM_TEST_THIN_REPAIR_CMD" -a ! -x "$LVM_TEST_THIN_REPAIR_CMD" ; then
if test -n "$LVM_TEST_THIN_REPAIR_CMD" && test ! -x "$LVM_TEST_THIN_REPAIR_CMD"; then
CONF[2]="global/thin_repair_executable = \"\""
fi
if test ${#CONF[@]} -ne 0 ; then

View File

@ -147,7 +147,7 @@ STACKTRACE() {
test -f SKIP_THIS_TEST && exit 200
test -z "$LVM_TEST_NODEBUG" -a -f TESTNAME && {
test -z "$LVM_TEST_NODEBUG" && test -f TESTNAME && {
local name
local idx
for i in debug.log* ; do
@ -200,7 +200,7 @@ init_udev_transaction() {
}
finish_udev_transaction() {
if test "$DM_UDEV_SYNCHRONISATION" = 1 -a -n "$DM_UDEV_COOKIE"; then
if test "$DM_UDEV_SYNCHRONISATION" = 1 && test -n "$DM_UDEV_COOKIE" ; then
dmsetup udevreleasecookie
unset DM_UDEV_COOKIE
fi

View File

@ -332,7 +332,7 @@ TEST_TYPES="- snapshot"
# thinpool works EX in cluster
# but they don't work together in a cluster yet
# (nor does thinpool+mirror work in a cluster yet)
test ! -e LOCAL_CLVMD -a aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
test ! -e LOCAL_CLVMD && aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
# Implicit test for 'raid1' only
if test "${TEST_RAID:-raid1}" = raid1 ; then

View File

@ -173,7 +173,7 @@ function check_mangle_cmd()
fi
fi
if [ $r = 0 -a $rename_expected = 1 ]; then
if [ "$r" = 0 ] && [ "$rename_expected" = 1 ]; then
# successfuly renamed to expected name
remove_dm_dev none "$expected"
elif [ $r = 1 ]; then