diff options
| author | Bill Peck <bpeck@redhat.com> | 2014-11-24 11:05:14 -0500 |
|---|---|---|
| committer | Bill Peck <bpeck@redhat.com> | 2014-11-24 11:05:14 -0500 |
| commit | 58ce7234de6c4c582f4a7a2af6a9b7da124da537 (patch) | |
| tree | d70393056cb6a8489a87579671d9f2886d992ba4 | |
| parent | 54e094e0ba2ac0e6f549433a759c551f28b0b89b (diff) | |
| download | tests-58ce7234de6c4c582f4a7a2af6a9b7da124da537.tar.gz tests-58ce7234de6c4c582f4a7a2af6a9b7da124da537.tar.xz tests-58ce7234de6c4c582f4a7a2af6a9b7da124da537.zip | |
First attempt at fixing xen serial consoles
| -rwxr-xr-x | kernel/kernelinstall/runtest.sh | 176 |
1 files changed, 166 insertions, 10 deletions
diff --git a/kernel/kernelinstall/runtest.sh b/kernel/kernelinstall/runtest.sh index 3debc27..a2e46fa 100755 --- a/kernel/kernelinstall/runtest.sh +++ b/kernel/kernelinstall/runtest.sh @@ -2,7 +2,7 @@ # Source the common test script helpers . /usr/bin/rhts_environment.sh -. /mnt/tests/kernel/include/runtest.sh +. ../../kernel/include/runtest.sh CUR_TIME=$(date --date="$(date --utc)" +%s) # control where to log debug messages to: @@ -67,7 +67,7 @@ function SysReport () biosRelease=$(dmidecode --type=0 | /bin/grep -i release | /bin/awk -F: '{print $2}') biosRevision=$(dmidecode --type=0 | /bin/grep -i revision | /bin/awk -F: '{print $2}') # - syslspci=$(/sbin/lspci > $OUTPUTDIR/lspci.$kernbase) + syslspci=$(/sbin/lspci -nn > $OUTPUTDIR/lspci.$kernbase) if [ -f /etc/fedora-release ]; then sysrelease=$(/bin/cat /etc/fedora-release) else @@ -387,6 +387,37 @@ function WorkaroundBug798577 () DeBug "WorkaroundBug798577: end" } +function update_console () +{ + # Xen uses com1 for ttyS0 and com2 for ttyS1 + # com1 might be setup automatically *if* you installed xen from anaconda + # com2 is never set up correctly by anaconda. + + # Take first serial console entry + console=$(awk '/console=ttyS/{for(i=1;i<=NF;++i)if($i~/console=ttyS[^ ]*/)print $i; exit}' /etc/grub.conf) + # Find our defult kernel + default_kernel=$(grubby --default-kernel) + # Get the serial settings + settings=$(echo $console | awk -F, '{ print $2 }') + + DeBug $console + if echo $console | grep -q ttyS0 ; then + # Configure com1, may already be done if installed xen from anaconda + DeBug "ttyS0 = com1" + grubby --mbargs com1=$settings --update-kernel=$default_kernel + elif echo $console | grep -q ttyS1 ; then + # Configure com2, change linux kernel console=ttyS1 to console=ttyS0 + DeBug "ttyS1 = com2" + ttyS0=$(echo $console | sed -e 's/ttyS1/ttyS0/') + grubby --remove-mbargs com1=$settings --update-kernel=$default_kernel + grubby --mbargs com2=$settings --update-kernel=$default_kernel + grubby --remove-args $console --update-kernel=$default_kernel + grubby --args $ttyS0 --update-kernel=$default_kernel + else + DeBug "Non-standard serial console" + fi +} + function SelectKernelGrubby () { DeBug "Enter SelectKernelGrubby" @@ -401,11 +432,15 @@ function SelectKernelGrubby () fi # match vmlinuz with $VR and $EXTRA, take first shortest match + # try to find vmlinuz in kernel and kernel-core packages + local vmlinuz_kernel="$(rpm -ql $testkername-$KERNELARGVERSION.$kernarch | grep -e /vmlinu.-$VR | grep "$EXTRA" | awk '{print length"\t"$0}' | sort -n | cut -f2-)" + local vmlinuz_kernel_core="$(rpm -ql $testkername-core-$KERNELARGVERSION.$kernarch | grep -e /vmlinu.-$VR | grep "$EXTRA" | awk '{print length"\t"$0}' | sort -n | cut -f2-)" + if [ -e "/etc/grub.conf" ]; then # If /etc/grub.conf exists, make sure the requested kernel exists in /etc/grub.conf - vmlinuz=$(for kernel in $(rpm -ql $testkernbase | grep -e /vmlinu.-$VR | grep "$EXTRA" | awk '{print length"\t"$0}' | sort -n | cut -f2-); do grep -q ${kernel#/boot} /etc/grub.conf && echo $kernel; done | head -1) + vmlinuz=$(for kernel in $vmlinuz_kernel $vmlinuz_kernel_core; do grep -q ${kernel#/boot} /etc/grub.conf && echo $kernel; done | head -1) else - vmlinuz=$(rpm -ql $testkernbase.$kernarch | grep -e /vmlinu.-$VR | grep "$EXTRA" | awk '{print length"\t"$0}' | sort -n | cut -f2- | head -1) + vmlinuz=$(echo $vmlinuz_kernel $vmlinuz_kernel_core | head -1) fi if [ -n "$vmlinuz" ]; then @@ -416,6 +451,9 @@ function SelectKernelGrubby () DeBug "grubby --default-kernel: $default_vmlinuz" LogBootloaderConfig + if [ "$EXTRA" == "xen" ]; then + update_console + fi if [ "$default_vmlinuz" == "$vmlinuz" ]; then DeBug "grubby reports correct kernel as default: $default_vmlinuz" else @@ -700,6 +738,13 @@ function YumUpgradeKernelHeaders () # so let's use yum list all instead DeBug "Enter YumUpgradeKernelHeaders" echo "***** Upgrade $KERNELHEADERS via yum *****" | tee -a $OUTPUTFILE + REBOOT_TIME=$(cat /mnt/testarea/kernelinstall_reboottime.log) + DIFF=$(expr ${CUR_TIME} - ${REBOOT_TIME}) + if [[ ${DIFF} -gt 480 ]]; then + let DIFF_MIN=$DIFF/60 + let DIFF_SEC=$DIFF%60 + echo "***** WARN: Task took ${DIFF_MIN} minutes and ${DIFF_SEC} second(s) to run *****" >> $OUTPUTFILE + fi DeBug "Yum upgrade $KERNELHEADERS" $yumcmd list all $KERNELHEADERS | grep -q $testkernver-$testkernrel if [ "$?" -eq "0" ]; then @@ -840,6 +885,101 @@ function workaround_bug905918 () echo "Exiting workaround_bug905918" >> $OUTPUTFILE } +function workaround_bug905910 () +{ + # Bug 905910 - X.509: Cert # is not yet valid + local ret=0 + OUTPUTFILE=`mktemp /tmp/tmp.XXXXXX` + echo "Enter workaround_bug905910" >> $OUTPUTFILE + if [ -f $OUTPUTDIR/boot.$kernbase ]; then + grep -e "X.509: Cert [0-9a-fA-F]* is not yet valid" $OUTPUTDIR/boot.$kernbase > /dev/null + if [ $? -eq 0 ]; then + echo "Changing hwclock to UTC" | tee -a $OUTPUTFILE + hwclock --systohc --utc >> $OUTPUTFILE 2>&1 + ret=$? + cat /etc/adjtime | tee -a $OUTPUTFILE + echo "Exiting workaround_bug905910" >> $OUTPUTFILE + RprtRslt $TEST/set-hwclock WARN $ret + if [ $ret -eq 0 ]; then + rhts-reboot + fi + else + echo "Kernel seems happy about Cert start date, not doing anything" | tee -a $OUTPUTFILE + fi + fi + echo "Exiting workaround_bug905910" >> $OUTPUTFILE +} + +function CheckCPUcount () +{ +# BZ1050040 http://patchwork.lab.bos.redhat.com/patch/74358/ +# This function checks to see if the CPU count value +# has changed between the base kernel and test kernel. +# If the maxcpu option is used on the +# kernel command line, then skip this check. + +local maxcpuCheck=$(/bin/cat /proc/cmdline | grep -q maxcpu)$? +local system=$(/bin/uname -n) + +DeBug "Enter CheckCPUcount" + +# Check for use of kernel commandline maxcpu option +if [ "$maxcpuCheck" -gt "0" ]; then + # The maxcpu option is not in use. + # Lets check the CPU count. + if [ "$REBOOTCOUNT" -eq "0" ]; then + # Lets get the CPU count for the base kernel. + # We will save the base kernel variables, in order to survive a reboot. + /bin/uname -r > /mnt/testarea/base_kernelSaved + /bin/cat /proc/cpuinfo | /bin/grep ^processor | wc -l > /mnt/testarea/cpuCountSaved + + local base_kernel=$(/bin/cat /mnt/testarea/base_kernelSaved) + local base_kernel_cpuCount=$(/bin/cat /mnt/testarea/cpuCountSaved) + + DeBug " Check the system CPU count for kernel-${base_kernel}" + echo "" >> $OUTPUTFILE + echo "***** Check the system CPU count for kernel-${base_kernel} *****" >> $OUTPUTFILE + echo "***** CPU count for kernel-${base_kernel} is: $base_kernel_cpuCount *****" >> $OUTPUTFILE + echo "" >> $OUTPUTFILE + + else + # A reboot was expected, as we are booting a new kernel for testing. + # Lets get the CPU count for the test kernel. + # Then lets compare the base kernel and test kernel values. + local test_kernel=$(/bin/uname -r) + local test_kernel_cpuCount=$(/bin/cat /proc/cpuinfo | /bin/grep ^processor | wc -l) + # Lets restore the saved base_kernel variables + local base_kernel=$(/bin/cat /mnt/testarea/base_kernelSaved) + local base_kernel_cpuCount=$(/bin/cat /mnt/testarea/cpuCountSaved) + + DeBug " Check and compare base_kernel_cpuCount and test_kernel_cpuCount values" + echo "" >> $OUTPUTFILE + echo "***** Comparing the CPU counts taken for the base kernel and test kernel *****" >> $OUTPUTFILE + if [ "$base_kernel_cpuCount" -eq "$test_kernel_cpuCount" ]; then + DeBug " INFO: $system CPU count has not changed" + echo "***** INFO: $system CPU count has not changed *****" >> $OUTPUTFILE + echo "" >> $OUTPUTFILE + else + # Lets WARN the user, report the status, and continue testing. + DeBug " WARN: CPU count has changed" + echo "***** kernel-${base_kernel} showed a CPU count of: $base_kernel_cpuCount *****" >> $OUTPUTFILE + echo "***** kernel-${test_kernel} showed a CPU count of: $test_kernel_cpuCount *****" >> $OUTPUTFILE + K_ReportStatus "Warn" "$system CPU count has changed" "CheckCPUcount" + echo "" >> $OUTPUTFILE + fi + fi +else + # The kernel command line contains the maxcpu option. + # Display a notification and continue testing. + DeBug " INFO: /proc/cmdline has the maxcpu option" + echo "" >> $OUTPUTFILE + echo "***** INFO: /proc/cmdline has the maxcpu option *****" >> $OUTPUTFILE + echo "" >> $OUTPUTFILE +fi + +DeBug "Exit CheckCPUcount" +} + function Main () { DeBug "Enter Main" @@ -856,6 +996,9 @@ function Main () # workaround Bug 905918 - set ONBOOT=yes only for interfaces used during installation workaround_bug905918 + # CheckCPU count with base kernel + CheckCPUcount + # Check to see if the kernel we want to test is already running CheckKernel $KERNELARGVERSION $KERNELARGVARIANT if [ "$?" = "1" ]; then @@ -909,15 +1052,19 @@ DeBug "$testver" # Current kernel variables runkernel=$K_RUNNING_VR kernbase=$(rpm -q --queryformat '%{name}-%{version}-%{release}\n' -qf /boot/config-$(uname -r)) -kername=$(rpm -q --queryformat '%{name}\n' -qf /boot/config-$(uname -r)) kernver=$(rpm -q --queryformat '%{version}\n' -qf /boot/config-$(uname -r)) kernrel=$(rpm -q --queryformat '%{release}\n' -qf /boot/config-$(uname -r)) kernarch=$(rpm -q --queryformat '%{arch}\n' -qf /boot/config-$(uname -r)) kernvariant=$(uname -r | sed -e "s/${kernver}-${kernrel}//g" -e "s/\.$(uname -m).//g") -kerndevel=$(rpm -q --queryformat '%{name}-devel-%{version}-%{release}\n' -qf /boot/config-$(uname -r)) + +# drop -core- from name if present, this is to deal with meta-style +# packaging of kernel RPMs. Removing it here should be OK +# because kernbase is used only for naming of log/result files +kernbase=$(echo $kernbase | sed 's/-core-/-/') + DeBug "Running kernel variables" DeBug "RUNNINGKERNEL=$runkernel" -DeBug "1=$kernbase 2=$kername 3=$kernver 4=$kernrel 5=$kernarch 6=$kernvariant 7=$kerndevel" +DeBug "1=$kernbase 2=$kernver 3=$kernrel 4=$kernarch 5=$kernvariant" # Test ARGS that are defined DeBug "TEST ARGS (Environment variables)" @@ -983,7 +1130,8 @@ fi # Record lspci -xxx -vv if [ -x /sbin/lspci ]; then - /sbin/lspci -xxx -vv > $OUTPUTDIR/lspci.$kernbase + /sbin/lspci -xxx -vv > $OUTPUTDIR/lspci.hexdump.$kernbase + SubmitLog $OUTPUTDIR/lspci.hexdump.$kernbase fi # Record the boot messages @@ -999,9 +1147,9 @@ if [ -z "$KERNELARGNAME" -o -z "$KERNELARGVARIANT" -o -z "$KERNELARGVERSION" ]; RprtRslt $TEST/$kernbase FAIL 1 exit 0 else - if [ "$REBOOTCOUNT" != "1" ]; then + if [ "$REBOOTCOUNT" == "0" ]; then Main - else + elif [ "$REBOOTCOUNT" == "1" ]; then if [ -f $OUTPUTDIR/boot.$kernbase ]; then SubmitLog $OUTPUTDIR/boot.$kernbase fi @@ -1013,6 +1161,8 @@ else RHTSAbort else DeBug "After reboot we are running the correct kernel" + # CheckCPU count with test kernel + CheckCPUcount YumUpgradeKernelHeaders REBOOT_TIME=$(cat /mnt/testarea/kernelinstall_reboottime.log) DIFF=$(expr ${CUR_TIME} - ${REBOOT_TIME}) @@ -1029,5 +1179,11 @@ else SysReport fi SubmitLog $DEBUGLOG + workaround_bug905910 + else + if [ -f $OUTPUTDIR/boot.$kernbase ]; then + SubmitLog $OUTPUTDIR/boot.$kernbase + fi + RprtRslt $TEST/boot PASS 0 fi fi |
