From e45c099f06f3881030e2871900efd5c4e4d00e2b Mon Sep 17 00:00:00 2001 From: Sergey Turivniy Date: Mon, 15 Jan 2018 18:31:19 +0200 Subject: [PATCH] Add CI tests using the standard test interface --- .../Makefile | 64 ++++++++++++++++ .../PURPOSE | 6 ++ .../runtest.sh | 71 ++++++++++++++++++ tests/smoke-test/Makefile | 68 +++++++++++++++++ tests/smoke-test/PURPOSE | 3 + tests/smoke-test/make_check.out | 0 tests/smoke-test/runtest.sh | 74 +++++++++++++++++++ tests/tests.yml | 17 +++++ 8 files changed, 303 insertions(+) create mode 100644 tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/Makefile create mode 100644 tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/PURPOSE create mode 100755 tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/runtest.sh create mode 100644 tests/smoke-test/Makefile create mode 100644 tests/smoke-test/PURPOSE create mode 100644 tests/smoke-test/make_check.out create mode 100755 tests/smoke-test/runtest.sh create mode 100644 tests/tests.yml diff --git a/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/Makefile b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/Makefile new file mode 100644 index 0000000..afbd10f --- /dev/null +++ b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/PURPOSE b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/PURPOSE new file mode 100644 index 0000000..be241a2 --- /dev/null +++ b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/PURPOSE @@ -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 +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 diff --git a/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/runtest.sh b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/runtest.sh new file mode 100755 index 0000000..cc9df0d --- /dev/null +++ b/tests/libtasn1-doesn-t-handle-OIDs-which-have-elements/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/smoke-test/Makefile b/tests/smoke-test/Makefile new file mode 100644 index 0000000..aa7917f --- /dev/null +++ b/tests/smoke-test/Makefile @@ -0,0 +1,68 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libtasn1/Sanity/smoke-test +# Description: Test calls upstream test suite. +# Author: Ondrej Moris +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/smoke-test/PURPOSE b/tests/smoke-test/PURPOSE new file mode 100644 index 0000000..c3f5860 --- /dev/null +++ b/tests/smoke-test/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/libtasn1/Sanity/smoke-test +Description: Test calls upstream test suite. +Author: Ondrej Moris diff --git a/tests/smoke-test/make_check.out b/tests/smoke-test/make_check.out new file mode 100644 index 0000000..e69de29 diff --git a/tests/smoke-test/runtest.sh b/tests/smoke-test/runtest.sh new file mode 100755 index 0000000..4ef91cd --- /dev/null +++ b/tests/smoke-test/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..123c18e --- /dev/null +++ b/tests/tests.yml @@ -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