diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..84b7773 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,20 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: baseos-qe.koji-build.scratch-build.validation} +--- !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} diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..1ad2c12 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,6 @@ +summary: CI Gating Plan +discover: + how: fmf + directory: tests +execute: + how: beakerlib diff --git a/tests/Regression/internal-tests/Makefile b/tests/Regression/internal-tests/Makefile new file mode 100644 index 0000000..fb7eeae --- /dev/null +++ b/tests/Regression/internal-tests/Makefile @@ -0,0 +1,68 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/chrpath/Regression/internal-tests +# Description: internal-tests +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/chrpath/Regression/internal-tests +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE testsuite.patch + +.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 " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: internal-tests" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 30m" >> $(METADATA) + @echo "RunFor: chrpath" >> $(METADATA) + @echo "Requires: chrpath" >> $(METADATA) + @echo "Requires: rpm-build" >> $(METADATA) + @echo "Requires: gcc libgcc glibc-devel" >> $(METADATA) + @echo "Requires: libgcc.i686 glibc-devel.i686" >> $(METADATA) + @echo "Requires: libgcc.s390 glibc-devel.s390" >> $(METADATA) + @echo "Requires: libgcc.ppc glibc-devel.ppc" >> $(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/Regression/internal-tests/PURPOSE b/tests/Regression/internal-tests/PURPOSE new file mode 100644 index 0000000..1641ce4 --- /dev/null +++ b/tests/Regression/internal-tests/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/chrpath/Regression/internal-tests +Description: internal-tests +Author: Martin Cermak diff --git a/tests/Regression/internal-tests/main.fmf b/tests/Regression/internal-tests/main.fmf new file mode 100644 index 0000000..fd8598b --- /dev/null +++ b/tests/Regression/internal-tests/main.fmf @@ -0,0 +1,22 @@ +summary: internal-tests +description: '' +contact: Martin Cermak +component: +- chrpath +test: ./runtest.sh +framework: beakerlib +recommend: +- chrpath +- rpm-build +- gcc +- libgcc +- glibc-devel +- libgcc.i686 +- glibc-devel.i686 +- libgcc.s390 +- glibc-devel.s390 +- libgcc.ppc +- glibc-devel.ppc +duration: 30m +extra-summary: /tools/chrpath/Regression/internal-tests +extra-task: /tools/chrpath/Regression/internal-tests diff --git a/tests/Regression/internal-tests/runtest.sh b/tests/Regression/internal-tests/runtest.sh new file mode 100755 index 0000000..d4b3cc1 --- /dev/null +++ b/tests/Regression/internal-tests/runtest.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/chrpath/Regression/internal-tests +# Description: internal-tests +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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='chrpath' +BIN=$(which --skip-alias $CMD) +PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" +export PACKAGE + +ORIGWD=$(pwd) + +# To test the compat arch stuff, we need the compat arch compiler capability. +# Ideally the test harness should install it, since respective 32/31 bit runtime +# requirements (libgcc, glibc-devel) are mentioned as requirements in the Makefile +# but just in case that would fail, we'll try to fix this now at the test run time. +if arch | egrep -q '(x86_64|ppc64|s390x)'; then + b='-m32' + arch | grep s390x && b='-m31' + echo "int main() { return 0; }" | gcc -m32 -xc -o /dev/null - || \ + yum -y install --setopt=multilib_policy=all libgcc glibc-devel +fi + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPD=$(mktemp -d)" + rlRun "pushd $TMPD" + rlFetchSrcForInstalled $PACKAGE + rlRun "rpm --define='_topdir $TMPD' -Uvh *src.rpm" + rlRun "rpmbuild --define='_topdir $TMPD' -bc SPECS/${CMD}.spec" + rlPhaseEnd + + rlPhaseStartTest + rlRun "pushd BUILD/$CMD-*" + # Some CI systems complain about "C compiler cannot create executables" + # Not really sure what's going on there, thus printing the config.log: + rlRun "cat config.log" + # To run the testsuite for compat arch, we need to patch the testsuite + # per https://bugzilla.redhat.com/show_bug.cgi?id=1271380#c25. But just + # in case the patch wouldn't apply, we'll first run the unpatched tests + # so that we have at least some results and then try to patch and rerun. + rlRun "make check" + RUN_SEC_ARCH="false" + RHEL_VERSION=$(rpm --eval %{rhel}) + [[ $RHEL_VERSION -ge 7 ]] && arch | egrep -q '(x86_64|ppc64)' && RUN_SEC_ARCH="true" + [[ $RHEL_VERSION -eq 7 ]] && arch | egrep -q '(s390x)' && RUN_SEC_ARCH="true" + + if [ "$RUN_SEC_ARCH" = "true" ]; then + rlRun "patch -p1 < $ORIGWD/testsuite.patch" + rlRun "make check" + fi + rlRun "popd" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPD" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/internal-tests/testsuite.patch b/tests/Regression/internal-tests/testsuite.patch new file mode 100644 index 0000000..b229842 --- /dev/null +++ b/tests/Regression/internal-tests/testsuite.patch @@ -0,0 +1,179 @@ +diff --git a/testsuite/Makefile b/testsuite/Makefile +index b8d295f..dc23da2 100644 +--- a/testsuite/Makefile ++++ b/testsuite/Makefile +@@ -457,7 +457,7 @@ uninstall-am: + + + prog: prog.c +- $(CC) $(RPATH) -o $@ $< ++ $(CC) $(RPATH) $(MYFLAGS) -o $@ $< + + check: $(CHRPATH) + $(srcdir)/runtest.sh +diff --git a/testsuite/runtest.sh b/testsuite/runtest.sh +index f913bc5..f6e7807 100755 +--- a/testsuite/runtest.sh ++++ b/testsuite/runtest.sh +@@ -6,77 +6,90 @@ CHRPATH=../chrpath + + retval=0 + +-rm prog +-make prog +- +-if $CHRPATH -h ; then +- echo "success: chrpath -h worked." +-else +- echo "error: chrpath -h failed." +- retval=1 +-fi +- +-if $CHRPATH -v ; then +- echo "success: chrpath -v worked." +-else +- echo "error: chrpath -v failed." +- retval=1 +-fi +- +-if $CHRPATH $0 ; then +- echo "error: chrpath on /bin/sh script worked." +- retval=1 +-else +- echo "success: chrpath on /bin/sh script failed." +-fi +- +-if $CHRPATH non-existant-file ; then +- echo "error: chrpath on non-existant file worked." +- retval=1 +-else +- echo "success: chrpath on non-existant file failed." +-fi +- +-if $CHRPATH -l prog | grep -q 'R.*PATH=.*/usr/local/lib' ; then +- echo "success: chrpath listed current rpath." +-else +- echo "error: chrpath unable to list current rpath." +- retval=1 +-fi +- +-$CHRPATH -r '/usr/lib' prog > /dev/null +- +-if $CHRPATH -l prog | grep -q 'R.*PATH=/usr/lib' ; then +- echo "success: chrpath changed rpath." +-else +- echo "error: chrpath unable to change rpath." +- retval=1 +-fi +- +-# I wish inserting a larger path would work, but it doesn't yet +-if $CHRPATH -r '/usr/lib:/usr/local/lib' prog > /dev/null ; then +- echo "success: chrpath changed rpath to larger path." +-else +- echo "error: chrpath unable to change rpath to larger path." +-fi +- +-$CHRPATH -c prog > /dev/null +- +-if $CHRPATH -l prog | grep -q 'RUNPATH=/usr/lib' ; then +- echo "success: chrpath converted rpath to runpath." +-else +- # Not all archs support runpath, ie not a fatal error +- echo "warning: chrpath unable to convert rpath to runpath." +-fi +- +-$CHRPATH -d prog > /dev/null +- +-if $CHRPATH -l prog | grep -q 'no rpath or runpath tag found' ; then +- echo "success: chrpath removed rpath and runpath successfully." +-else +- echo "error: chrpath unable to remove rpath or runpath." +- retval=1 +-fi ++function do_test() { ++ rm prog ++ make prog ++ ++ if $CHRPATH -h ; then ++ echo "success: chrpath -h worked." ++ else ++ echo "error: chrpath -h failed." ++ retval=1 ++ fi ++ ++ if $CHRPATH -v ; then ++ echo "success: chrpath -v worked." ++ else ++ echo "error: chrpath -v failed." ++ retval=1 ++ fi ++ ++ if $CHRPATH $0 ; then ++ echo "error: chrpath on /bin/sh script worked." ++ retval=1 ++ else ++ echo "success: chrpath on /bin/sh script failed." ++ fi ++ ++ if $CHRPATH non-existant-file ; then ++ echo "error: chrpath on non-existant file worked." ++ retval=1 ++ else ++ echo "success: chrpath on non-existant file failed." ++ fi ++ ++ if $CHRPATH -l prog | grep -q 'R.*PATH=.*/usr/local/lib' ; then ++ echo "success: chrpath listed current rpath." ++ else ++ echo "error: chrpath unable to list current rpath." ++ retval=1 ++ fi ++ ++ $CHRPATH -r '/usr/lib' prog > /dev/null ++ ++ if $CHRPATH -l prog | grep -q 'R.*PATH=/usr/lib' ; then ++ echo "success: chrpath changed rpath." ++ else ++ echo "error: chrpath unable to change rpath." ++ retval=1 ++ fi ++ ++ # I wish inserting a larger path would work, but it doesn't yet ++ if $CHRPATH -r '/usr/lib:/usr/local/lib' prog > /dev/null ; then ++ echo "success: chrpath changed rpath to larger path." ++ else ++ echo "error: chrpath unable to change rpath to larger path." ++ fi ++ ++ $CHRPATH -c prog > /dev/null ++ ++ if $CHRPATH -l prog | grep -q 'RUNPATH=/usr/lib' ; then ++ echo "success: chrpath converted rpath to runpath." ++ else ++ # Not all archs support runpath, ie not a fatal error ++ echo "warning: chrpath unable to convert rpath to runpath." ++ fi ++ ++ $CHRPATH -d prog > /dev/null ++ ++ if $CHRPATH -l prog | grep -q 'no rpath or runpath tag found' ; then ++ echo "success: chrpath removed rpath and runpath successfully." ++ else ++ echo "error: chrpath unable to remove rpath or runpath." ++ retval=1 ++ fi ++} ++ ++# Run the base arch tests ++unset MYFLAGS ++do_test ++ ++# Optionally run the compat arch tests ++MYFLAGS="" ++uname -m | egrep -q '^(x86_64|ppc64)$' && MYFLAGS="-m32" ++uname -m | grep -q '^s390x$' && MYFLAGS="-m31" ++export MYFLAGS ++test -z $MYFLAGS || do_test + + exit $retval +