Add CI tests using the standard test interface

This commit is contained in:
Serhii Turivnyi 2017-12-13 12:27:07 +02:00
parent f3df496daa
commit e0e2de73c3
12 changed files with 510 additions and 0 deletions

View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/patch/Regression/Cannot-handle-file-names-with-integrated-spaces
# Description: Test for bz431887 (Cannot handle file names with integrated spaces)
# Author: Ondrej Moris <omoris@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/patch/Regression/Cannot-handle-file-names-with-integrated-spaces
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Ondrej Moris <omoris@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for bz431887 (Cannot handle file names with integrated spaces)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: patch" >> $(METADATA)
@echo "Requires: patch" >> $(METADATA)
@echo "Requires: expect" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 431887" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,27 @@
PURPOSE of /CoreOS/patch/Regression/Cannot-handle-file-names-with-integrated-spaces
Description: Test for bz431887 (Cannot handle file names with integrated spaces)
Author: Ondrej Moris <omoris@redhat.com>
Bug summary: Cannot handle file names with integrated spaces
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=431887
Description:
Description of problem:
If the file name for the file to be patched in a patch file has spaces, it
cannot be handled by patch.
Version-Release number of selected component (if applicable):
patch-2.5.4-29.2.2
How reproducible:
create a patch of a file with spaces in path
try to apply the patch
Actual results:
patch asks for the file name to patch
Expected results:
Just the patched file
Additional info:
Note that this bug is fixed upstream on 2003-05-18!

View File

@ -0,0 +1,76 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/patch/Regression/Cannot-handle-file-names-with-integrated-spaces
# Description: Test for bz431887 (Cannot handle file names with integrated spaces)
# Author: Ondrej Moris <omoris@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="patch"
function apply_patch {
expect <<EOF
set timeout 5
spawn patch -i spaces.patch
expect "patching file 'f i r s t'" { expect timeout ; exit 0 }
exit 1
EOF
return $?
}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
rlRun "echo \"1\" > \"f i r s t\"" 0
rlRun "echo \"2\" > \"s e c o n d\"" 0
rlAssertExists "f i r s t"
rlAssertExists "s e c o n d"
rlAssertDiffer "f i r s t" "s e c o n d"
rlRun "diff -u f\ i\ r\ s\ t s\ e\ c\ o\ n\ d > spaces.patch" 1
rlRun "apply_patch" 0 "Patching file with spaces in its name"
rlAssertExists "f i r s t"
rlAssertExists "s e c o n d"
rlAssertNotDiffer "f i r s t" "s e c o n d"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -f f\ i\ r\ s\ t s\ e\ c\ o\ n\ d spaces.patch"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

1
tests/README Normal file
View File

@ -0,0 +1 @@
WORKING ON: Please don't migrate to dist-git

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/patch/Regression/Regression-wrong-name-used-when-adding-new-file
# Description: Test for Regression: wrong name used when adding new file
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/patch/Regression/Regression-wrong-name-used-when-adding-new-file
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Karel Srot <ksrot@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for Regression: wrong name used when adding new file" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: patch" >> $(METADATA)
@echo "Requires: patch" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,55 @@
PURPOSE of /CoreOS/patch/Regression/Regression-wrong-name-used-when-adding-new-file
Description: Test for Regression: wrong name used when adding new file
Author: Karel Srot <ksrot@redhat.com>
Bug summary: Regression: wrong name used when adding new file
Description:
+++ This bug was initially created as a clone of Bug #549122 +++
Description of problem:
Regression: Suffix inside of new files of patch files are added to new files.
Take http://cvs.fedoraproject.org/viewvc/devel/popt/popt-1.13-multilib.patch
for example for reproducing:
With patch-2.6-1, "%patch0 -p1 -b .multilib" causes:
-rw-r--r-- 1 tux tux 256 Dec 20 15:26 footer_no_timestamp.html.multilib
-rw-r--r-- 1 tux tux 0 Dec 20 15:26 footer_no_timestamp.html.multilib.multilib
-rw-r--r-- 1 tux tux 51543 Dec 20 15:26 Doxyfile.in
-rw-r--r-- 1 tux tux 51519 May 25 2007 Doxyfile.in.multilib
With patch-2.5.4-36, "%patch0 -p1 -b .multilib" causes:
-rw-r--r-- 1 tux tux 256 Dec 20 15:32 footer_no_timestamp.html
---------- 1 tux tux 0 Dec 20 15:32 footer_no_timestamp.html.multilib
-rw-r--r-- 1 tux tux 51543 Dec 20 15:32 Doxyfile.in
-rw-r--r-- 1 tux tux 51519 May 25 2007 Doxyfile.in.multilib
You see what I mean? If the file is created by the patch file, the suffix
inside of the patch is appended to the new created file. That behaviour has
been introduced with the new version and it looks like a regression to me.
Version-Release number of selected component (if applicable):
patch-2.6-1
patch-2.5.4-36
How reproducible:
Everytime, see above.
Actual results:
Regression: Suffixes inside of patches at new files are added to new files
Expected results:
Good old behaviour like at patch-2.5.4-36.
--- Additional comment from twaugh@redhat.com on 2009-12-21 05:17:27 EDT ---
Verified.
Affects F-12 and F-11 as well.
--- Additional comment from twaugh@redhat.com on 2009-12-21 11:44:02 EDT ---
Reported upstream:
https://savannah.gnu.org/bugs/index.php?28367

View File

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/patch/Regression/Regression-wrong-name-used-when-adding-new-file
# Description: Test for Regression: wrong name used when adding new file
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="patch"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "mkdir a b && touch a/file && echo content > b/file.new" 0 "Preparing test environment"
rlRun "diff -u a/file b/file.new > test.patch" 1 "Preparing a patch"
rlPhaseEnd
rlPhaseStartTest
rlRun "patch -p1 -b -z .backup -i test.patch" 0 "Patching the test file"
rlAssertExists file
rlAssertExists file.backup
rlAssertNotExists file.new
rlAssertNotExists file.new.backup
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

3
tests/inventory Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
export TEST_DOCKER_EXTRA_ARGS="--security-opt seccomp:unconfined"
exec merge-standard-inventory "$@"

64
tests/selftest/Makefile Normal file
View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/patch/Sanity/selftest
# Description: Executes upstream test suite
# Author: Miroslav Vadkerti <mvadkert@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/patch/Sanity/selftest
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Miroslav Vadkerti <mvadkert@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Executes upstream test suite" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 30m" >> $(METADATA)
@echo "RunFor: patch" >> $(METADATA)
@echo "Requires: patch gcc rpm-build automake libselinux-devel ed libattr-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL3 -RHEL4 -RHELServer5 -RHELClient5" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/selftest/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/patch/Sanity/selftest
Description: Executes upstream test suite
Author: Miroslav Vadkerti <mvadkert@redhat.com>

75
tests/selftest/runtest.sh Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/patch/Sanity/selftest
# Description: Executes the upstream test suite comming with the package
# Author: Miroslav Vadkerti <mvadkert@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# 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 version 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="patch"
PACKAGES="patch gcc rpm-build automake libselinux-devel"
UPSTREAMPKG="patch-*"
BUILDLOG=`mktemp`
TESTLOG=`mktemp`
TARGET=$(echo `uname -m` | egrep ppc)
if [[ $TARGET != "" ]]; then TARGET="--target `uname -m`"; fi
TOPDIR=`mktemp -d`
SPEC="$TOPDIR/SPECS/$PACKAGE*.spec"
TESTDIR="$TOPDIR/BUILD/$UPSTREAMPKG/"
rlJournalStart
rlPhaseStartSetup
for PKG in $PACKAGES; do
rlAssertRpm $PKG
done
rlPhaseEnd
rlPhaseStartTest
rlFetchSrcForInstalled $PACKAGE
rlRun "rpm -ivh --define '_topdir $TOPDIR' $PACKAGE*.src.rpm" 0 "Installing $PACKAGE src rpm"
echo "+ Building $PACKAGE (Log: $BUILDLOG)"
echo "+ Build command: rpmbuild -bc $SPEC $TARGET"
rlRun "rpmbuild --define '_topdir $TOPDIR' -bc $SPEC $TARGET &> $BUILDLOG"
echo "+ Buildlog:"
tail -n 100 $BUILDLOG
rlRun "pushd ."
rlRun "cd $TESTDIR"
rlRun "make check &> $TESTLOG"
cat $TESTLOG
if rlIsRHEL 6; then
rlAssertGrep 'All tests succeeded!' $TESTLOG
else
rlAssertNotGrep "FAILED" $TESTLOG
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -rf $PACKAGE*.src.rpm" 0 "Removing source rpm"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

21
tests/tests.yml Normal file
View File

@ -0,0 +1,21 @@
---
# This first play always runs on the local staging system
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- Cannot-handle-file-names-with-integrated-spaces
- Regression-wrong-name-used-when-adding-new-file
- selftest
required_packages:
- patch
- expect
- gcc
- rpm-build
- automake
- libselinux-devel
- ed
- libattr-devel
- wget