From: "Brian C. Lane" bcl@redhat.com
This way you can do export PYTHONPATH=/path/to/py3lorax before running the tests on a f22 system where lorax is still python2. --- tests/kickstart_tests/run_kickstart_tests.sh | 4 ++-- tests/kickstart_tests/run_one_ks.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/kickstart_tests/run_kickstart_tests.sh b/tests/kickstart_tests/run_kickstart_tests.sh index 169ef68..630813c 100755 --- a/tests/kickstart_tests/run_kickstart_tests.sh +++ b/tests/kickstart_tests/run_kickstart_tests.sh @@ -132,7 +132,7 @@ if [[ "$TEST_REMOTES" != "" ]]; then
parallel --no-notice ${remote_args} \ ${env_args} --jobs ${TEST_JOBS:-2} \ - sudo kickstart_tests/run_one_ks.sh -i ${_IMAGE} -k ${KEEPIT} {} ::: ${tests} + sudo PYTHONPATH=$PYTHONPATH kickstart_tests/run_one_ks.sh -i ${_IMAGE} -k ${KEEPIT} {} ::: ${tests} rc=$?
# (3) Get all the results back from the remote systems, which will have already @@ -159,7 +159,7 @@ if [[ "$TEST_REMOTES" != "" ]]; then exit ${rc} else parallel --no-notice ${env_args} --jobs ${TEST_JOBS:-2} \ - sudo kickstart_tests/run_one_ks.sh -i ${IMAGE} -k ${KEEPIT} {} ::: ${tests} + sudo PYTHONPATH=$PYTHONPATH kickstart_tests/run_one_ks.sh -i ${IMAGE} -k ${KEEPIT} {} ::: ${tests}
# For future expansion - any cleanup code can go in between the variable # setting and the exit, like in the other branch of the if-else above. diff --git a/tests/kickstart_tests/run_one_ks.sh b/tests/kickstart_tests/run_one_ks.sh index b84607f..b5234d9 100755 --- a/tests/kickstart_tests/run_one_ks.sh +++ b/tests/kickstart_tests/run_one_ks.sh @@ -86,6 +86,7 @@ runone() { disks=$(prepare_disks ${tmpdir}) disk_args=$(for d in $disks; do echo --disk $d; done)
+ echo "PYTHONPATH=$PYTHONPATH" eval ${KSTESTDIR}/kstest-runner ${kargs} \ --iso "${tmpdir}/$(basename ${IMAGE})" \ --ks ${ksfile} \
From: "Brian C. Lane" bcl@redhat.com
This adds a test that creates a 2 disk RAID1 and confirms that /, swap and /boot are properly mounted. The ks uses numbered md devices to make checking /proc/mounts easier.
The results checking depends on virt-cat ordering the /dev/mdXXX the same every time. So far that has proven true. --- tests/kickstart_tests/raid-1.ks | 109 ++++++++++++++++++++++++++++++++++++++++ tests/kickstart_tests/raid-1.sh | 49 ++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 tests/kickstart_tests/raid-1.ks create mode 100755 tests/kickstart_tests/raid-1.sh
diff --git a/tests/kickstart_tests/raid-1.ks b/tests/kickstart_tests/raid-1.ks new file mode 100644 index 0000000..efcd754 --- /dev/null +++ b/tests/kickstart_tests/raid-1.ks @@ -0,0 +1,109 @@ +#version=DEVEL +url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basear..." +install +network --bootproto=dhcp + +bootloader --timeout=1 +clearpart --all --initlabel + +part raid.01 --size=500 --ondisk=sda --asprimary +part raid.02 --size=500 --ondisk=sdb --asprimary +part raid.11 --size=4000 --ondisk=sda +part raid.12 --size=4000 --ondisk=sdb +part raid.21 --size=1024 --ondisk=sda +part raid.22 --size=1024 --ondisk=sdb + +# Yes, using 0,1,2 is wrong, but /proc/mounts uses /dev/mdX not /dev/md/X +raid /boot --level=1 --device=0 --fstype=ext4 raid.01 raid.02 +raid swap --level=1 --device=1 --fstype=swap raid.21 raid.22 +raid / --level=1 --device=2 --fstype=ext4 raid.11 raid.12 + +keyboard us +lang en_US.UTF-8 +timezone America/New_York --utc +rootpw testcase +shutdown + +%packages +%end + +%post +# Verify the / raid level +root_raidlevel="$(grep ^md2.*active\sraid1 /proc/mdstat)" +if [ -z "$root_raidlevel" ]; then + echo "*** mdraid 'root' is not a RAID1" >> /root/RESULT +fi + +root_md="/dev/md2" +root_uuid="UUID=$(blkid -o value -s UUID $root_md)" + +# verify root md is mounted at /mnt/sysimage +root_mount="$(grep ^$root_md\s/\s /proc/mounts)" +if [ -z "$root_mount" ]; then + echo "*** mdraid 'root' is not mounted at /" >> /root/RESULT +fi + +root_fstype="$(echo $root_mount | cut -d' ' -f3)" +if [ $root_fstype != "ext4" ]; then + echo "*** mdraid 'root' does not contain an ext4 fs" >> /root/RESULT +fi + +# verify root entry in /etc/fstab is correct +root_md_entry="$(grep ^$root_md\s/\s /etc/fstab)" +root_uuid_entry="$(grep ^$root_uuid\s/\s /etc/fstab)" +if [ -z "$root_md_entry" -a -z "$root_uuid_entry" ] ; then + echo "*** root md is not the root entry in /etc/fstab" >> /root/RESULT +fi + +# Verify the swap raid level +swap_raidlevel="$(grep ^md1.*active\sraid1 /proc/mdstat)" +if [ -z "$swap_raidlevel" ]; then + echo "*** mdraid 'swap' is not a RAID1" >> /root/RESULT +fi + +# verify swap on md is active +swap_md="/dev/md1" +swap_uuid="UUID=$(blkid -o value -s UUID $swap_md)" +if ! grep -q $swap_md /proc/swaps ; then + echo "*** mdraid 'swap' is not active as swap space" >> /root/RESULT +fi + +# verify swap entry in /etc/fstab is correct +swap_md_entry="$(grep ^$swap_md\sswap\s /etc/fstab)" +swap_uuid_entry="$(grep ^$swap_uuid\sswap\s /etc/fstab)" +if [ -z "$swap_md_entry" -a -z "$swap_uuid_entry" ] ; then + echo "*** swap md is not in /etc/fstab" >> /root/RESULT +fi + +# Verify the boot raid level +boot_raidlevel="$(grep ^md0.*active\sraid1 /proc/mdstat)" +if [ -z "$boot_raidlevel" ]; then + echo "*** mdraid 'boot' is not a RAID1" >> /root/RESULT +fi + +boot_md="/dev/md0" +boot_uuid="UUID=$(blkid -o value -s UUID $boot_md)" + +# verify boot md is mounted at /mnt/sysimage/boot +boot_mount="$(grep ^$boot_md\s/boot\s /proc/mounts)" +if [ -z "$boot_mount" ]; then + echo "*** mdraid 'boot' is not mounted at /boot" >> /root/RESULT +fi + +boot_fstype="$(echo $boot_mount | cut -d' ' -f3)" +if [ $boot_fstype != "ext4" ]; then + echo "*** mdraid 'boot' does not contain an ext4 fs" >> /root/RESULT +fi + +# verify boot entry in /etc/fstab is correct +boot_md_entry="$(grep ^$boot_md\s/boot\s /etc/fstab)" +boot_uuid_entry="$(grep ^$boot_uuid\s/boot\s /etc/fstab)" +if [ -z "$boot_md_entry" -a -z "$boot_uuid_entry" ] ; then + echo "*** boot md is not the root entry in /etc/fstab" >> /root/RESULT +fi + +if [ ! -e /root/RESULT ]; then + echo SUCCESS > /root/RESULT +fi +sleep 9999999999999 +%end diff --git a/tests/kickstart_tests/raid-1.sh b/tests/kickstart_tests/raid-1.sh new file mode 100755 index 0000000..4ed81ed --- /dev/null +++ b/tests/kickstart_tests/raid-1.sh @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015 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, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties 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. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Chris Lumens clumens@redhat.com + +. ${KSTESTDIR}/functions.sh + +prepare_disks() { + tmpdir=$1 + + qemu-img create -q -f qcow2 ${tmpdir}/disks/a.img 10G + qemu-img create -q -f qcow2 ${tmpdir}/disks/b.img 10G + echo ${tmpdir}/disks/a.img ${tmpdir}/disks/b.img +} + +validate() { + disksdir=$1 + args=$(for d in ${disksdir}/*img; do echo -a ${d}; done) + + # virt-cat doesn't setup /dev/md/* links so cross our fingers that + # / always ends up on /dev/md126 + # There should be a /root/RESULT file with results in it. Check + # its contents and decide whether the test finally succeeded or + # not. + result=$(virt-cat ${args} -m /dev/md126 /root/RESULT) + if [[ $? != 0 ]]; then + status=1 + echo '*** /root/RESULT does not exist in VM image.' + elif [[ "${result}" != SUCCESS* ]]; then + status=1 + echo "${result}" + fi + + return ${status} +}
@@ -0,0 +1,109 @@ +#version=DEVEL +url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basear..." +install +network --bootproto=dhcp
+bootloader --timeout=1 +clearpart --all --initlabel
+part raid.01 --size=500 --ondisk=sda --asprimary +part raid.02 --size=500 --ondisk=sdb --asprimary +part raid.11 --size=4000 --ondisk=sda +part raid.12 --size=4000 --ondisk=sdb +part raid.21 --size=1024 --ondisk=sda +part raid.22 --size=1024 --ondisk=sdb
+# Yes, using 0,1,2 is wrong, but /proc/mounts uses /dev/mdX not /dev/md/X +raid /boot --level=1 --device=0 --fstype=ext4 raid.01 raid.02 +raid swap --level=1 --device=1 --fstype=swap raid.21 raid.22 +raid / --level=1 --device=2 --fstype=ext4 raid.11 raid.12
+keyboard us +lang en_US.UTF-8 +timezone America/New_York --utc +rootpw testcase +shutdown
+%packages +%end
+%post +# Verify the / raid level +root_raidlevel="$(grep ^md2.*active\sraid1 /proc/mdstat)" +if [ -z "$root_raidlevel" ]; then
- echo "*** mdraid 'root' is not a RAID1" >> /root/RESULT
+fi
+root_md="/dev/md2" +root_uuid="UUID=$(blkid -o value -s UUID $root_md)"
+# verify root md is mounted at /mnt/sysimage +root_mount="$(grep ^$root_md\s/\s /proc/mounts)" +if [ -z "$root_mount" ]; then
- echo "*** mdraid 'root' is not mounted at /" >> /root/RESULT
+fi
+root_fstype="$(echo $root_mount | cut -d' ' -f3)" +if [ $root_fstype != "ext4" ]; then
- echo "*** mdraid 'root' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify root entry in /etc/fstab is correct +root_md_entry="$(grep ^$root_md\s/\s /etc/fstab)" +root_uuid_entry="$(grep ^$root_uuid\s/\s /etc/fstab)" +if [ -z "$root_md_entry" -a -z "$root_uuid_entry" ] ; then
- echo "*** root md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+# Verify the swap raid level +swap_raidlevel="$(grep ^md1.*active\sraid1 /proc/mdstat)" +if [ -z "$swap_raidlevel" ]; then
- echo "*** mdraid 'swap' is not a RAID1" >> /root/RESULT
+fi
+# verify swap on md is active +swap_md="/dev/md1" +swap_uuid="UUID=$(blkid -o value -s UUID $swap_md)" +if ! grep -q $swap_md /proc/swaps ; then
- echo "*** mdraid 'swap' is not active as swap space" >> /root/RESULT
+fi
+# verify swap entry in /etc/fstab is correct +swap_md_entry="$(grep ^$swap_md\sswap\s /etc/fstab)" +swap_uuid_entry="$(grep ^$swap_uuid\sswap\s /etc/fstab)" +if [ -z "$swap_md_entry" -a -z "$swap_uuid_entry" ] ; then
- echo "*** swap md is not in /etc/fstab" >> /root/RESULT
+fi
+# Verify the boot raid level +boot_raidlevel="$(grep ^md0.*active\sraid1 /proc/mdstat)" +if [ -z "$boot_raidlevel" ]; then
- echo "*** mdraid 'boot' is not a RAID1" >> /root/RESULT
+fi
+boot_md="/dev/md0" +boot_uuid="UUID=$(blkid -o value -s UUID $boot_md)"
+# verify boot md is mounted at /mnt/sysimage/boot +boot_mount="$(grep ^$boot_md\s/boot\s /proc/mounts)" +if [ -z "$boot_mount" ]; then
- echo "*** mdraid 'boot' is not mounted at /boot" >> /root/RESULT
+fi
+boot_fstype="$(echo $boot_mount | cut -d' ' -f3)" +if [ $boot_fstype != "ext4" ]; then
- echo "*** mdraid 'boot' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify boot entry in /etc/fstab is correct +boot_md_entry="$(grep ^$boot_md\s/boot\s /etc/fstab)" +boot_uuid_entry="$(grep ^$boot_uuid\s/boot\s /etc/fstab)" +if [ -z "$boot_md_entry" -a -z "$boot_uuid_entry" ] ; then
- echo "*** boot md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+if [ ! -e /root/RESULT ]; then
- echo SUCCESS > /root/RESULT
+fi +sleep 9999999999999
Why is this ``sleep`` needed? Unless I'm missing something it should be either removed or given a comment explaining its purpose.
Looks good to me other than the above question.
Added label: ACK.
@@ -0,0 +1,109 @@ +#version=DEVEL +url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basear..." +install +network --bootproto=dhcp
+bootloader --timeout=1 +clearpart --all --initlabel
+part raid.01 --size=500 --ondisk=sda --asprimary +part raid.02 --size=500 --ondisk=sdb --asprimary +part raid.11 --size=4000 --ondisk=sda +part raid.12 --size=4000 --ondisk=sdb +part raid.21 --size=1024 --ondisk=sda +part raid.22 --size=1024 --ondisk=sdb
+# Yes, using 0,1,2 is wrong, but /proc/mounts uses /dev/mdX not /dev/md/X +raid /boot --level=1 --device=0 --fstype=ext4 raid.01 raid.02 +raid swap --level=1 --device=1 --fstype=swap raid.21 raid.22 +raid / --level=1 --device=2 --fstype=ext4 raid.11 raid.12
+keyboard us +lang en_US.UTF-8 +timezone America/New_York --utc +rootpw testcase +shutdown
+%packages +%end
+%post +# Verify the / raid level +root_raidlevel="$(grep ^md2.*active\sraid1 /proc/mdstat)" +if [ -z "$root_raidlevel" ]; then
- echo "*** mdraid 'root' is not a RAID1" >> /root/RESULT
+fi
+root_md="/dev/md2" +root_uuid="UUID=$(blkid -o value -s UUID $root_md)"
+# verify root md is mounted at /mnt/sysimage +root_mount="$(grep ^$root_md\s/\s /proc/mounts)" +if [ -z "$root_mount" ]; then
- echo "*** mdraid 'root' is not mounted at /" >> /root/RESULT
+fi
+root_fstype="$(echo $root_mount | cut -d' ' -f3)" +if [ $root_fstype != "ext4" ]; then
- echo "*** mdraid 'root' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify root entry in /etc/fstab is correct +root_md_entry="$(grep ^$root_md\s/\s /etc/fstab)" +root_uuid_entry="$(grep ^$root_uuid\s/\s /etc/fstab)" +if [ -z "$root_md_entry" -a -z "$root_uuid_entry" ] ; then
- echo "*** root md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+# Verify the swap raid level +swap_raidlevel="$(grep ^md1.*active\sraid1 /proc/mdstat)" +if [ -z "$swap_raidlevel" ]; then
- echo "*** mdraid 'swap' is not a RAID1" >> /root/RESULT
+fi
+# verify swap on md is active +swap_md="/dev/md1" +swap_uuid="UUID=$(blkid -o value -s UUID $swap_md)" +if ! grep -q $swap_md /proc/swaps ; then
- echo "*** mdraid 'swap' is not active as swap space" >> /root/RESULT
+fi
+# verify swap entry in /etc/fstab is correct +swap_md_entry="$(grep ^$swap_md\sswap\s /etc/fstab)" +swap_uuid_entry="$(grep ^$swap_uuid\sswap\s /etc/fstab)" +if [ -z "$swap_md_entry" -a -z "$swap_uuid_entry" ] ; then
- echo "*** swap md is not in /etc/fstab" >> /root/RESULT
+fi
+# Verify the boot raid level +boot_raidlevel="$(grep ^md0.*active\sraid1 /proc/mdstat)" +if [ -z "$boot_raidlevel" ]; then
- echo "*** mdraid 'boot' is not a RAID1" >> /root/RESULT
+fi
+boot_md="/dev/md0" +boot_uuid="UUID=$(blkid -o value -s UUID $boot_md)"
+# verify boot md is mounted at /mnt/sysimage/boot +boot_mount="$(grep ^$boot_md\s/boot\s /proc/mounts)" +if [ -z "$boot_mount" ]; then
- echo "*** mdraid 'boot' is not mounted at /boot" >> /root/RESULT
+fi
+boot_fstype="$(echo $boot_mount | cut -d' ' -f3)" +if [ $boot_fstype != "ext4" ]; then
- echo "*** mdraid 'boot' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify boot entry in /etc/fstab is correct +boot_md_entry="$(grep ^$boot_md\s/boot\s /etc/fstab)" +boot_uuid_entry="$(grep ^$boot_uuid\s/boot\s /etc/fstab)" +if [ -z "$boot_md_entry" -a -z "$boot_uuid_entry" ] ; then
- echo "*** boot md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+if [ ! -e /root/RESULT ]; then
- echo SUCCESS > /root/RESULT
+fi +sleep 9999999999999
Yeah, I don't know what that'd be doing there either.
@@ -0,0 +1,109 @@ +#version=DEVEL +url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basear..." +install +network --bootproto=dhcp
+bootloader --timeout=1 +clearpart --all --initlabel
+part raid.01 --size=500 --ondisk=sda --asprimary +part raid.02 --size=500 --ondisk=sdb --asprimary +part raid.11 --size=4000 --ondisk=sda +part raid.12 --size=4000 --ondisk=sdb +part raid.21 --size=1024 --ondisk=sda +part raid.22 --size=1024 --ondisk=sdb
+# Yes, using 0,1,2 is wrong, but /proc/mounts uses /dev/mdX not /dev/md/X +raid /boot --level=1 --device=0 --fstype=ext4 raid.01 raid.02 +raid swap --level=1 --device=1 --fstype=swap raid.21 raid.22 +raid / --level=1 --device=2 --fstype=ext4 raid.11 raid.12
+keyboard us +lang en_US.UTF-8 +timezone America/New_York --utc +rootpw testcase +shutdown
+%packages +%end
+%post +# Verify the / raid level +root_raidlevel="$(grep ^md2.*active\sraid1 /proc/mdstat)" +if [ -z "$root_raidlevel" ]; then
- echo "*** mdraid 'root' is not a RAID1" >> /root/RESULT
+fi
+root_md="/dev/md2" +root_uuid="UUID=$(blkid -o value -s UUID $root_md)"
+# verify root md is mounted at /mnt/sysimage +root_mount="$(grep ^$root_md\s/\s /proc/mounts)" +if [ -z "$root_mount" ]; then
- echo "*** mdraid 'root' is not mounted at /" >> /root/RESULT
+fi
+root_fstype="$(echo $root_mount | cut -d' ' -f3)" +if [ $root_fstype != "ext4" ]; then
- echo "*** mdraid 'root' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify root entry in /etc/fstab is correct +root_md_entry="$(grep ^$root_md\s/\s /etc/fstab)" +root_uuid_entry="$(grep ^$root_uuid\s/\s /etc/fstab)" +if [ -z "$root_md_entry" -a -z "$root_uuid_entry" ] ; then
- echo "*** root md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+# Verify the swap raid level +swap_raidlevel="$(grep ^md1.*active\sraid1 /proc/mdstat)" +if [ -z "$swap_raidlevel" ]; then
- echo "*** mdraid 'swap' is not a RAID1" >> /root/RESULT
+fi
+# verify swap on md is active +swap_md="/dev/md1" +swap_uuid="UUID=$(blkid -o value -s UUID $swap_md)" +if ! grep -q $swap_md /proc/swaps ; then
- echo "*** mdraid 'swap' is not active as swap space" >> /root/RESULT
+fi
+# verify swap entry in /etc/fstab is correct +swap_md_entry="$(grep ^$swap_md\sswap\s /etc/fstab)" +swap_uuid_entry="$(grep ^$swap_uuid\sswap\s /etc/fstab)" +if [ -z "$swap_md_entry" -a -z "$swap_uuid_entry" ] ; then
- echo "*** swap md is not in /etc/fstab" >> /root/RESULT
+fi
+# Verify the boot raid level +boot_raidlevel="$(grep ^md0.*active\sraid1 /proc/mdstat)" +if [ -z "$boot_raidlevel" ]; then
- echo "*** mdraid 'boot' is not a RAID1" >> /root/RESULT
+fi
+boot_md="/dev/md0" +boot_uuid="UUID=$(blkid -o value -s UUID $boot_md)"
+# verify boot md is mounted at /mnt/sysimage/boot +boot_mount="$(grep ^$boot_md\s/boot\s /proc/mounts)" +if [ -z "$boot_mount" ]; then
- echo "*** mdraid 'boot' is not mounted at /boot" >> /root/RESULT
+fi
+boot_fstype="$(echo $boot_mount | cut -d' ' -f3)" +if [ $boot_fstype != "ext4" ]; then
- echo "*** mdraid 'boot' does not contain an ext4 fs" >> /root/RESULT
+fi
+# verify boot entry in /etc/fstab is correct +boot_md_entry="$(grep ^$boot_md\s/boot\s /etc/fstab)" +boot_uuid_entry="$(grep ^$boot_uuid\s/boot\s /etc/fstab)" +if [ -z "$boot_md_entry" -a -z "$boot_uuid_entry" ] ; then
- echo "*** boot md is not the root entry in /etc/fstab" >> /root/RESULT
+fi
+if [ ! -e /root/RESULT ]; then
- echo SUCCESS > /root/RESULT
+fi +sleep 9999999999999
Why is this sleep needed? Unless I'm missing something it should be either removed or given a comment explaining its purpose.
That would be a diagnostic sleep :) I'll make sure that's been removed.
pushed
Closed.
anaconda-patches@lists.fedorahosted.org