From 41dc710615a5a3dca4748cdd954d695e16251c41 Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Tue, 6 May 2025 10:49:24 +0000 Subject: [PATCH] update tests/libabigail-testsuite testcase Related: RHEL-87003 --- tests/libabigail-testsuite/Makefile | 63 -------------------- tests/libabigail-testsuite/PURPOSE | 3 - tests/libabigail-testsuite/main.fmf | 10 ++-- tests/libabigail-testsuite/runtest.sh | 83 --------------------------- tests/libabigail-testsuite/test.sh | 59 +++++++++++++++++++ 5 files changed, 63 insertions(+), 155 deletions(-) delete mode 100644 tests/libabigail-testsuite/Makefile delete mode 100644 tests/libabigail-testsuite/PURPOSE delete mode 100755 tests/libabigail-testsuite/runtest.sh create mode 100755 tests/libabigail-testsuite/test.sh diff --git a/tests/libabigail-testsuite/Makefile b/tests/libabigail-testsuite/Makefile deleted file mode 100644 index 4d741d5..0000000 --- a/tests/libabigail-testsuite/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/libabigail/Sanity/libabigail-testsuite -# Description: libabigail testing by upstream testsuite -# Author: Michal Kolar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2021 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/libabigail/Sanity/libabigail-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: Michal Kolar " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: libabigail testing by upstream testsuite" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 1h" >> $(METADATA) - @echo "RunFor: libabigail" >> $(METADATA) - @echo "Requires: libabigail rpm-build yum-utils gcc-c++" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/libabigail-testsuite/PURPOSE b/tests/libabigail-testsuite/PURPOSE deleted file mode 100644 index 52e213c..0000000 --- a/tests/libabigail-testsuite/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/libabigail/Sanity/libabigail-testsuite -Description: libabigail testing by upstream testsuite -Author: Michal Kolar diff --git a/tests/libabigail-testsuite/main.fmf b/tests/libabigail-testsuite/main.fmf index 23d68bb..a21b94e 100644 --- a/tests/libabigail-testsuite/main.fmf +++ b/tests/libabigail-testsuite/main.fmf @@ -1,15 +1,13 @@ summary: libabigail testing by upstream testsuite -description: '' -contact: Michal Kolar component: - libabigail -test: ./runtest.sh +test: ./test.sh +tier: 1 framework: beakerlib -recommend: +require+: - libabigail - rpm-build - yum-utils - gcc-c++ +- coreutils duration: 1h -extra-summary: /tools/libabigail/Sanity/libabigail-testsuite -extra-task: /tools/libabigail/Sanity/libabigail-testsuite diff --git a/tests/libabigail-testsuite/runtest.sh b/tests/libabigail-testsuite/runtest.sh deleted file mode 100755 index 4b69b8b..0000000 --- a/tests/libabigail-testsuite/runtest.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/libabigail/Sanity/libabigail-testsuite -# Description: libabigail testing by upstream testsuite -# Author: Michal Kolar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2021 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 - -BUILD_USER=${BUILD_USER:-lbbglbld} -TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-10} -PACKAGE="libabigail" -REQUIRES="$PACKAGE rpm-build gcc-c++" -if rlIsFedora; then - REQUIRES="$REQUIRES dnf-utils" -else - REQUIRES="$REQUIRES yum-utils" -fi - -rlJournalStart - rlPhaseStartSetup - rlShowRunningKernel - rlAssertRpm --all - rlRun "TmpDir=`mktemp -d /home/libabigail.XXXXXXXXXX`" # work in /home due to high demands on disk space - rlRun "pushd $TmpDir" - rlFetchSrcForInstalled $PACKAGE - rlRun "useradd -m -N $BUILD_USER" 0,9 - [ "$?" == "0" ] && rlRun "del=yes" - rlRun "chown -R $BUILD_USER:users $TmpDir" - rlPhaseEnd - - rlPhaseStartSetup "build libabigail" - rlRun "rpm -D \"_topdir $TmpDir\" -U *.src.rpm" - rlRun "yum-builddep -y $TmpDir/SPECS/*.spec" - rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bc $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER" - rlRun "rlFileSubmit $TmpDir/rpmbuild.log" - rlRun "cd $TmpDir/BUILD/libabigail-*" - rlPhaseEnd - - rlPhaseStartTest "run testsuite" - rlRun "su -c 'make -k check |& tee -a $TmpDir/testsuite.log' $BUILD_USER" - rlRun "cp tests/test-suite.log $TmpDir/make-check.log" - rlRun "rlFileSubmit $TmpDir/make-check.log" - rlRun "su -c 'make -k check-self-compare |& tee -a $TmpDir/testsuite.log' $BUILD_USER" - rlRun "cp tests/test-suite.log $TmpDir/make-check-self-compare.log" - rlRun "rlFileSubmit $TmpDir/make-check-self-compare.log" - rlPhaseEnd - - rlPhaseStartTest "evaluate results" - rlRun "cd $TmpDir" - rlRun "cat make-*.log | grep -E '^# FAIL:|^# XPASS:|^# ERROR:' | grep -vqE ':\s*0$'" 1 - rlRun "tests_count=\$(grep -E '^PASS:' $TmpDir/testsuite.log | wc -l)" - [ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" - [ "$del" == "yes" ] && rlRun "userdel -f -r $BUILD_USER" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/libabigail-testsuite/test.sh b/tests/libabigail-testsuite/test.sh new file mode 100755 index 0000000..c29f398 --- /dev/null +++ b/tests/libabigail-testsuite/test.sh @@ -0,0 +1,59 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +BUILD_USER=${BUILD_USER:-lbbglbld} +TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-10} +PACKAGE="libabigail" +REQUIRES="$PACKAGE rpm-build gcc-c++" +if rlIsFedora; then + REQUIRES="$REQUIRES dnf-utils" +else + REQUIRES="$REQUIRES yum-utils" +fi + +# variables needed for 'make check' +export RPM_PACKAGE_NAME=$(rpm -q --qf='%{NAME}\n' $PACKAGE) +export RPM_PACKAGE_VERSION=$(rpm -q --qf='%{VERSION}\n' $PACKAGE) +export RPM_PACKAGE_RELEASE=$(rpm -q --qf='%{RELEASE}\n' $PACKAGE) +export RPM_ARCH=$(rpm -q --qf='%{ARCH}\n' $PACKAGE) + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm --all + rlRun "TmpDir=\$(mktemp -d /home/libabigail.XXXXXXXXXX)" # work in /home due to high demands on disk space + rlRun "pushd $TmpDir" + rlFetchSrcForInstalled $PACKAGE + rlRun "useradd -N $BUILD_USER" 0,9 + [ "$?" == "0" ] && rlRun "del=yes" + rlRun "chown -R $BUILD_USER:users $TmpDir" + rlPhaseEnd + + rlPhaseStartSetup "build libabigail" + rlRun "rpm -D \"_topdir $TmpDir\" -U *.src.rpm" + rlRun "yum-builddep -y $TmpDir/SPECS/*.spec &>$TmpDir/yum-builddep.log" + rlRun "rlFileSubmit $TmpDir/yum-builddep.log yum-builddep.log" + rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bc $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/rpmbuild.log rpmbuild.log" + rlRun "cd $(dirname `find $TmpDir -name configure -type f`)" + rlPhaseEnd + + rlPhaseStartTest "run testsuite" + rlRun "su -c 'make check |& tee $TmpDir/testsuite.log' $BUILD_USER" + rlRun "rlFileSubmit tests/test-suite.log test-suite.log" + rlRun "rlFileSubmit $TmpDir/testsuite.log testsuite.log" + rlPhaseEnd + + rlPhaseStartTest "evaluate results" + rlRun "grep -E '^# FAIL:|^# XPASS:|^# ERROR:' $TmpDir/testsuite.log | grep -vqE ':\s*0$'" 1 + rlRun "tests_count=\$(grep -E '^PASS:' $TmpDir/testsuite.log | wc -l)" + [ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + [ "$del" == "yes" ] && rlRun "userdel -f -r $BUILD_USER" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd