#8 Add upstream testsuite as a gating test
Opened 2 years ago by jcheca. Modified 2 years ago
rpms/ jcheca/strace rawhide  into  rawhide

file added
+1
@@ -0,0 +1,1 @@ 

+ 1

file added
+17
@@ -0,0 +1,17 @@ 

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_stable

+ subject_type: koji_build

+ --- !Policy

+ product_versions:

+   - rhel-8

+ decision_context: osci_compose_gate

+ rules:

+   - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

+ --- !Policy

+ product_versions:

+   - rhel-9

+ decision_context: osci_compose_gate

+ rules:

+   - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

file added
+6
@@ -0,0 +1,6 @@ 

+ summary: CI Gating Plan

+ discover:

+     how: fmf

+     directory: tests

+ execute:

+     how: beakerlib

@@ -0,0 +1,67 @@ 

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

+ #

+ #   Makefile of /tools/strace/Sanity/internal-tests

+ #   Description: internal-tests

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

+ #

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

+ #

+ #   Copyright (c) 2016 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/strace/Sanity/internal-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)

+ 	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:     internal-tests" >> $(METADATA)

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

+ 	@echo "TestTime:        3h" >> $(METADATA)

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

+ 	@echo "Requires:        strace libacl-devel time libaio-devel libgcc glibc-devel gcc-c++ libstdc++ libstdc++-devel dejagnu elfutils-devel gettext" >> $(METADATA)

+ 	@echo "Requires:        glibc-devel.i686 libgcc.i686" >> $(METADATA)

+ 	@echo "Requires:        binutils-devel bluez-libs-devel" >> $(METADATA)

+ 	@echo "Requires:        rpm-build yum-utils" >> $(METADATA)

+ 	@echo "Requires:        bzip2-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)

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

+ PURPOSE of /tools/strace/Sanity/internal-tests

+ Description: internal-tests

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

@@ -0,0 +1,32 @@ 

+ summary: internal-tests

+ description:

+   'Runs the upstream testsuite in the CI environment with regular user'

+ contact: Jesus Checa <jcheca@redhat.com>

+ component:

+   - strace

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+   - strace

+   - libacl-devel

+   - time

+   - libaio-devel

+   - libgcc

+   - glibc-devel

+   - gcc-c++

+   - libstdc++

+   - libstdc++-devel

+   - dejagnu

+   - elfutils-devel

+   - gettext

+   - glibc-devel.i686

+   - libgcc.i686

+   - binutils-devel

+   - bluez-libs-devel

+   - rpm-build

+   - yum-utils

+   - bzip2-devel

+   - make

+ duration: 3h

+ extra-summary: /tools/strace/Sanity/internal-tests

+ extra-task: /tools/strace/Sanity/internal-tests

@@ -0,0 +1,155 @@ 

+ #!/bin/bash

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

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

+ #

+ #   runtest.sh of /tools/strace/Sanity/internal-tests

+ #   Description: internal-tests

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

+ #

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

+ #

+ #   Copyright (c) 2016 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/share/beakerlib/beakerlib.sh || exit 1

+ 

+ CMD=strace

+ BIN=$(which $CMD)

+ PACKAGE_FULL_NAME="$(rpm -qf $BIN)"

+ PACKAGE="$(rpm -q --queryformat '%{name}' $PACKAGE_FULL_NAME)"

+ 

+ GCC=${GCC:-gcc}

+ GCC_BIN=$(which $GCC)

+ GCC_PACKAGE=$(rpm -qf $GCC_BIN)

+ 

+ # In case of known broken dependencies or additional repos needed, use YUM_SWITCHES

+ # E.g.: on rhel-8 and rhel-9, it requires CRB repo enabled

+ # YUM_SWITCHES="${YUM_SWITCHES:- --enablerepo=\*}"

+ 

+ # If defined, INTERNAL_TESTS is a list of testcases that should be executed

+ #INTERNAL_TESTS="delay count"

+ 

+ rlJournalStart

+     rlPhaseStartSetup

+         rlAssertRpm $PACKAGE

+         rlAssertRpm $GCC_PACKAGE

+         rlRun "NVR=$(rpm -q --qf='%{NAME}-%{VERSION}-%{RELEASE}' $PACKAGE)"

+         rlRun "TMP=`mktemp -d`"

+         rlRun "pushd $TMP"

+ 

+         # Install stuff to have more fun with the compat arch tests

+         rlRun "ADDITIONAL_PACKAGES='libstdc++ dejagnu elfutils-devel gettext \

+             libgcc glibc-devel gcc-c++ libstdc++-devel yum-utils rpm-build'"

+ 

+         rlRun "yum -y install --setopt=multilib_policy=all --skip-broken $ADDITIONAL_PACKAGES $YUM_SWITCHES"

+ 

+         # Do not run rpmbuild in /tmp as the testsuite needs lots of space

+         rlRun "RPMBUILD_DIR=$(mktemp -d /home/rpmbuildXXXXX)"

+ 

+         set -x

+         dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || \

+             cp /var/share/test-artifacts/$NVR.src.rpm . || \

+             rlFetchSrcForInstalled ${CMD}

+         set +x

+ 

+         rlRun "yum-builddep -y $NVR.src.rpm $YUM_SWITCHES"

+         rlRun "rpm --define='_topdir $RPMBUILD_DIR' -Uvh $NVR.src.rpm"

+ 

+ 

+         rlRun "pushd $RPMBUILD_DIR"

+         rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define '_topdir $RPMBUILD_DIR' -bc SPECS/${CMD}.spec"

+         rlRun "cd BUILD/strace-*"

+         rlRun "chmod u+x tests/*.test tests-m32/*.test tests-mx32/*.test" #from rhel-7.8 strace.spec

+ 

+         rlRun "useradd temp_user" 0,9

+         rlRun "chown -R temp_user:temp_user $RPMBUILD_DIR"

+     rlPhaseEnd

+ 

+     rlPhaseStartTest

+         # Increase TIMEOUT_DURATION (default value is 600)

+         rlRun "export TIMEOUT_DURATION=${TIMEOUT_DURATION:-1500}"

+         # Conditionally disable the compat arch tests (bypassing autotools)

+         if [ "$(uname -m)" != "x86_64" ]; then

+             rlRun "tests_dir='tests'"

+             rlRun "sed -i 's/^TESTS_M32\ =/#\0/' Makefile"

+         else

+             rlRun "tests_dir='tests tests-m32'"

+             if rlIsFedora; then

+                 # Fedora always set -m64 flag. Remove it from tests-m32

+                 # or it will cause linkage errors.

+                 rlRun "sed -i 's/-m64//g' tests-m32/Makefile"

+             fi

+         fi

+         rlRun "set -o pipefail"

+         # Run 'make -k check' (in order to run tests and tests-m32 when available) as ordinary user

+         rlRun -c "su -c 'make -j2 -k check VERBOSE=1 STRACE=$BIN TIMEOUT_DURATION=$TIMEOUT_DURATION ${INTERNAL_TESTS:+TESTS=$INTERNAL_TESTS}' temp_user |& tee make_check.out"

+ 

+         # Print summary from 'make check' output, since test-suite.log might be missing

+         rlLogInfo "========================================"

+         rlLogInfo "Summary of 'make check' failures:"

+         if grep -q '^FAIL:' make_check.out; then

+             grep -e 'Making check in tests' -e '^FAIL.*\.test$' make_check.out | while read line; do

+                 if grep -q '^FAIL:' <<< $line; then

+                     rlFail "$line"

+                 else

+                     rlLogInfo "$line"

+                 fi

+             done

+         else

+             rlPass "(No FAIL found)"

+         fi

+         rlLogInfo "========================================"

+ 

+         rlFileSubmit make_check.out "${PACKAGE_FULL_NAME}_make_check.out"

+     rlPhaseEnd

+ 

+ for dir in $tests_dir; do

+     rlPhaseStartTest "Evaluate $dir results"

+         if rlAssertExists ${dir}/test-suite.log; then

+             rlLogInfo "========================================"

+             rlLogInfo "Summary of $dir failures:"

+             if grep -q '^FAIL:' ${dir}/test-suite.log; then

+                 grep '^FAIL:' ${dir}/test-suite.log | while read f; do

+                     rlFail "$f"

+                 done

+             else

+                 rlPass "(No FAIL found)"

+             fi

+             rlLogInfo "========================================"

+             rlFileSubmit ${dir}/test-suite.log "${PACKAGE_FULL_NAME}_${dir}.log"

+         else

+             rlRun "tar czvf ${dir}-logs.tar.gz ${dir}/*.log"

+             rlFileSubmit ${dir}-logs.tar.gz "${PACKAGE_FULL_NAME}_${dir}-logs.tar.gz"

+         fi

+     rlPhaseEnd

+ done

+ 

+     rlPhaseStartCleanup

+         bash

+         # if BUILD_PACKAGE was installed by the testcase, it should be removed

+         # to avoid conflicts with other rpmbuilds

+         if [ "$BUILD_PACKAGE" ]; then

+             rlRun "yum remove -y $BUILD_PACKAGE"

+         fi

+ 

+         rlRun "userdel -r temp_user" 0,8

+         rlRun "popd; popd"

+         rlRun "rm -r $TMP"

+     rlPhaseEnd

+ rlJournalPrintText

+ rlJournalEnd

This pull request adds the upstream testsuite as gating test. The testsuite is run by a regular user (non-root) using the strace installed from the RPM package.

Build succeeded.

rebased onto 317232a

2 years ago

rebased onto ca6afb8

2 years ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

rebased onto 0508e7f

2 years ago

Build succeeded.