#!/bin/bash # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # runtest.sh of /CoreOS/vim/Regression/docs # Description: Test for man pages bugs: # BZ#1599660 (Conflicting manpages rvi.1.gz and vi.1.gz during) # # Author: Patrik Mosko # # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Copyright (c) 2018 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 2 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 http://www.gnu.org/licenses/. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Include Beaker environment . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGES="vim-common vim-minimal" rlJournalStart rlPhaseStartSetup rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlAssertRpm --all rlPhaseEnd ############################################################ # BZ#1599660 ############################################################ rlPhaseStartTest "Test conflicting vim-{common,minimal} man pages" VIMmin_ver=(`rpm -q vim-minimal | rev | sed -r 's;^[^.]*.[^.]*.([^-]*-[^-]*)-.*$;\1;' | rev | tr '.-' ' '`) VIMcom_ver=(`rpm -q vim-common | rev | sed -r 's;^[^.]*.[^.]*.([^-]*-[^-]*)-.*$;\1;' | rev | tr '.-' ' '`) VIMcom_conf_ver=(`rpm -q --conflicts vim-minimal | grep vim-common | awk '{print $3}' | tr '.-' ' '`) VIMmin_conf_ver=(`rpm -q --conflicts vim-common | grep vim-minimal | awk '{print $3}' | tr '.-' ' '`) # check only man-page files, could be changed to all files rpm -ql vim-minimal | grep /man/ > VimMinRpmFiles rpm -ql vim-common | grep /man/ > VimComRpmFiles rlAssertExists VimMinRpmFiles rlAssertExists VimComRpmFiles rlAssertNotGrep VimMinRpmFiles VimComRpmFiles -w -f #check version of actual vim-minimal with the one[s] that vim-common is conflicting with higher=0 for v in "${!VIMmin_conf_ver[@]}"; do (( ${VIMmin_ver[$v]} >= ${VIMmin_conf_ver[$v]} )) && [[ $higher == 0 ]] || break #at least one part of the version should be higher than the same part in the other vim's rpm's (( ${VIMmin_ver[$v]} > ${VIMmin_conf_ver[$v]} )) && (( higher++ )) done if [ ${VIMmin_conf_ver[@]} -eq 0 ]; then rlPass "vim-common doesn't conflicts with vim-minimal" elif [ $higher -ge 0 ]; then rlPass "Actual version of vim-minimal is not conflicting with vim-common" else rlFail "Actual version of vim-minimal may conflicts with vim-common" fi #check version of actual vim-common with the one[s] that vim-minimal is conflicting with higher=0 for v in "${!VIMcom_conf_ver[@]}"; do (( ${VIMcom_ver[$v]} >= ${VIMcom_conf_ver[$v]} )) && [[ $higher == 0 ]] || break #at least one part of the version should be higher than the same part in the other vim's rpm's (( ${VIMcom_ver[$v]} > ${VIMcom_conf_ver[$v]} )) && (( higher++ )) done if [ ${VIMcom_conf_ver[@]} -eq 0 ]; then rlPass "vim-common doesn't conflicts with vim-minimal" elif [ $higher -ge 0 ]; then rlPass "Actual version of vim-common is not conflicting with vim-minimal" else rlFail "Actual version of vim-common may conflicts with vim-minimal" fi rlPhaseEnd # BZ#??????? # As RECOMMENDED in Best QA Practices, each man page fix that needs test case # should be inserted here as independent Test Phase #rlPhaseStartTest # rlRun "" #rlPhaseEnd rlPhaseStartCleanup rlRun "popd" rlRun "rm -r $TmpDir" 0 "Removing tmp directory" rlPhaseEnd rlJournalPrintText rlJournalEnd