| |
@@ -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.