From 3140cfbb24f450dc0d4ff4d915bc3d8db207eeaa Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Tue, 21 Jul 2020 19:45:41 -0500 Subject: [PATCH] device-mapper-multipath-0.8.4-5 Update CI tests to match RHEL * This commit also pulls in changes from Lin Li and Bruno Goncalves --- device-mapper-multipath.spec | 7 +- tests/.fmf/version | 1 + tests/bindings/Makefile | 49 --------- tests/bindings/main.sh | 4 +- tests/include/ec.sh | 8 +- tests/kpartx_4k_aligned/Makefile | 49 --------- tests/medium_error_scsi_debug/Makefile | 47 --------- tests/medium_error_scsi_debug/PURPOSE | 4 +- tests/medium_error_scsi_debug/main.sh | 45 ++++---- tests/multipath_conf_syntax/main.sh | 22 ++-- tests/multipathd_oom/Makefile | 49 --------- tests/provision.fmf | 5 + tests/restate_module/main.sh | 136 ++++++++++++------------- tests/squelch_scsi_id/Makefile | 49 --------- tests/squelch_scsi_id/main.sh | 2 +- tests/tests.yml | 36 +++++-- tests/user_friendly_names/Makefile | 49 --------- tests/user_friendly_names/main.sh | 17 ++-- 18 files changed, 166 insertions(+), 413 deletions(-) create mode 100644 tests/.fmf/version delete mode 100644 tests/bindings/Makefile delete mode 100644 tests/kpartx_4k_aligned/Makefile delete mode 100644 tests/medium_error_scsi_debug/Makefile delete mode 100644 tests/multipathd_oom/Makefile create mode 100644 tests/provision.fmf delete mode 100644 tests/squelch_scsi_id/Makefile delete mode 100644 tests/user_friendly_names/Makefile diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 953787c..5324f5d 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,6 +1,6 @@ Name: device-mapper-multipath Version: 0.8.4 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tools to manage multipath devices using device-mapper License: GPLv2 URL: http://christophe.varoqui.free.fr/ @@ -278,6 +278,11 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Tue Jul 21 2020 Benjamin Marzinski - 0.8.4-5 +- Update CI tests to match RHEL + * This commit also pulls in changes from Lin Li + and Bruno Goncalves + * Tue Jul 21 2020 Benjamin Marzinski - 0.8.4-4 - Rebased on top of additional commits staged for upstream * Previous patches 0048-0060 are now patches 0053-0054 & 0059-0069 diff --git a/tests/.fmf/version b/tests/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/bindings/Makefile b/tests/bindings/Makefile deleted file mode 100644 index 6fc0484..0000000 --- a/tests/bindings/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 Red Hat, Inc. -# # -# # This program is free software: you can redistribute it and/or modify -# # it under the terms of the GNU General Public License as published by -# # the Free Software Foundation, either version 3 of the License, or -# # (at your option) any later version. -# # -# # This program is distributed in the hope that it will be useful, -# # but WITHOUT ANY WARRANTY; without even the implied warranty of -# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# # GNU General Public License for more details. -# # -# # You should have received a copy of the GNU General Public License -# # along with this program. If not, see . -# -# # Author: Lin Li - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: bindings" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/bindings/main.sh b/tests/bindings/main.sh index 518333d..2d6f284 100755 --- a/tests/bindings/main.sh +++ b/tests/bindings/main.sh @@ -31,8 +31,8 @@ sleep 5 trun "multipath -F" sleep 5 terr "modprobe -r scsi_debug" -terr "modprobe scsi_debug dev_size_mb=1024 num_tgts=1 vpd_use_hostno=0 \ -add_host=2 delay=20 max_luns=2 no_lun_0=1" +terr "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 \ +max_luns=2 no_lun_0=1" sleep 60 disk_path=$(get_scsi_debug_devices) diff --git a/tests/include/ec.sh b/tests/include/ec.sh index e9726eb..22dfc40 100755 --- a/tests/include/ec.sh +++ b/tests/include/ec.sh @@ -174,13 +174,7 @@ AA fi #setup scsi_debug echo "INFO: Loading scsi_debug module for simulation of mpath" - local dev_size=100 - if [ "CHK$(uname -m)" == "CHKi386" ] \ - || [ "CHK$(uname -m)" == "CHKi686" ]; then -#i386 platform cannot allocate 100 MiB in kernel space - dev_size=10 - fi - modprobe scsi_debug dev_size_mb=${dev_size} \ + modprobe scsi_debug \ num_tgts=1 vpd_use_hostno=0 \ add_host=4 delay=20 \ max_luns=2 no_lun_0=1 2>&1 1>/dev/null diff --git a/tests/kpartx_4k_aligned/Makefile b/tests/kpartx_4k_aligned/Makefile deleted file mode 100644 index fabfdc6..0000000 --- a/tests/kpartx_4k_aligned/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 Red Hat, Inc. -# # -# # This program is free software: you can redistribute it and/or modify -# # it under the terms of the GNU General Public License as published by -# # the Free Software Foundation, either version 3 of the License, or -# # (at your option) any later version. -# # -# # This program is distributed in the hope that it will be useful, -# # but WITHOUT ANY WARRANTY; without even the implied warranty of -# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# # GNU General Public License for more details. -# # -# # You should have received a copy of the GNU General Public License -# # along with this program. If not, see . -# -# # Author: Lin Li - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: kpartx_4k_aligned" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/medium_error_scsi_debug/Makefile b/tests/medium_error_scsi_debug/Makefile deleted file mode 100644 index 113012f..0000000 --- a/tests/medium_error_scsi_debug/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2006 Red Hat, Inc. This copyrighted -# material is made available to anyone wishing to use, modify, copy, or -# redistribute it subject to the terms and conditions of the GNU General -# Public License v.2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Author: LiLin - - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: CEE feedback" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/medium_error_scsi_debug/PURPOSE b/tests/medium_error_scsi_debug/PURPOSE index 74e4fdc..88fa796 100644 --- a/tests/medium_error_scsi_debug/PURPOSE +++ b/tests/medium_error_scsi_debug/PURPOSE @@ -1,8 +1,8 @@ multipath: Test that some fatal errors which should not be retried, for example a medium error, correctly generate an I/O error and do not get infinitely retried. steps: -1.# modprobe scsi_debug dev_size_mb=1024 num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2 every_nth=1 +1.# modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2 2.# multipath -ll | grep -C 5 scsi_debug -3.# dd if=/dev/zero of=/dev/sdf bs=1024 count=262144 +3.# dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 4. check if an I/O error generated diff --git a/tests/medium_error_scsi_debug/main.sh b/tests/medium_error_scsi_debug/main.sh index 23cb5e4..db2f008 100755 --- a/tests/medium_error_scsi_debug/main.sh +++ b/tests/medium_error_scsi_debug/main.sh @@ -19,37 +19,44 @@ function cleanup() { + sleep 5 + udevadm settle multipath -F - service multipathd stop - sleep 15 + sleep 5 modprobe -r scsi_debug - rt=$? - while [ $rt -ne 0 ] - do - sleep 15 - modprobe -r scsi_debug - rt=$? - done + + return 0 } yum -y install device-mapper device-mapper-multipath mpathconf --enable -modprobe scsi_debug dev_size_mb=1024 num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2 every_nth=1 +service multipathd stop +modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2 sleep 5 -service multipathd restart -sleep 10 -disk1=`multipath -ll | grep -A 5 scsi_debug | grep -oE "sd." | head -1` -if [ -z "$disk1" ]; then +multipath > /dev/null +sleep 5 +mpathdev=`multipath -l | grep scsi_debug | awk '{print $1}' | head -1` +if [ -z "$mpathdev" ]; then + echo "------- FAIL, no multipath device created -----" cleanup exit 1 fi +before_active=`multipath -l $mpathdev | grep "active undef" | wc -l` -IO_error=`dd if=/dev/zero of=/dev/$disk1 bs=1024 count=262144 2>&1 | grep -o "Input/output error" ` +IO_error=`dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 2>&1 | grep -o "Input/output error" ` if [ -n "$IO_error" ];then - echo "------- PASS, a medium error, correctly generate an I/O error and do not get infinitely retried -----" - cleanup + after_active=`multipath -l $mpathdev | grep "active undef" | wc -l` + if [ "$before_active" -eq "$after_active" ]; then + echo "------- PASS, a medium error, correctly generated an I/O error and did not fail paths -----" + cleanup + exit 0 + else + echo "------- FAIL, paths failed -----" + cleanup + exit 1 + fi else - echo "------- FAIL, not generate an I/O error -----" + echo "------- FAIL, did not generate an I/O error -----" cleanup - exit -1 + exit 1 fi diff --git a/tests/multipath_conf_syntax/main.sh b/tests/multipath_conf_syntax/main.sh index 9572b32..f29109d 100755 --- a/tests/multipath_conf_syntax/main.sh +++ b/tests/multipath_conf_syntax/main.sh @@ -50,39 +50,46 @@ multipaths { } _EOF_ rlRun "multipath 2>&1 | grep 'missing closing quotes on line'" 0 "test missing closing quote on alias" - rlRun "multipath -r |grep mypath" 0 "mpath rename to mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mypath" 0 "check if mpath rename to mypath successfully" # test no value for alias rlRun "sed -i 's/alias.*$/alias/g' /etc/multipath.conf" rlRun "multipath 2>&1 | grep \"missing value for option 'alias' on line\"" 0 "test no value for alias" - rlRun "multipath -r |grep mpath*" 0 "mpath rename to mpath* from mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mpath*" 0 "check if mpath rename to mpath* from mypath successfully" # test missing starting quote on alias rlRun "sed -i 's/alias.*$/alias mypath\"/g' /etc/multipath.conf" rlRun "multipath 2>&1 |grep 'ignoring extra data starting with'" 0 "test missing starting quote on alias" - rlRun "multipath -r |grep mypath" 0 "mpath rename to mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mypath" 0 "check if mpath rename to mypath successfully" # test wrong quote on alias rlRun "sed -i 's/alias.*$/alias /g' /etc/multipath.conf" rlRun "multipath 2>&1 | grep config" 1 "no warning" - rlRun "multipath -r |grep ''" 0 "mpath rename to " + rlRun "multipath -r" + rlRun "multipath -ll |grep ''" 0 "check if mpath rename to successfully" # test value has a space rlRun "sed -i 's/alias.*$/alias mypath test/g' /etc/multipath.conf" rlRun "multipath 2>&1 |grep 'ignoring extra data starting with'" 0 "test value has a space" - rlRun "multipath -r |grep mypath" 0 "mpath rename to mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mypath" 0 "check if mpath rename to mypath successfully" # test wrong alias keyword rlRun "sed -i 's/alias.*$/alia mypath/g' /etc/multipath.conf" rlRun "multipath 2>&1 |grep 'invalid keyword: alia'" 0 "invalid keyword: alia" - rlRun "multipath -r |grep mpath*" 0 "mpath rename to mpath* from mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mpath*" 0 "check if mpath rename to mpath* from mypath successfully" rlRun "sed -i 's/alia.*$/alias mypath/g' /etc/multipath.conf" # test no space between the section name and the open bracket that followed it # fix issue about if a section doesn't have a space between the section name and the open bracket, that section isn't read in. rlRun "sed -i 's/multipaths.*/multipaths{/g' /etc/multipath.conf" rlRun "multipath 2>&1 | grep config" 1 "no warning" - rlRun "multipath -r |grep mypath" 0 "mpath rename to mypath" + rlRun "multipath -r" + rlRun "multipath -ll |grep mypath" 0 "check if mpath rename to mypath successfully" # test wrong section keywords rlRun "sed -i 's/multipaths.*/ultipaths {/g' /etc/multipath.conf" @@ -95,6 +102,7 @@ _EOF_ rlPhaseEnd rlPhaseStartCleanup + rlRun "udevadm settle" rlRun "multipath -F" 0 "Flush all unused multipath device maps" rlServiceStop multipathd rlRun "modprobe -r scsi_debug" 0 "Remove scsi_debug" diff --git a/tests/multipathd_oom/Makefile b/tests/multipathd_oom/Makefile deleted file mode 100644 index 13ce211..0000000 --- a/tests/multipathd_oom/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 Red Hat, Inc. -# # -# # This program is free software: you can redistribute it and/or modify -# # it under the terms of the GNU General Public License as published by -# # the Free Software Foundation, either version 3 of the License, or -# # (at your option) any later version. -# # -# # This program is distributed in the hope that it will be useful, -# # but WITHOUT ANY WARRANTY; without even the implied warranty of -# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# # GNU General Public License for more details. -# # -# # You should have received a copy of the GNU General Public License -# # along with this program. If not, see . -# -# # Author: Lin Li - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: multipathd invoked oom-killer" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/provision.fmf b/tests/provision.fmf new file mode 100644 index 0000000..62a6eba --- /dev/null +++ b/tests/provision.fmf @@ -0,0 +1,5 @@ +--- + +standard-inventory-qcow2: + qemu: + m: 2G diff --git a/tests/restate_module/main.sh b/tests/restate_module/main.sh index 1da179b..6d5b0c5 100755 --- a/tests/restate_module/main.sh +++ b/tests/restate_module/main.sh @@ -18,81 +18,79 @@ # Author: Lin Li source ../include/ec.sh || exit 200 +tlog "running $0" -tlog "start running" -Result=FAILED -MulDevice=`rpm -qa|grep device-mapper-multipath | wc -l` -if [ $MulDevice != 2 ]; then - tlog "multi-device is not install" - exit 1 -fi -tlog "multi-device is installed" -trun "mpathconf --enable --find_multipaths n --with_module y --with_multipathd y" -trun "echo '' > /var/log/messages" +cleanup () +{ + trun "multipathd disablequeueing maps" + trun "service multipathd stop" + sleep 5 + trun "udevadm settle" + trun "multipath -F" + sleep 5 + trun "modprobe -r scsi_debug" +} + +assert () +{ + local cmd="$*" + _trun_ "$cmd" 0 + if test $? -eq 0; then + tpass_ "$cmd" ; + else + tfail_ "$cmd" ; + cleanup ; + tend ; + fi +} + +rpm -q device-mapper-multipath || yum install -y device-mapper-multipath +tlog "device-mapper-multipath is installed" +# cleanup existing devices +trun "rm /etc/multipath.conf" +trun "mpathconf --enable --with_module y" +sed -i '/^defaults[[:space:]]*{/ a\ + max_polling_interval 10 +' /etc/multipath.conf +trun "service multipathd stop" trun "multipath -F" +sleep 5 trun "modprobe -r scsi_debug" -trun "dmsetup remove_all" -OriginalDev=`multipathd show paths | grep "running" | awk '{print $2}'` -OLD_IFS="$IFS" -IFS=" " -OriginalDevList=($OriginalDev) -IFS="$OLD_IFS" +#trun "service multipathd restart" +trun "service multipathd start" +trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2" +sleep 5 +mpathdev=`multipath -l | grep scsi_debug | awk '{print $1}' | head -1` +tlog "using multipathd device ${mpathdev}" +trun "multipath -ll ${mpathdev}" +pathcount=`multipathd show paths raw format "%m %t" | grep ${mpathdev} | grep "active" | wc -l` +tlog "Checking if active path count equals 2" +assert "[[ $pathcount -eq 2 ]]" -#trun "service multipathd restart" -OriPathCount=`multipathd show paths | grep -i "running" |grep -v grep|wc -l` -tlog "Original MultPathDevice = ${OriPathCount}" -trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2 dev_size_mb=1024" -trun "multipath -ll" -sleep 1s -OriPathCount=`multipathd show paths | grep -i "running" |grep -v grep|wc -l` -tlog "After add tow virturl device, MultPathDevice = ${OriPathCount}" - -if [ $OriPathCount -eq 0 ];then - tlog "Virtual MultiPath is Fail" - exit 1 -fi - -tlog "offline one MultiPathDevice" -DeviceName=`multipath -ll | grep -i "sd[a|b|c|d|e|f|g|h]" | awk -F" " '{print $3}' | tail -1` -trun "echo 'offline' > /sys/block/${DeviceName}/device/state" -sleep 1s -trun "multipath -ll" -sleep 1s -trun "multipath -r" -sleep 1s +tlog "offline one path device" +pathname=`multipathd show paths raw format "%d %m" | grep ${mpathdev} | head -1 | awk '{print $1}'` +tlog "path to offline: ${pathname}" +trun "echo 'offline' > /sys/block/${pathname}/device/state" +tlog "waiting for multipathd to fail path" +sleep 15 trun "multipathd show paths" -sleep 5s -MulPathCount=`multipathd show paths | grep -i "running" |grep -v grep|wc -l` -let "RightPathCout=$OriPathCount-1" -if [ $MulPathCount != $RightPathCout ]; then - Result=FAIL - tlog "second check fail MulPathCount=$MulPathCount RightPathCout=$RightPathCout" - tlog "running result $Result" - exit 1 -fi -tlog "second check is OK MulPathCount=$MulPathCount" +pathcount=`multipathd show paths raw format "%m %t" | grep ${mpathdev} | grep "active" | wc -l` +tlog "Checking if active path count equals 1" +assert "[[ $pathcount -eq 1 ]]" -tlog "running one Multipath" -trun "echo 'running' > /sys/block/${DeviceName}/device/state" -sleep 1s -trun "multipath -ll" -sleep 4s +tlog "restore ${pathname}" +trun "echo 'running' > /sys/block/${pathname}/device/state" +sleep 10 #verified -Condition1=`grep "reinstate failed" /var/log/messages | wc -l` -Condition2=`grep "segfault" /var/log/messages | wc -l` -trun "service multipathd status > tmp_file" -Condition3=`grep " DM message failed" tmp_file | wc -l` - -trun "multipath -F" -trun "modprobe -r scsi_debug" -trun "dmsetup remove_all" - -trun "rm -f tmp_file" -tlog "Condition1=${Condition1} Condition2=${Condition2} Condition3=${Condition3}" -RESULT=PASS -[[ $Condition1 -eq 1 ]]&&[[ $Condition2 -eq 1 ]]&&[[ $Condition3 -eq 1 ]]&&RESULT=FAIL -echo "Test Result = $RESULT" -[[ $RESULT = "FAIL" ]]&&exit 1 -exit 0 +multipathd_state=`service multipathd status | grep "Active: active (running)" | wc -l` +tlog "Checking if multipathd service is running" +assert "[[ $multipathd_state -eq 1 ]]" +pathcount=`multipathd show paths raw format "%m %t" | grep ${mpathdev} | grep "active" | wc -l` +tlog "Checking if active path count equals 2" +assert "[[ $pathcount -eq 2 ]]" +path_state=`multipathd show paths raw format "%d %t %T %o" | grep ${pathname} | grep "active ready running" | wc -l` +tlog "Checking state of ${pathname}" +assert "[[ $path_state -eq 1 ]]" +tend diff --git a/tests/squelch_scsi_id/Makefile b/tests/squelch_scsi_id/Makefile deleted file mode 100644 index 6a7a713..0000000 --- a/tests/squelch_scsi_id/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 Red Hat, Inc. -# # -# # This program is free software: you can redistribute it and/or modify -# # it under the terms of the GNU General Public License as published by -# # the Free Software Foundation, either version 3 of the License, or -# # (at your option) any later version. -# # -# # This program is distributed in the hope that it will be useful, -# # but WITHOUT ANY WARRANTY; without even the implied warranty of -# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# # GNU General Public License for more details. -# # -# # You should have received a copy of the GNU General Public License -# # along with this program. If not, see . -# -# # Author: Lin Li - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: Squelch scsi_id on multipath -ll" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/squelch_scsi_id/main.sh b/tests/squelch_scsi_id/main.sh index 3394303..e75619a 100755 --- a/tests/squelch_scsi_id/main.sh +++ b/tests/squelch_scsi_id/main.sh @@ -21,7 +21,7 @@ source ../include/ec.sh || exit 200 function main (){ local exit_status=1 - + Multipath_installation || Fail "fail to install device-mapper-multipath" Print_kernel_info Print_multipath_pkginfo diff --git a/tests/tests.yml b/tests/tests.yml index 8806fee..4c396d2 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -5,16 +5,38 @@ # Tests suitable for classic environment - hosts: localhost roles: + - role: standard-test-basic + tags: + - classic + tests: + - medium_error_scsi_debug: + run: ./main.sh + timeout: 15m + - squelch_scsi_id: + run: ./main.sh + timeout: 15m + - multipathd_oom: + run: ./main.sh + timeout: 15m + - user_friendly_names: + run: ./main.sh + timeout: 15m + - kpartx_4k_aligned: + run: ./main.sh + timeout: 15m + - bindings: + run: ./main.sh + timeout: 15m + required_packages: + - device-mapper-multipath + - perl + - role: standard-test-beakerlib tags: - classic tests: - - medium_error_scsi_debug - - squelch_scsi_id - - multipathd_oom - - user_friendly_names - - multipath_conf_syntax - - kpartx_4k_aligned - - bindings + - multipath_conf_syntax: + timeout: 15m required_packages: - device-mapper-multipath + - perl diff --git a/tests/user_friendly_names/Makefile b/tests/user_friendly_names/Makefile deleted file mode 100644 index 80fca20..0000000 --- a/tests/user_friendly_names/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2016 Red Hat, Inc. -# # -# # This program is free software: you can redistribute it and/or modify -# # it under the terms of the GNU General Public License as published by -# # the Free Software Foundation, either version 3 of the License, or -# # (at your option) any later version. -# # -# # This program is distributed in the hope that it will be useful, -# # but WITHOUT ANY WARRANTY; without even the implied warranty of -# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# # GNU General Public License for more details. -# # -# # You should have received a copy of the GNU General Public License -# # along with this program. If not, see . -# -# # Author: Lin Li - -.PHONY: all install download clean - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE main.sh multipath.conf.no multipath.conf.yes - -run: $(FILES) build - ./main.sh - -build: $(BUILT_FILES) - chmod a+x ./main.sh - -clean: - rm -f *~ *.rpm $(BUILT_FILES) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @touch $(METADATA) - @echo "Owner: LiLin " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Description: user_friendly_names" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: device-mapper-multipath" >> $(METADATA) - @echo "Requires: device-mapper-multipath" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/user_friendly_names/main.sh b/tests/user_friendly_names/main.sh index b8d3a36..56082fd 100755 --- a/tests/user_friendly_names/main.sh +++ b/tests/user_friendly_names/main.sh @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Author: Lin Li @@ -28,8 +28,8 @@ trun "mpathconf --enable --with_multipathd y --user_friendly_names y" trun "cp /etc/multipath.conf /etc/multipath.conf.$$" trun "multipath -F" -trun "modprobe scsi_debug dev_size_mb=256 num_tgts=1 vpd_use_hostno=0 \ -add_host=2 delay=20 max_luns=2 no_lun_0=1" +trun "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 \ +max_luns=2 no_lun_0=1" trun "multipath" # wwid shown slowly on s390x by the script framework, but normally when run by multipath command directly # so extend sleep time @@ -43,14 +43,19 @@ mpath=$(get_mpath_disk_by_scsi_device $disk) # user_friendly_names = yes and mpath=test #cur_dir=/mnt/tests/kernel/storage/multipath/user_friendly_names/ #cur_dir=/home/test/scratch/device-mapper-multipath/user_friendly_names -trun "cat multipath.conf.yes | sed 's/your_wwid/$wwid/g' > /etc/multipath.conf" +trun "cat multipath.conf.yes | sed "s/your_wwid/$wwid/g" > /etc/multipath.conf" +trun "cat -n /etc/multipath.conf" trun "multipath -r" -tok "multipath -ll | grep -w '^test'" +echo ">>> Verify 'test ($wwid)' is present ..." +trun "multipath -ll" +tok "multipath -ll | egrep \"^test\"" # user_friendly_names = no trun "cat multipath.conf.no > /etc/multipath.conf" trun "multipath -r" -tok "multipath -ll | grep -w '^$wwid'" +echo ">>> Verify 'test' is gone but '$wwid' present ..." +trun "multipath -ll" +tok "multipath -ll | egrep \"^$wwid\"" sleep 10 tok "multipath -F $wwid" sleep 10