Add CI tests using the standard test interface

This commit is contained in:
Sergey Turivniy 2018-01-15 18:31:19 +02:00
parent 9bc81da661
commit e45c099f06
8 changed files with 303 additions and 0 deletions

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/libtasn1/Regression/libtasn1-doesn-t-handle-OIDs-which-have-elements
# Description: Test for libtasn1 doesn't handle OIDs which have elements
# Author: Hubert Kario <hkario@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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/libtasn1/Regression/libtasn1-doesn-t-handle-OIDs-which-have-elements
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: Hubert Kario <hkario@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for libtasn1 doesn't handle OIDs which have elements" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: libtasn1" >> $(METADATA)
@echo "Requires: libtasn1 libtasn1-tools openssl" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,6 @@
PURPOSE of /CoreOS/libtasn1/Regression/libtasn1-doesn-t-handle-OIDs-which-have-elements
Description: Test for libtasn1 doesn't handle OIDs which have elements
Author: Hubert Kario <hkario@redhat.com>
Bug summary: libtasn1 doesn't handle OIDs which have elements of size which exceed 32-bits
Test that libtasn1 does handle OIDs which have elements of size which exceed 32-bits

View File

@ -0,0 +1,71 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/libtasn1/Regression/libtasn1-doesn-t-handle-OIDs-which-have-elements
# Description: Test for libtasn1 doesn't handle OIDs which have elements
# Author: Hubert Kario <hkario@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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="libtasn1"
TOP_DIR="$(rpm --eval=%{_topdir})"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "echo 'PKIX1 { }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
Dss-Sig-Value ::= SEQUENCE {
r OBJECT IDENTIFIER,
s INTEGER
}
END' > pkix.asn"
rlRun "echo 'dp PKIX1.Dss-Sig-Value
r 1.3.6.1.4.1.2312.9.2.1461701120873.1.6
s 255' > assign.asn1"
rlPhaseEnd
rlPhaseStartTest
rlRun -s "asn1Coding pkix.asn assign.asn1"
rlAssertGrep "1.3.6.1.4.1.2312.9.2.1461701120873.1.6" $rlRun_LOG
rlRun "rm $rlRun_LOG"
rlRun -s "openssl asn1parse -in assign.out -inform DER"
rlAssertGrep "1.3.6.1.4.1.2312.9.2.1461701120873.1.6" $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

68
tests/smoke-test/Makefile Normal file
View File

@ -0,0 +1,68 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/libtasn1/Sanity/smoke-test
# Description: Test calls upstream test suite.
# 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/libtasn1/Sanity/smoke-test
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 calls upstream test suite." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: libtasn1" >> $(METADATA)
@echo "Requires: libtasn1" >> $(METADATA)
@echo "Requires: libtasn1-devel" >> $(METADATA)
@echo "Requires: valgrind" >> $(METADATA)
@echo "Requires: nfs-utils" >> $(METADATA)
@echo "Requires: rpm-build" >> $(METADATA)
@echo "Releases: -RHEL3 -RHEL4 -RHELServer5 -RHELClient5" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/smoke-test/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/libtasn1/Sanity/smoke-test
Description: Test calls upstream test suite.
Author: Ondrej Moris <omoris@redhat.com>

View File

74
tests/smoke-test/runtest.sh Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/libtasn1/Sanity/smoke-test
# Description: Test calls upstream test suite.
# 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="libtasn1"
PACKAGES=( "libtasn1" "valgrind" )
TOPDIR=`rpm --eval %_topdir`
rlJournalStart
rlPhaseStartSetup
for P in "${PACKAGES[@]}"; do rlAssertRpm $P || rlDie; done
rlFetchSrcForInstalled $PACKAGE
rlRun "dnf builddep -y libtasn1*.rpm"
rlRun "rpm -ihv `ls libtasn1*.rpm`" 0
rlRun "rpmbuild -vv -bc $TOPDIR/SPECS/libtasn1.spec" 0
rlPhaseEnd
rlPhaseStartTest
rlRun "make -C $TOPDIR/BUILD/libtasn1-* check > make_check.out" 0
cat make_check.out
if grep "All [0-9]\+ tests passed" make_check.out; then
rlPass "All tests passed -- have seen the old format of test summary in the output"
elif grep "Testsuite summary" make_check.out; then
TOTAL=`sed -rn 's/^# TOTAL: *([0-9]*).*/\1/p' make_check.out`
PASS=`sed -rn 's/^# PASS: *([0-9]*).*/\1/p' make_check.out`
rlAssertEquals "The number of tests that ran and passed should be equal" "$TOTAL" "$PASS"
else
rlFail "Tests reported summary in an unknown way"
rlBundleLogs make_check.out
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm libtasn1*.rpm -rf" 0
rlRun "rm $TOPDIR/BUILD/libtasn1-* -rf" 0
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

17
tests/tests.yml Normal file
View File

@ -0,0 +1,17 @@
---
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
tests:
- libtasn1-doesn-t-handle-OIDs-which-have-elements
required_packages:
- libtasn1
- libtasn1-devel
- libtasn1-tools
- openssl
- valgrind
- nfs-utils
- rpm-build