Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Frantisek Hrdina
b61f918097 Adding upstream-scripttests 2021-12-09 14:48:25 +01:00
2 changed files with 199 additions and 0 deletions

View file

@ -0,0 +1,53 @@
summary: Runs upstream script tests
description: ''
contact: fhrdina@redhat.com
component:
- vim
test: ./runtest.sh
framework: beakerlib
recommend:
- vim-enhanced
- rpm-build
- gcc
- Xvfb
- python3
- python3-devel
- ruby
- ruby-devel
- lua-devel
- gpm-devel
- perl-ExtUtils-Embed
- libacl-devel
- libXpm-devel
- ncurses-devel
- perl-devel
- perl
- perl-generators
- python3-dnf-plugins-core
duration: 40m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- NoRHEL6
- TIPfail_infra
- TIPpass
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro == rhel-4, rhel-5
continue: false
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2004974
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011389
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011424
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011429
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011749
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011412
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2002320
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2004976
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2015517
extra-nitrate: TC#0602359
extra-summary: /CoreOS/vim/Sanity/upstream-scripttests
extra-task: /CoreOS/vim/Sanity/upstream-scripttests

View file

@ -0,0 +1,146 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/vim/Sanity/upstream-scripttests
# Description: Runs upstream scripttests
# Authors: Zdenek Dohnal <zdohnal@redhat.com>
# Patrik Mosko <pmosko@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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
PACKAGE="vim-enhanced" # tested package
TESTER="vimtester" # USERname which we use for testing
TEST=scripttests # main target for `make`
SET_XVFB="NO" # Do we want to setup `Xvfb` before testing?
TERM_type="xterm" # terminfo type set before running tests
set -o pipefail # because test output is piped to `tee`
if rlIsRHEL 8
then
CONFOPT="--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-features=huge --enable-python3interp=dynamic --enable-perlinterp=dynamic --disable-tclinterp --with-x=no --enable-gui=no --enable-multibyte --enable-cscope --with-tlib=ncurses --enable-fips-warning --enable-netbeans --enable-rubyinterp=dynamic --enable-luainterp=dynamic"
elif rlIsRHEL 9
then
CONFOPT="--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-features=huge --enable-python3interp=dynamic --enable-perlinterp=dynamic --disable-tclinterp --with-x=no --enable-gui=no --enable-multibyte --enable-cscope --with-tlib=ncurses --enable-fips-warning --enable-netbeans --enable-rubyinterp=dynamic --enable-luainterp=dynamic --disable-canberra"
else
CONFOPT="--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-features=huge --enable-python3interp=dynamic --enable-perlinterp=dynamic --disable-tclinterp --with-x=no --enable-gui=no --enable-multibyte --enable-cscope --with-tlib=ncurses --enable-fips-warning --enable-netbeans --enable-rubyinterp=dynamic --enable-luainterp=dynamic --enable-libsodium --disable-canberra"
fi
_Cleanup_Phase() {
rlPhaseStartCleanup
kill $XVFB_PID
rlFileRestore
rlRun "popd"
rlRun "userdel -frZ $TESTER" 0 "Removing user $TESTER"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
}
rlJournalStart
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlFileBackup /etc/vimrc
rlRun "rm -f /etc/vimrc" 0 "Remove system wide vimrc, breaks the test suite"
if rlIsFedora
then
rlRun "dnf -y install libsodium-devel"
fi
# prepare the user account
rlRun "useradd $TESTER" 0 "Creating user $TESTER"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
# extract the test suite
rlRun "rlFetchSrcForInstalled $PACKAGE" 0 "Fetching the source rpm"
rlRun "rpm --define '_topdir $TmpDir' -i *src.rpm" 0 "Installing the source rpm"
rlRun "mkdir BUILD" 0 "Creating BUILD directory"
rlRun "rpmbuild --nodeps --define '_topdir $TmpDir' -bp $TmpDir/SPECS/*spec" \
0 "Preparing sources"
rlRun "cd BUILD/vim*"
rlRun "chown -R $TESTER.$TESTER $TmpDir" 0 "Setting permissions"
rlRun "export LANG=en_US.UTF-8" 0 "Setting \$LANG to US locale"
# need to get ruby CFLAGS, because configure script fails otherwise - Vim configure script
# drags in ruby LDFLAGS, but not its CFLAGS
rlRun "RUBY_CFLAGS='`ruby -r rbconfig -e "puts RbConfig::CONFIG['CFLAGS']"`'" 0 "Get ruby CFLAGS"
rlRun "export CFLAGS='$RUBY_CFLAGS'" 0 "Set ruby CFLAGS"
# show relevant info & ENV variables
rlLog "TEST: $TEST"
rlLog "CONFOPT: $CONFOPT"
rlLog "TERM (default): $TERM"
rlLog "TERM (testing): $TERM_type"
rlRun -l "vim --version"
rlPhaseEnd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# untested properly - because it wasn't needed yet
[ "$SET_XVFB" = "YES" ] && {
rlPhaseStartSetup "Setup virtual framebuffer - Xvfb"
# alternative: 'xvfb-run -w 10 make TARGET'
# note: upstream CI test-run example: https://travis-ci.org/vim/vim/jobs/561452534
rlRun "Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &"
XVFB_PID=$!
sleep 10
rlRun "export DISPLAY=99.0"
rlRun "modinfo snd-dummy"
rlRun "modprobe snd-dummy"
rlRun "usermod -a -G audio $TESTER"
rlPhaseEnd
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rlPhaseStartTest Testing "Testing: make $TEST"
# important: beaker defaults to vt100, which is not enough for some tests!
rlRun "TERM=$TERM_type"
# following block of code is taken from upstream travis.yml
rlRun "su $TESTER -c './configure ${CONFOPT} CFLAGS=\"${CFLAGS} $RUBY_FLAGS\"'" 0 "Configure Vim"
rlRun "su $TESTER -c 'make'" 0 "Build the binary which we substitute"
rlRun "su $TESTER -c 'ln -sf /usr/bin/vim src/vim'" 0 "Create symlink to installed vim for testing"
rlRun "su $TESTER -c 'make ${TEST} |& tee output_main'" 0,2 "Run tests (skip builtin terminal errors)"
_res_=$?
# final checks
if grep -iq "No rule to make target.*${TEST}" output_main; then
rlLogError "This version of Vim doesn't include tests for target '$TEST'"
elif [ $_res_ -eq 0 ]; then
rlPass "Test run finished smoothly: no errors!"
rlIsRHEL '>7' && rlRun "grep 'ALL DONE' output_main"
else
rlFail "Something went wrong!"
fi
rlAssertNotGrep "TEST FAILURE" output_main
rlFileSubmit "output_main"
rlPhaseEnd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_Cleanup_Phase
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rlJournalPrintText
rlJournalEnd