#1 Add CI tests using the standard test interface
Merged 6 years ago by twaugh. Opened 6 years ago by sturivny.
git://fedorapeople.org/~sturivny/patch add-tests  into  master

Add CI tests using the standard test interface
Serhii Turivnyi • 6 years ago  
tests/Cannot-handle-file-names-with-integrated-spaces/Makefile
file added
+65
@@ -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)

tests/Cannot-handle-file-names-with-integrated-spaces/PURPOSE
file added
+27
@@ -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!

tests/Cannot-handle-file-names-with-integrated-spaces/runtest.sh
file added
+76
@@ -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

tests/README
file added
+1
@@ -0,0 +1,1 @@

+ WORKING ON: Please don't migrate to dist-git

tests/Regression-wrong-name-used-when-adding-new-file/Makefile
file added
+63
@@ -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)

tests/Regression-wrong-name-used-when-adding-new-file/PURPOSE
file added
+55
@@ -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

tests/Regression-wrong-name-used-when-adding-new-file/runtest.sh
file added
+57
@@ -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

tests/inventory
file added
+3
@@ -0,0 +1,3 @@

+ #!/bin/bash

+ export TEST_DOCKER_EXTRA_ARGS="--security-opt seccomp:unconfined"

+ exec merge-standard-inventory "$@"

tests/selftest/Makefile
file added
+64
@@ -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)

tests/selftest/PURPOSE
file added
+3
@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/patch/Sanity/selftest

+ Description: Executes upstream test suite

+ Author: Miroslav Vadkerti <mvadkert@redhat.com>

tests/selftest/runtest.sh
file added
+75
@@ -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

tests/tests.yml
file added
+21
@@ -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

no initial comment

Justification

Adds tests according to the CI wiki specifically the standard test interface in the spec.

The playbook includes Tier1 level test cases that have been tested in the following contexts and is passing reliably: Classic and Container. Test logs are stored in the artifacts directory.

The following steps are used to execute the tests using the standard test interface:


Test enveronment

Make sure you have installed packages from the spec

$ rpm -q ansible python2-dnf libselinux-python standard-test-roles
ansible-2.3.2.0-1.fc26.noarch
python2-dnf-2.6.3-11.fc26.noarch
libselinux-python-2.6-7.fc26.x86_64
standard-test-roles-2.4-1.fc26.noarch



Clone tests to you PC

$ git clone git://fedorapeople.org/~sturivny/patch
$ cd patch/



Run tests for Classic

All test should be run under the root

#cd tests/patch/
# sudo ansible-playbook --tags=classic tests.yml

Snip of the example test run:

TASK [standard-test-beakerlib : Copy tests to target] **********************************************************************************************************
changed: [localhost]

TASK [standard-test-beakerlib : Fix up beakerlib] **************************************************************************************************************
changed: [localhost]

TASK [standard-test-beakerlib : Make artifacts directory] ******************************************************************************************************
changed: [localhost]

TASK [standard-test-beakerlib : Execute beakerlib tests] *******************************************************************************************************
changed: [localhost] => (item=Cannot-handle-file-names-with-integrated-spaces)
changed: [localhost] => (item=Regression-wrong-name-used-when-adding-new-file)
changed: [localhost] => (item=selftest)

TASK [standard-test-beakerlib : Make the master test summary log artifact] *************************************************************************************
changed: [localhost] => (item=Cannot-handle-file-names-with-integrated-spaces)
changed: [localhost] => (item=Regression-wrong-name-used-when-adding-new-file)
changed: [localhost] => (item=selftest)

TASK [standard-test-beakerlib : Pull out the logs] *************************************************************************************************************
changed: [localhost]

TASK [standard-test-beakerlib : Check the results] *************************************************************************************************************
changed: [localhost]

PLAY RECAP *****************************************************************************************************************************************************
localhost                  : ok=18   changed=11   unreachable=0    failed=0   



Notes

Tests will be enabled in CI, yet gating is currently disabled, so nothing will change. Tests will run on each dist-git commit, they are not triggered by koji builds and if you are using FMN, it should notify you of failures normally.

The RH QE maintainer contact in case you have questions: Ondrej Moris omoris @redhat.com
The idea is that these tests become yours just as you're maintaining the package, there will, of course, be people around if you have questions or troubles.

Pull-Request has been merged by twaugh

6 years ago