From 0e4ab8cfe4ce8633a67069a72649300583a615da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Fri, 9 Jul 2021 16:36:36 +0200 Subject: [PATCH] Import RHEL's wrapper for the upstream test suite Note: In RHEL, it's "testsuite2" outside of categories, here I'm adding it to the Sanity category. Note: I've filed https://bugzilla.redhat.com/show_bug.cgi?id=1963110 and included it as a known failure to make this test pass. --- tests/Sanity/testsuite/Makefile | 71 +++++++++++++++++++++++++++ tests/Sanity/testsuite/PURPOSE | 3 ++ tests/Sanity/testsuite/main.fmf | 23 +++++++++ tests/Sanity/testsuite/runtest.sh | 79 +++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 tests/Sanity/testsuite/Makefile create mode 100644 tests/Sanity/testsuite/PURPOSE create mode 100644 tests/Sanity/testsuite/main.fmf create mode 100755 tests/Sanity/testsuite/runtest.sh diff --git a/tests/Sanity/testsuite/Makefile b/tests/Sanity/testsuite/Makefile new file mode 100644 index 0000000..fec9913 --- /dev/null +++ b/tests/Sanity/testsuite/Makefile @@ -0,0 +1,71 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Sanity/testsuite +# Description: upstream tests for ltrace +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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/ltrace/Sanity/testsuite +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 " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: upstream tests for ltrace" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5h" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Requires: gcc" >> $(METADATA) + @echo "Requires: gcc-c++" >> $(METADATA) + @echo "Requires: libstdc++" >> $(METADATA) + @echo "Requires: libstdc++-devel" >> $(METADATA) + @echo "Requires: rpm-build yum-utils" >> $(METADATA) + @echo "Requires: elfutils-devel" >> $(METADATA) + @echo "Requires: dejagnu" >> $(METADATA) + @echo "Requires: libselinux-devel" >> $(METADATA) + @echo "Requires: libtool" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/testsuite/PURPOSE b/tests/Sanity/testsuite/PURPOSE new file mode 100644 index 0000000..75f0067 --- /dev/null +++ b/tests/Sanity/testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Sanity/testsuite +Description: upstream tests for ltrace +Author: Martin Cermak diff --git a/tests/Sanity/testsuite/main.fmf b/tests/Sanity/testsuite/main.fmf new file mode 100644 index 0000000..c0c9e11 --- /dev/null +++ b/tests/Sanity/testsuite/main.fmf @@ -0,0 +1,23 @@ +summary: upstream tests for ltrace +description: '' +contact: Martin Cermak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- gcc-c++ +- libstdc++ +- libstdc++-devel +- rpm-build +- yum-utils +- elfutils-devel +- dejagnu +- libselinux-devel +- libtool +- koji +duration: 5h +extra-summary: /tools/ltrace/Sanity/testsuite +extra-task: /tools/ltrace/Sanity/testsuite diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh new file mode 100755 index 0000000..e11c162 --- /dev/null +++ b/tests/Sanity/testsuite/runtest.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Sanity/testsuite +# Description: upstream tests for ltrace +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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='ltrace' +BIN=$(which --skip-alias $CMD) +PACKAGE="${PACKAGE:-$(rpm -qf $BIN)}" +export PACKAGE + +GCC=${GCC:-gcc} +export GCC + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun -l "rpm -qf $(which $GCC)" 0 "Checking gcc rpm version" + rlRun "TMP=`mktemp -d`" + rlRun "pushd $TMP" + + rlRun "koji download-build --arch=src $PACKAGE" + rlRun "dnf builddep -y *src.rpm" + rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm" + rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec" + rlPhaseEnd + + rlPhaseStartTest + rlRun "pushd BUILD/${CMD}-*" + + # known issues to be ignored + ignore_list='' + rlRun "ignore_list+=' system_calls.exp'" 0 "Failure reported bz#1963110" + + # define --ignore parameter for 'make check' if there is any testcase to be ignored + [ -n "$ignore_list" ] && rlRun "ignore_param=\"--ignore '$ignore_list'\"" 0 "Ignored testcases that will not be run: $ignore_list" + + # test + set -o pipefail + rlRun "make check RUNTESTFLAGS=\"--tool_exec=$BIN CC_FOR_TARGET=$GCC $ignore_param\" |& tee $TMP/check.log" + rlRun "popd" + + # no unexpected results should appear + rlRun -l "grep '^FAIL:' check.log" 1 + rlRun -l "grep '^# of unexpected' check.log" 1 + + rlFileSubmit "$TMP/check.log" "$PACKAGE-check.log" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd