#1 Add CI tests using the standard test interface
Closed 2 years ago by ignatenkobrain. Opened 2 years ago by sturivny.
git://fedorapeople.org/~sturivny/libxml2 new_tests  into  master

Add CI tests using the standard test interface
Serhii Turivny • 2 years ago  
tests/CPU-exhaustion/Makefile
file added
+62

@@ -0,0 +1,62 @@

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /tools/libxml2/Security/CPU-exhaustion

+ #   Description: CPU-exhaustion

+ #   Author: Martin Cermak <mcermak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2015 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/.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ export TEST=/tools/libxml2/Security/CPU-exhaustion

+ 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)

+ 	test -x runtest.sh || chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Martin Cermak <mcermak@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     CPU-exhaustion" >> $(METADATA)

+ 	@echo "Type:            Security" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          libxml2" >> $(METADATA)

+ 	@echo "Requires:        libxml2" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2+" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/CPU-exhaustion/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /tools/libxml2/Security/CPU-exhaustion

+ Description: CPU-exhaustion

+ Author: Martin Cermak <mcermak@redhat.com>

tests/CPU-exhaustion/runtest.sh
file added
+46

@@ -0,0 +1,46 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /tools/libxml2/Security/CPU-exhaustion

+ #   Description: CPU-exhaustion

+ #   Author: Martin Cermak <mcermak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2015 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/bin/rhts-environment.sh || exit 1

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ HASH='PCFET0NUWVBFIGZvbyBbPCFFTlRJVFkgZiAic29tZSBpbnRlem5hbCBkYXRhIj4KPCFFTl\

+ RJVFkgZSAiJmQ7Zjs8PyI+CjwhRU5USVRZIGQgInNhIC8mbHQ7PiZkOyZlOyI+Cl0+Cjxmb28+WG\

+ Q8TiB4bWw6aWQ9IjsmZDsmTQ=='

+ 

+ rlJournalStart

+     rlPhaseStartTest

+         XML=$(mktemp)

+         rlRun "rpm -qf `which xmllint`"

+         rlRun "echo $HASH | base64 --decode > $XML"

+         rlWatchdog "xmllint $XML >& /dev/null" 10 SIGKILL || \

+             rlFail "Internal kill"

+         rm $XML

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/XSD-parser-test/Makefile
file added
+63

@@ -0,0 +1,63 @@

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /CoreOS/libxml2/Sanity/XSD-parser-test

+ #   Description: Tests XSD parser

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2012 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/libxml2/Sanity/XSD-parser-test

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE testlimits.c

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	test -x runtest.sh || chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Michal Nowak <mnowak@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Tests XSD parser" >> $(METADATA)

+ 	@echo "Type:            Sanity" >> $(METADATA)

+ 	@echo "TestTime:        10m" >> $(METADATA)

+ 	@echo "RunFor:          libxml2" >> $(METADATA)

+ 	@echo "Requires:        libxml2 libxml2-devel" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/XSD-parser-test/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/libxml2/Sanity/XSD-parser-test

+ Description: Tests XSD parser

+ Author: Michal Nowak <mnowak@redhat.com>

tests/XSD-parser-test/runtest.sh
file added
+59

@@ -0,0 +1,59 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/libxml2/Sanity/XSD-parser-test

+ #   Description: Tests XSD parser

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2012 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 Beaker environment

+ . /usr/bin/rhts-environment.sh || exit 1

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="libxml2"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"

+ 	cp testlimits.c $TmpDir

+         rlRun "pushd $TmpDir"

+ 	rlRun "gcc -pedantic -W -Wall -Wextra -o testlimits testlimits.c -lpthread -lm -lz $( pkg-config --libs --cflags libxml-2.0 )" 0 "Compile testcase"

+ 	rlAssertExists "testlimits"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	rlLog "Test is running; please wait..."

+ 	rlWatchdog "./testlimits 2>&1 | tee -a out" 300

+ 	rlAssert0 "testlimits test case won't finish in time" $?

+ 	rlAssertGrep "no errors" out

+ 	rlLog "$( tail -n1 out )"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+ 	rlBundleLogs libxml2 out ./testlimits

+         rlRun "popd"

+         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

+     rlPhaseEnd

+     rlJournalPrintText

+ rlJournalEnd

tests/XSD-parser-test/testlimits.c
file added
+1649
The added file is too large to be shown here, see it at: tests/XSD-parser-test/testlimits.c
tests/out-of-bounds-memory-access/Makefile
file added
+63

@@ -0,0 +1,63 @@

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /tools/libxml2/Security/out-of-bounds-memory-access

+ #   Description: out-of-bounds-memory-access

+ #   Author: Martin Cermak <mcermak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2015 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/.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ export TEST=/tools/libxml2/Security/out-of-bounds-memory-access

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile PURPOSE libxml2_oob.xml

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	test -x runtest.sh || chmod a+x runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Martin Cermak <mcermak@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     out-of-bounds-memory-access" >> $(METADATA)

+ 	@echo "Type:            Security" >> $(METADATA)

+ 	@echo "TestTime:        5m" >> $(METADATA)

+ 	@echo "RunFor:          libxml2" >> $(METADATA)

+ 	@echo "Requires:        libxml2" >> $(METADATA)

+ 	@echo "Requires:        valgrind" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2+" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/out-of-bounds-memory-access/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /tools/libxml2/Security/out-of-bounds-memory-access

+ Description: out-of-bounds-memory-access

+ Author: Martin Cermak <mcermak@redhat.com>

tests/out-of-bounds-memory-access/libxml2_oob.xml
file added
+3

@@ -0,0 +1,3 @@

+ <!DOCTYPEd[<!ENTITY

+ S	""><!ENTITY %

+ N	"<!ELEMENT<![INCLUDE0"<!ENTITYL%N; 

\ No newline at end of file

tests/out-of-bounds-memory-access/runtest.sh
file added
+54

@@ -0,0 +1,54 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /tools/libxml2/Security/out-of-bounds-memory-access

+ #   Description: out-of-bounds-memory-access

+ #   Author: Martin Cermak <mcermak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2015 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/bin/rhts-environment.sh || exit 1

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="libxml2"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlRun "TMP=$(mktemp -d)"

+         rlRun "cp libxml2_oob.xml $TMP/"

+         rlRun "pushd $TMP"

+         for b in valgrind xmllint; do

+             rlRun "rpm -qf $(which $b)"

+         done

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         rlRun "valgrind xmllint libxml2_oob.xml |& tee output.log"

+         rlRun "grep '== ERROR SUMMARY: 0 errors' output.log"

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlRun "popd"

+         rlRun "rm -r $TMP"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

tests/python-tests/Makefile
file added
+64

@@ -0,0 +1,64 @@

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Makefile of /CoreOS/libxml2/Sanity/python-tests

+ #   Description: Runs python regression tests

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2011 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/libxml2/Sanity/python-tests

+ 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:           Michal Nowak <mnowak@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     Runs python regression tests" >> $(METADATA)

+ 	@echo "Type:            Sanity" >> $(METADATA)

+ 	@echo "TestTime:        30m" >> $(METADATA)

+ 	@echo "RunFor:          libxml2" >> $(METADATA)

+ 	@echo "Requires:        libxml2 libxml2-devel python-devel rpm-build" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv2" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 	@echo "Architectures:   ia64 x86_64 s390 s390x i386" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

tests/python-tests/PURPOSE
file added
+3

@@ -0,0 +1,3 @@

+ PURPOSE of /CoreOS/libxml2/Sanity/python-tests

+ Description: Runs python regression tests

+ Author: Michal Nowak <mnowak@redhat.com>

tests/python-tests/runtest.sh
file added
+88

@@ -0,0 +1,88 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /CoreOS/libxml2/Sanity/python-tests

+ #   Description: Runs python regression tests

+ #   Author: Michal Nowak <mnowak@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2011 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 Beaker environment

+ . /usr/bin/rhts-environment.sh || exit 1

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="libxml2"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"

+ 	cp *.gold $TmpDir

+         rlRun "pushd $TmpDir"

+ 

+ 	specdir="$(rpm --eval '%{_specdir}')"

+ 	builddir="$(rpm --eval '%{_builddir}')"

+ 	rlFetchSrcForInstalled ${PACKAGE}

+ 	yum-builddep -y *.src.rpm

+ 	rpm -ivh *.src.rpm

+ 	rlRun "rpmbuild -bp ${specdir}/libxml2.spec" 0 "Prepare libxml2 sources"

+ 	libxmlpath="$(find ${builddir}/libxml2-* -maxdepth 0)"

+         if rlIsRHEL 5 || rlIsRHEL 6; then

+             cat > ${libxmlpath}/uninitialized-var-c966790781a9ab5d80aed1246df6316149ef5f07.patch <<_END_

+ --- runtest.c	2009-09-24 17:32:00.000000000 +0200

+ +++ runtest.c.new	2010-07-07 09:03:19.273338594 +0200

+ @@ -3165,7 +3165,7 @@ rngTest(const char *filename,

+      const char *instance;

+      xmlRelaxNGParserCtxtPtr ctxt;

+      xmlRelaxNGPtr schemas;

+ -    int res = 0, len, ret;

+ +    int res = 0, len, ret = 0;

+      char pattern[500];

+      char prefix[500];

+      char result[500];

+ _END_

+             rlAssertExists ${libxmlpath}/uninitialized-var-c966790781a9ab5d80aed1246df6316149ef5f07.patch

+             pushd ${builddir}/libxml2-*

+             rlRun "patch -p0 < ./uninitialized-var-c966790781a9ab5d80aed1246df6316149ef5f07.patch" 0 "Patch with uninitialized-var.patch"

+             popd

+         fi

+ 	rlRun "rpmbuild -bc --short-circuit ${specdir}/libxml2.spec" 0 "Build libxml2"

+         pushd ${builddir}/libxml2-*/python/tests/

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+ 	make MAKEFLAGS+=--silent tests | tee python-tests.out

+ 	if [ "$( cat python-tests.out | grep -- '--' )" ]; then

+ 		rlFail "Python tests failed"

+ 	else

+ 		rlPass "Python tests passed"

+ 	fi

+     rlPhaseEnd

+ 

+     rlPhaseStartCleanup

+         rlBundleLogs python-tests python-tests.out

+         popd

+         rlRun "popd"

+         rlRun "rm -r $TmpDir ${builddir}/libxml2-*" 0 "Removing tmp and libxml2 directories"

+     rlPhaseEnd

+     rlJournalPrintText

+ rlJournalEnd

tests/tests.yml
file added
+36

@@ -0,0 +1,36 @@

+ ---

+ # Tests that run in classic context

+ - hosts: localhost

+   roles:

+   - role: standard-test-beakerlib

+     tags:

+     - classic

+     - container

+     tests:

+     - CPU-exhaustion

+     - out-of-bounds-memory-access

+     - python-tests

+     - XSD-parser-test

+     required_packages:

+     - libxml2

+     - libxml2-devel

+     - findutils         # beakerlib needs find command

+     - gcc               # XSD-parser-test needs this package

+     - make              # python-tests needs this package

+     - python-devel      # python-tests needs this package

+     - python3-devel     # python-tests needs this package

+     - rpm-build         # python-tests needs this package

+     - valgrind          # out-of-bounds-memory-access needs this package

+     - wget              # python-tests needs this package

+     - which

+ 

+ # Tests that run in container context

+ - hosts: localhost

+   roles:

+   - role: standard-test-beakerlib

+     tags:

+     - atomic

+     tests:

+     - CPU-exhaustion

+     required_packages:

+     - findutils         # beakerlib needs find command

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

Run tests for Classic

$ export TEST_SUBJECTS=
$ sudo ansible-playbook --tags classic tests.yml

Snip of the example test run for Classic tests:

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

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

PASS CPU-exhaustion
PASS out-of-bounds-memory-access
PASS python-tests
PASS XSD-parser-test
PASS CPU-exhaustion

Run tests for Container

$ export TEST_SUBJECTS=docker:docker.io/library/fedora:26
$ sudo ansible-playbook --tags=container tests.yml

Snip of the example test run for Container tests:

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
ok: [665da4f67399fe45d962739f6631b26296b4095adca38019f7beb99b97c57e58]

PLAY RECAP **********************************************************************************************************************************************************************************************************
665da4f67399fe45d962739f6631b26296b4095adca38019f7beb99b97c57e58 : ok=16   changed=11   unreachable=0    failed=0   

PASS CPU-exhaustion
PASS out-of-bounds-memory-access
PASS python-tests
PASS XSD-parser-test

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 on 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: skolosov @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 closed by ignatenkobrain

2 years ago