From a061c1d58dd94ced2f6833b27cb6933e4f14840a Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mar 05 2019 08:34:48 +0000 Subject: use the system patch to test the upstream test suites --- diff --git a/tests/README b/tests/README deleted file mode 100644 index 088f40c..0000000 --- a/tests/README +++ /dev/null @@ -1 +0,0 @@ -WORKING ON: Please don't migrate to dist-git diff --git a/tests/inventory b/tests/inventory deleted file mode 100644 index 6238138..0000000 --- a/tests/inventory +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -export TEST_DOCKER_EXTRA_ARGS="--security-opt seccomp:unconfined" -exec merge-standard-inventory "$@" diff --git a/tests/selftest/Makefile b/tests/selftest/Makefile deleted file mode 100644 index 6968848..0000000 --- a/tests/selftest/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/patch/Sanity/selftest -# Description: Executes upstream test suite -# Author: Miroslav Vadkerti -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 " > $(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) diff --git a/tests/selftest/PURPOSE b/tests/selftest/PURPOSE deleted file mode 100644 index 9d47bfd..0000000 --- a/tests/selftest/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/patch/Sanity/selftest -Description: Executes upstream test suite -Author: Miroslav Vadkerti diff --git a/tests/selftest/runtest.sh b/tests/selftest/runtest.sh deleted file mode 100755 index 1e8bb6d..0000000 --- a/tests/selftest/runtest.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/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 -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 diff --git a/tests/tests.yml b/tests/tests.yml index 204700a..14e25c9 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -1,14 +1,14 @@ --- -# This first play always runs on the local staging system +# Run tests in all contexts - hosts: localhost + tags: + - classic roles: - role: standard-test-beakerlib - tags: - - classic tests: - Cannot-handle-file-names-with-integrated-spaces - Regression-wrong-name-used-when-adding-new-file - - selftest + - upstream-test-suite required_packages: - patch - expect diff --git a/tests/upstream-test-suite/Makefile b/tests/upstream-test-suite/Makefile new file mode 100644 index 0000000..b986459 --- /dev/null +++ b/tests/upstream-test-suite/Makefile @@ -0,0 +1,65 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/patch/Sanity/upstream-test-suite +# Description: tests upstream test suite +# Author: Miroslav Vadkerti +# Author: Than Ngo +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 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/upstream-test-suite +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 " > $(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: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/upstream-test-suite/PURPOSE b/tests/upstream-test-suite/PURPOSE new file mode 100644 index 0000000..c32af1d --- /dev/null +++ b/tests/upstream-test-suite/PURPOSE @@ -0,0 +1,7 @@ +PURPOSE of /CoreOS/patch/Sanity/upstream-test-suite +Description: Tests upstream test suite +Author: Miroslav Vadkerti + +tests following scenarios: + * download source rpm and build + * use the system patch to run the upstream test suite diff --git a/tests/upstream-test-suite/runtest.sh b/tests/upstream-test-suite/runtest.sh new file mode 100755 index 0000000..fcec6c8 --- /dev/null +++ b/tests/upstream-test-suite/runtest.sh @@ -0,0 +1,77 @@ +#!/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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/" +PATCH=/usr/bin/patch + +rlJournalStart + rlPhaseStartSetup + for PKG in $PACKAGES; do + rlAssertRpm $PKG + done + rlPhaseEnd + + rlPhaseStartTest + rlAssertExists $PATCH + 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 "^FAIL:" $TESTLOG + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -rf $PACKAGE*.src.rpm" 0 "Removing source rpm" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd