Import RHEL tests usable in Fedora

This commit is contained in:
Václav Kadlčík 2023-03-29 10:02:47 +02:00
commit a85087f79e
53 changed files with 3137 additions and 0 deletions

View file

@ -0,0 +1,33 @@
summary: Test for BZ#1958954 (annobin fails to skip endbr64 entry point check)
description: |
Bug summary: annobin fails to skip endbr64 entry point check for shared objects
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1958954
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- gcc
- redhat-rpm-config
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1958954
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2020294
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2020287
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0610974
extra-summary: /tools/annobin/Regression/annobin-fails-to-skip-endbr64-entry-point-check
extra-task: /tools/annobin/Regression/annobin-fails-to-skip-endbr64-entry-point-check
id: 357a0573-b070-4a35-8f7d-4822fe15d49c

View file

@ -0,0 +1,100 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/annobin-fails-to-skip-endbr64-entry-point-check
# Description: Test for BZ#1958954 (annobin fails to skip endbr64 entry point check)
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME redhat-rpm-config"
PACKAGES+=" ${ANNOCHECK_RPM_NAME/annobin-annocheck/gcc}" # Let's work with GCC of the same OS/GTS/DTS annocheck belongs to
ANNOCHECK_SWITCHES='--verbose'
rlJournalStart
rlPhaseStartSetup
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
# In general, we need to pass switches suitable for the respective OS. In the future
# an option like --profile=el<RHEL_MAJOR_VERSION> should be available so let's leave
# a TODO here to use it. Until then we have to resort to maintaining a mess of ifs.
if rlIsRHEL '<9'; then
if annocheck --skip-lto $ANNOCHECK |& grep -q -i 'Unrecognised command line option'; then
: # --skip-lto is unknow, no need to use it
else
ANNOCHECK_SWITCHES+=' --skip-lto' # LTO si enabled on RHEL9+ only
fi
fi
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "echo 'void f1(void) {}' > f1.c"
rlRun "echo 'void f2(void) {}' > f2.c"
rlRun "gcc `rpm --eval %build_cflags` -fpic -c f1.c"
rlRun "gcc `rpm --eval %build_cflags` -fpic -c f2.c"
rlRun "gcc `rpm --eval %build_ldflags` -shared f1.o f2.o"
rlRun "annocheck $ANNOCHECK_SWITCHES a.out"
cp a.out /tmp/
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,55 @@
summary: Test for BZ#1981410 (annocheck reports that /sbin/ldconfig stack)
description: |
Bug summary: annocheck reports that /sbin/ldconfig stack protection deliberately disabled
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1981410
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- dnf-utils
- yum-utils
- annobin
- annobin-plugin-gcc
- annobin-annocheck
- devtoolset-10-annobin
- devtoolset-10-annobin-plugin-gcc
- devtoolset-10-annobin-annocheck
- devtoolset-11-annobin
- devtoolset-11-annobin-plugin-gcc
- devtoolset-11-annobin-annocheck
- devtoolset-12-annobin
- devtoolset-12-annobin-plugin-gcc
- devtoolset-12-annobin-annocheck
- gcc-toolset-10-annobin
- gcc-toolset-10-annobin-plugin-gcc
- gcc-toolset-10-annobin-annocheck
- gcc-toolset-11-annobin
- gcc-toolset-11-annobin-plugin-gcc
- gcc-toolset-11-annobin-annocheck
- gcc-toolset-12-annobin
- gcc-toolset-12-annobin-plugin-gcc
- gcc-toolset-12-annobin-annocheck
duration: 1h
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1981410
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
- enabled: false
when: collection == gcc-toolset-10, devtoolset-10
continue: false
because: annobin<10.09, known to fail
extra-nitrate: TC#0611914
extra-summary: /tools/annobin/Regression/bz1981410-annocheck-reports-that-sbin-ldconfig-stack
extra-task: /tools/annobin/Regression/bz1981410-annocheck-reports-that-sbin-ldconfig-stack
id: a3920cc2-6dab-4090-8b81-81e085aa4fe8

View file

@ -0,0 +1,115 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz1981410-annocheck-reports-that-sbin-ldconfig-stack
# Description: Test for BZ#1981410 (annocheck reports that /sbin/ldconfig stack)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<10.09
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
ARCH=$(arch)
rlJournalStart
rlPhaseStartSetup
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "debuginfo-install -y glibc.$ARCH"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
# Note on RHBZ#1981410
#
# The bug became convoluted over time, partly because several bugs were discussed and processed.
#
# Let's keep this test focused on just one thing, the problem described in the original bug report:
# --test-stack-prot shouldn't fail on /sbin/ldconfig
# Regarding the reproducing command, let's not use '--test-pic --test-pie'. For ldconfig, it's not
# really relevant (#c37).
#
# The other problems deserving their own tests are:
# * the file descriptor issue and
# * many command line arguments
# I'm leaving them as TODO for later.
rlPhaseStartTest
rlRun 'annocheck --verbose --ignore-gaps --skip-all --test-stack-prot /sbin/ldconfig &>annocheck.out'
if [[ $? -ne 0 ]]; then
rlLogInfo 'annocheck wrote:'
cat annocheck.out | while read line; do
if echo "$line" |& grep -i fail; then
rlLogError "$line"
else
rlLogInfo "$line"
fi
done
rlFileSubmit annocheck.out annocheck.out
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,47 @@
summary: Test for BZ#1996963 (annocheck segfaults on ppc64le /lib64/libc.so.6)
description: |
Bug summary: annocheck segfaults on ppc64le /lib64/libc.so.6 with debuginfo
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1996963
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- dnf-utils
- yum-utils
- annobin
- annobin-plugin-gcc
- annobin-annocheck
- devtoolset-10-annobin
- devtoolset-10-annobin-plugin-gcc
- devtoolset-10-annobin-annocheck
- devtoolset-11-annobin
- devtoolset-11-annobin-plugin-gcc
- devtoolset-11-annobin-annocheck
- devtoolset-12-annobin
- devtoolset-12-annobin-plugin-gcc
- devtoolset-12-annobin-annocheck
- gcc-toolset-10-annobin
- gcc-toolset-10-annobin-plugin-gcc
- gcc-toolset-10-annobin-annocheck
- gcc-toolset-11-annobin
- gcc-toolset-11-annobin-plugin-gcc
- gcc-toolset-11-annobin-annocheck
- gcc-toolset-12-annobin
- gcc-toolset-12-annobin-plugin-gcc
- gcc-toolset-12-annobin-annocheck
duration: 30m
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1996963
adjust:
- enabled: false
when: distro < rhel-7
continue: false
extra-nitrate: TC#0611913
extra-summary: /tools/annobin/Regression/bz1996963-annocheck-segfaults-on-ppc64le-lib64-libc-so-6
extra-task: /tools/annobin/Regression/bz1996963-annocheck-segfaults-on-ppc64le-lib64-libc-so-6
id: 92b830c4-57ba-440a-9fc3-e6b8581beca2

View file

@ -0,0 +1,84 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz1996963-annocheck-segfaults-on-ppc64le-lib64-libc-so-6
# Description: Test for BZ#1996963 (annocheck segfaults on ppc64le /lib64/libc.so.6)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
ARCH=$(arch)
rlJournalStart
rlPhaseStartSetup
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
LIBC_SO=$(rpm -ql glibc.$ARCH | grep '^/lib.*/libc\.so\.[0-9]*$' | head -n 1)
if [[ -z "LIBC_SO" ]]; then
rlFail 'libc.so not found'
fi
rlLogInfo "LIBC_SO=$LIBC_SO"
rlRun "debuginfo-install -y glibc.$ARCH"
rlPhaseEnd
rlPhaseStartTest
# The exit value we definitely do not want is 139 which corresponds to segfaulting
rlRun "annocheck --verbose --verbose --ignore-gaps --skip-all --test-pic --test-pie --test-stack-prot $LIBC_SO" 0,1
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,76 @@
summary: Test for BZ#1998472 (annocheck complains "MAYB test notes" on empty)
description: |
Bug summary: annocheck complains "MAYB: test: notes" on empty program [aarch64]
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1998472
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- redhat-rpm-config
recommend:
- annobin
- annobin-plugin-gcc
- annobin-annocheck
- gcc-c++
- devtoolset-10-annobin
- devtoolset-10-annobin-plugin-gcc
- devtoolset-10-annobin-annocheck
- devtoolset-10-binutils-devel
- devtoolset-10-elfutils-devel
- devtoolset-10-gcc-c++
- devtoolset-11-annobin
- devtoolset-11-annobin-plugin-gcc
- devtoolset-11-annobin-annocheck
- devtoolset-11-binutils-devel
- devtoolset-11-elfutils-devel
- devtoolset-11-gcc-c++
- devtoolset-12-annobin
- devtoolset-12-annobin-plugin-gcc
- devtoolset-12-annobin-annocheck
- devtoolset-12-binutils-devel
- devtoolset-12-elfutils-devel
- devtoolset-12-gcc-c++
- gcc-toolset-10-annobin
- gcc-toolset-10-annobin-plugin-gcc
- gcc-toolset-10-annobin-annocheck
- gcc-toolset-10-binutils-devel
- gcc-toolset-10-elfutils-devel
- gcc-toolset-10-gcc-c++
- gcc-toolset-11-annobin
- gcc-toolset-11-annobin-plugin-gcc
- gcc-toolset-11-annobin-annocheck
- gcc-toolset-11-binutils-devel
- gcc-toolset-11-elfutils-devel
- gcc-toolset-11-gcc-c++
- gcc-toolset-12-annobin
- gcc-toolset-12-annobin-plugin-gcc
- gcc-toolset-12-annobin-annocheck
- gcc-toolset-12-binutils-devel
- gcc-toolset-12-elfutils-devel
- gcc-toolset-12-gcc-c++
duration: 20m
enabled: true
tag:
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1998472
adjust:
- enabled: false
when: distro < rhel-8
continue: false
because: No annobin there or older redhat-rpm-config
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<10.10, known to fail
- enabled: false
when: collection == gcc-toolset-10, devtoolset-10
continue: false
because: annobin<10.10, known to fail
extra-nitrate: TC#0611910
extra-summary: /tools/annobin/Regression/bz1998472-annocheck-complains-MAYB-test-notes-on-empty
extra-task: /tools/annobin/Regression/bz1998472-annocheck-complains-MAYB-test-notes-on-empty
id: 016ebcd8-fedb-481c-903c-505a12432641

View file

@ -0,0 +1,107 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz1998472-annocheck-complains-MAYB-test-notes-on-empty
# Description: Test for BZ#1998472 (annocheck complains "MAYB test notes" on empty)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<10.10 or with older redhat-rpm-config
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
# - RHEL <8
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_SWITCHES='-v'
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME redhat-rpm-config"
PACKAGES+=" ${ANNOCHECK_RPM_NAME/annobin-annocheck/gcc}" # Let's work with GCC of the same OS/GTS/DTS annocheck belongs to
rlJournalStart
rlPhaseStartSetup
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
BUILD_CFLAGS="$(rpm --eval '%{build_cflags}')"
BUILD_LDFLAGS="$(rpm --eval '%{build_ldflags}')"
rlLogInfo "BUILD_CFLAGS=$BUILD_CFLAGS"
rlLogInfo "BUILD_LDFLAGS=$BUILD_LDFLAGS"
# In general, we need to pass switches suitable for the respective OS. In the future
# an option like --profile=el<RHEL_MAJOR_VERSION> should be available so let's leave
# a TODO here to use it. Until then we have to resort to maintaining a mess of ifs.
if rlIsRHEL '<9'; then
if annocheck --skip-lto $ANNOCHECK |& grep -q -i 'Unrecognised command line option'; then
: # --skip-lto is unknow, no need to use it
else
ANNOCHECK_SWITCHES+=' --skip-lto' # LTO si enabled on RHEL9+ only
fi
fi
rlLogInfo "ANNOCHECK_SWITCHES=$ANNOCHECK_SWITCHES"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlRun 'echo "int main(void){return 0;}" >main.c'
rlRun "gcc $BUILD_CFLAGS $BUILD_LDFLAGS -o main main.c"
rlPhaseEnd
rlPhaseStartTest
rlRun "annocheck $ANNOCHECK_SWITCHES main"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,33 @@
summary: Test for BZ#2009958 (annobin Plugin diagnostics for -D_FORTIFY_SOURCE)
description: |
Bug summary: annobin: Plugin diagnostics for -D_FORTIFY_SOURCE break autoconf tests
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2009958
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- gcc
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 30m
enabled: true
tag:
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2009958
adjust:
- enabled: false
when: distro < rhel-9
continue: false
- enabled: false
when: distro == rhel-9 and distro ~< rhel-9.1
continue: false
extra-nitrate: TC#0613088
extra-summary: /tools/annobin/Regression/bz2009958-annobin-Plugin-diagnostics-for-D-FORTIFY-SOURCE
extra-task: /tools/annobin/Regression/bz2009958-annobin-Plugin-diagnostics-for-D-FORTIFY-SOURCE
id: a98bcd3b-0aac-41ee-ac14-602c79e900d8

View file

@ -0,0 +1,103 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2009958-annobin-Plugin-diagnostics-for-D-FORTIFY-SOURCE
# Description: Test for BZ#2009958 (annobin Plugin diagnostics for -D_FORTIFY_SOURCE)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2022 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
# Relevancy: expected to fail with annobin<10.58. In practice, expected to fail
# with RHEL <9.1.
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlMountRedhat
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
TESTED_FLAGS='-c -Werror -flto=auto -fplugin=annobin'
rlLogInfo "TESTED_FLAGS='$TESTED_FLAGS'"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlRun 'echo "int main(void) {return 0;}" >someprog.c'
rlRun 'cp someprog.c conftest.c'
rlPhaseEnd
rlPhaseStartTest ORDINARY_FILES
# On files not starting with "conftest." failures are expected, unless
# "no-active-checks" drops the checks.
rlRun "gcc $TESTED_FLAGS someprog.c" 1
rlRun "gcc $TESTED_FLAGS -fplugin-arg-annobin-active-checks someprog.c" 1
rlRun "gcc $TESTED_FLAGS -fplugin-arg-annobin-no-active-checks someprog.c" 0
rlPhaseEnd
rlPhaseStartTest AUTOCONF_FILES
# On files starting with "conftest." passes are expected, unless
# "active-checks" enforces the checks.
rlRun "gcc $TESTED_FLAGS conftest.c" 0
rlRun "gcc $TESTED_FLAGS -fplugin-arg-annobin-active-checks conftest.c" 1
rlRun "gcc $TESTED_FLAGS -fplugin-arg-annobin-no-active-checks conftest.c" 0
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,36 @@
summary: Test for BZ#2011438 (gating run with rpminspect and annocheck pie test)
description: |
Bug summary: gating run with rpminspect and annocheck: pie test malloc says PASS but rpminspect says VERIFY
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2011438
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 60m
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2011438
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<10.13, known to fail
- enabled: false
when: collection == gcc-toolset-10, devtoolset-10
continue: false
because: annobin<10.13, known to fail
extra-nitrate: TC#0611935
extra-summary: /tools/annobin/Regression/bz2011438-gating-run-with-rpminspect-and-annocheck-pie-test
extra-task: /tools/annobin/Regression/bz2011438-gating-run-with-rpminspect-and-annocheck-pie-test
id: 492c0d84-e165-4b55-ac4a-dbe2da78f2b2

View file

@ -0,0 +1,125 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2011438-gating-run-with-rpminspect-and-annocheck-pie-test
# Description: Test for BZ#2011438 (gating run with rpminspect and annocheck pie test)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<10.13
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
ARCH=$(arch)
ANNOCHECK_SWITCHES='--ignore-unknown --verbose'
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
# In general, we need to pass switches suitable for the respective OS. In the future
# an option like --profile=el<RHEL_MAJOR_VERSION> should be available so let's leave
# a TODO here to use it. Until then we have to resort to maintaining a mess of ifs.
if rlIsRHEL '<9'; then
if annocheck --skip-lto $ANNOCHECK |& grep -q -i 'Unrecognised command line option'; then
: # --skip-lto is unknow, no need to use it
else
ANNOCHECK_SWITCHES+=' --skip-lto' # LTO si enabled on RHEL9+ only
fi
fi
rlLogInfo "ANNOCHECK_SWITCHES=$ANNOCHECK_SWITCHES"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
# As a test, submit ever growing bogus paths as --debug-dir
rlPhaseStartTest
BOGUS_DIR=/abcd
i=0; while [[ $i -lt 5000 ]]; do
(( i++ ))
BOGUS_DIR+=/abcd
annocheck $ANNOCHECK_SWITCHES --debug-dir=$BOGUS_DIR /usr/bin/ls &>annocheck.out
retval=$?
case $retval in
0|1)
: # OK
;;
*)
rlFileSubmit annocheck.out annocheck.out
rlFail "'annocheck $ANNOCHECK_SWITCHES --debug-dir=$BOGUS_DIR /usr/bin/ls' exited with $retval"
rlLogInfo 'annocheck output:'
while read line; do
rlLogInfo "$line"
done <annocheck.out
rlLogError "--debug-dir path was long $(echo -n $BOGUS_DIR | wc -c) characters"
break
;;
esac
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,36 @@
summary: Test for BZ#2012797 (annocheck reports that ld64.so.2 was not built)
description: |
Bug summary: annocheck reports that ld64.so.2 was not built with -D_FORTIFY_SOURCE=2
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2012797
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- dnf-utils
- yum-utils
- annobin-plugin-gcc
- annobin
- annobin-annocheck
- devtoolset-10-annobin-annocheck
- devtoolset-11-annobin-annocheck
- devtoolset-12-annobin-annocheck
- gcc-toolset-10-annobin-annocheck
- gcc-toolset-11-annobin-annocheck
- gcc-toolset-12-annobin-annocheck
duration: 15m
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2012797
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2072082
adjust:
- enabled: false
when: distro < rhel-7
continue: false
extra-nitrate: TC#0612587
extra-summary: /tools/annobin/Regression/bz2012797-annocheck-reports-that-ld64-so-2-was-not-built
extra-task: /tools/annobin/Regression/bz2012797-annocheck-reports-that-ld64-so-2-was-not-built
id: dd72a644-b723-48c2-8d32-7001a98bb0fa

View file

@ -0,0 +1,130 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2012797-annocheck-reports-that-ld64-so-2-was-not-built
# Description: Test for BZ#2012797 (annocheck reports that ld64.so.2 was not built)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
ANNOCHECK_RPM_VERSION=$(rpm --qf '%{version}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
ARCH=$(arch)
ANNOCHECK_SWITCHES='--ignore-unknown --verbose'
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
# In general, we need to pass switches suitable for the respective OS. In the future
# an option like --profile=el<RHEL_MAJOR_VERSION> should be available so let's leave
# a TODO here to use it. Until then we have to resort to maintaining a mess of ifs.
if rlIsRHEL '<9'; then
if annocheck --skip-lto $ANNOCHECK |& grep -q -i 'Unrecognised command line option'; then
: # --skip-lto is unknow, no need to use it
else
ANNOCHECK_SWITCHES+=' --skip-lto' # LTO si enabled on RHEL9+ only
fi
fi
if rlTestVersion $ANNOCHECK_RPM_VERSION '>=' 10.56; then
ANNOCHECK_SWITCHES+=' --follow-links'
fi
rlLogInfo "ANNOCHECK_SWITCHES=$ANNOCHECK_SWITCHES"
DYNLOADERS=$(rpm -ql glibc.$ARCH | grep '/lib.*/ld.*\.so\.[0-9]\+$')
if [[ -z "$DYNLOADERS" ]]; then
rlDie 'No dynamic loader found'
fi
# Extend for RHBZ#2033255: not only /lib/... but /usr/lib/... as well
DYNLOADERS_THROUGH_SYMLINK=''
for i in $DYNLOADERS; do
if cmp -s "$i" "/usr$i"; then
DYNLOADERS_THROUGH_SYMLINK+=" /usr$i"
fi
done
DYNLOADERS+=" $DYNLOADERS_THROUGH_SYMLINK"
rlLogInfo "DYNLOADERS=$DYNLOADERS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
for i in $DYNLOADERS; do
rlPhaseStartTest $i
rlAssertExists $i
out="annocheck${i//\//-}.out"
rlRun "annocheck $ANNOCHECK_SWITCHES $i &>$out"
if [[ $? -ne 0 ]]; then
rlLogInfo 'annocheck wrote:'
while read line; do
if echo "$line" |& grep -i fail; then
rlLogError "$line"
else
rlLogInfo "$line"
fi
done <$out
rlFileSubmit $out $out
fi
rlPhaseEnd
done
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,32 @@
summary: Test for BZ#2013562 (man pages for non-existing commands [RHEL-9.0.0])
description: |
Bug summary: man pages for non-existing commands [RHEL-9.0.0]
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2013562
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 15m
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2013562
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: no annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: system annobin fixed in rhel-8.6
extra-nitrate: TC#0611971
extra-summary: /tools/annobin/Regression/bz2013562-man-pages-for-non-existing-commands-RHEL-9-0-0
extra-task: /tools/annobin/Regression/bz2013562-man-pages-for-non-existing-commands-RHEL-9-0-0
id: 8f08fa61-44a3-41cb-bf40-d7f52687b01a

View file

@ -0,0 +1,98 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2013562-man-pages-for-non-existing-commands-RHEL-9-0-0
# Description: Test for BZ#2013562 (man pages for non-existing commands [RHEL-9.0.0])
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<10.73
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "rpm -ql $PACKAGES >files"
while read i; do
[[ "$i" == */bin/* ]] && echo "${i##*/bin/}" >>commands.txt
[[ "$i" == */man1/* ]] && echo "${i##*/man1/}" >>manpages.txt
done <files
for i in $(<commands.txt); do rlLogInfo "command found: $i"; done
for i in $(<manpages.txt); do rlLogInfo "man page found: $i"; done
for i in $(<manpages.txt); do
i=${i%.gz}; i=${i%.1} # cut off ".gz" if any, then cut off ".1"
if [[ "$i" = 'annobin' ]]; then
# annobin as a whole has a page in section 1 (though 7 would be more appropriate)
continue
fi
# for every man page in section 1 there should be a corresponding command
rlAssertGrep "^${i}$" commands.txt
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,48 @@
summary: Test for BZ#2022973 (annobin needs to be taught about)
description: |
Bug summary: annobin needs to be taught about /usr/sbin/ldconfig
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2022973
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
- dnf-utils
- yum-utils
- devtoolset-10-annobin-annocheck
- devtoolset-11-annobin-annocheck
- devtoolset-12-annobin-annocheck
- gcc-toolset-10-annobin-annocheck
- gcc-toolset-11-annobin-annocheck
- gcc-toolset-12-annobin-annocheck
duration: 30m
enabled: true
tag:
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2022973
adjust:
- enabled: false
when: distro < rhel-7
continue: false
because: No /usr/sbin/ldconfig there
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<10.25, known to fail
- enabled: false
when: collection == gcc-toolset-11 and distro == rhel-8
continue: false
because: annobin<10.25, known to fail
extra-nitrate: TC#0612586
extra-summary: /tools/annobin/Regression/bz2022973-annobin-needs-to-be-taught-about
extra-task: /tools/annobin/Regression/bz2022973-annobin-needs-to-be-taught-about
id: b34f9a47-f243-4b6e-ba27-d87792783111

View file

@ -0,0 +1,104 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2022973-annobin-needs-to-be-taught-about
# Description: Test for BZ#2022973 (annobin needs to be taught about)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<10.25
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
# - GTS=11 on RHEL-8
# - RHEL <7 (no /usr/sbin/ldconfig)
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
ARCH=$(arch)
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "debuginfo-install -y glibc.$ARCH glibc-gconv-extra.$ARCH"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
for i in /sbin/ldconfig /usr/sbin/ldconfig; do
rlPhaseStartTest $i
out="annocheck${i//\//-}.out"
rlRun "annocheck --verbose --ignore-gaps --skip-all --test-stack-prot $i &>$out"
if [[ $? -ne 0 ]]; then
rlLogInfo 'annocheck wrote:'
while read line; do
if echo "$line" |& grep -i fail; then
rlLogError "$line"
else
rlLogInfo "$line"
fi
done <$out
rlFileSubmit $out $out
fi
rlPhaseEnd
done
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,33 @@
summary: Test for BZ#2039747 (Missing cpio dependency)
description: |
Bug summary: Missing cpio dependency
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2039747
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-annocheck
duration: 10m
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2039747
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2043474
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: no annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: system annobin fixed in rhel-8.6
- enabled: false
when: collection == gcc-toolset-11, devtoolset-11, devtoolset-12
continue: false
because: not fixed in GTS <12, DTS<13
extra-nitrate: TC#0612788
extra-summary: /tools/annobin/Regression/bz2039747-Missing-cpio-dependency
extra-task: /tools/annobin/Regression/bz2039747-Missing-cpio-dependency
id: e61c7418-2d31-46ee-95f3-49f267ab59be

View file

@ -0,0 +1,81 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2039747-Missing-cpio-dependency
# Description: Test for BZ#2039747 (Missing cpio dependency)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2022 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Relevancy: Should pass for
# - system annobin of RHEL >8.5
# - GTS >11
# - DTS >12
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
PACKAGES="$ANNOCHECK_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "rpm -q --requires $ANNOCHECK_RPM_NAME >requires.txt"
rlAssertGrep '^cpio$' requires.txt
rlAssertGrep '^rpm$' requires.txt
if ! rlGetPhaseState; then
rlFileSubmit requires.txt requires.txt
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,38 @@
summary: Test for BZ#2086850 (annocheck Warning Unrecognised command line option)
description: |
Bug summary: annocheck: Warning: Unrecognised command line option: --tmpdir=
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2086850
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-annocheck
- dnf-utils
- yum-utils
duration: 15m
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2086850
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: no annobin
- enabled: false
when: distro == rhel-8.7 and collection is not defined
continue: false
because: RHBZ#2086850 itself
- enabled: false
when: distro == rhel-8.6 and collection is not defined
continue: false
because: annocheck on /bin/bash fails for reasons other than RHBZ#2086850
- enabled: false
when: collection == gcc-toolset-11, devtoolset-11
continue: false
because: annocheck on /bin/bash fails for reasons other than RHBZ#2086850
extra-nitrate: TC#0613629
extra-summary: /tools/annobin/Regression/bz2086850-annocheck-Warning-Unrecognised-command-line
extra-task: /tools/annobin/Regression/bz2086850-annocheck-Warning-Unrecognised-command-line
id: 8ccc286c-37c1-4d30-a22b-7ee3740737b8

View file

@ -0,0 +1,79 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2086850-annocheck-Warning-Unrecognised-command-line
# Description: Test for BZ#2086850 (annocheck Warning Unrecognised command line option)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2022 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
# Relevancy: expected to fail with annobin=10.72 (and a few minor versions before)
# In practice, expected to fail with
# - system annobin of RHEL 8.7 - bz2086850 itself
# - system annobin of RHEL 8.6 - annocheck on /bin/bash fails for reasons other than bz2086850
# - GTS =12 - annocheck on /bin/bash fails for reasons other than bz2086850
# - GTS <11 - no annocheck
rlJournalStart
rlPhaseStartSetup
BASH_ANNOCHECK_RESULT=0
if rlIsRHEL '<=7'; then
# Older bash builds aren't annocheck-clean
BASH_ANNOCHECK_RESULT='0,1'
fi
ANNOCHECK_SWITCHES=''
if rlIsRHEL '<9'; then
if annocheck --skip-lto $ANNOCHECK |& grep -q -i 'Unrecognised command line option'; then
: # --skip-lto is unknown, no need to use it
else
ANNOCHECK_SWITCHES+=' --skip-lto' # LTO si enabled on RHEL9+ only
fi
fi
rlRun 'debuginfo-install -y bash'
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
# Check if --tmpdir= is still expected to work
rlRun 'annocheck --help &>help.out'
rlAssertGrep ' --tmpdir=' help.out
# There should be no complains
rlRun "annocheck $ANNOCHECK_SWITCHES --tmpdir=/root/foobar /bin/bash &>simple.out" "$BASH_ANNOCHECK_RESULT"
rlAssertNotGrep 'command line option' simple.out -i
# With some luck we may find the tmpdir in action. However the
# following implementation is quite shaky and maybe not worth
# maintaining...
rlRun "annocheck $ANNOCHECK_SWITCHES -v -v --enable-timing --enable-notes --enable-hardened --enable-builtby --tmpdir=/root/foobar /bin/bash &>beefy.out" "$BASH_ANNOCHECK_RESULT"
rlAssertGrep 'data file /root/foobar/' beefy.out
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,36 @@
summary: Test for BZ#2097065 (annobin annobin-docs subpackage incorrectly)
description: |
Bug summary: annobin: annobin-docs subpackage incorrectly provides annobin, breaking buildroot
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2097065
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- cpio
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
- annobin-docs
duration: 60m
enabled: true
tag:
- CI-Tier-1
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2097065
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2097617
adjust:
- enabled: false
when: distro < rhel-8
continue: false
- enabled: false
when: distro < fedora-37
continue: false
extra-nitrate: TC#0613923
extra-summary: /tools/annobin/Regression/bz2097065-annobin-annobin-docs-subpackage-incorrectly
extra-task: /tools/annobin/Regression/bz2097065-annobin-annobin-docs-subpackage-incorrectly
id: 187dfc4e-d186-4340-9b6e-0c0782b9c771

View file

@ -0,0 +1,119 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/bz2097065-annobin-annobin-docs-subpackage-incorrectly
# Description: Test for BZ#2097065 (annobin annobin-docs subpackage incorrectly)
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2022 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
ANNOBIN_DOCS_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-docs
PACKAGES="$ANNOCHECK_RPM_NAME cpio"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlPhaseEnd
# The -docs RPM may not exist at all. We should first know, if missing
# -docs is OK - then there is nothing to test. If the RPM should exists
# (let's check it by inspecting the spec file) then it should be present
# and should not provide anything strange (actually, just annobin-docs
# makes sense and possibly scl-package(...) for a GTS/DTS build).
rlPhaseStartTest DOCS_IS_MODEST_IF_AT_ALL
DOCS_RPM_EXPECTED=false
rlFetchSrcForInstalled $ANNOCHECK_RPM_NAME
rlRun "ANNOBIN_SRPM=$(echo *.src.rpm)"
rlRun 'rpm2cpio <$ANNOBIN_SRPM >annobin.cpio'
rlRun 'cpio -id <annobin.cpio'
rlAssertExists annobin.spec
if grep -q '%package[ ]\+docs' annobin.spec; then
DOCS_RPM_EXPECTED=true
fi
rlLogInfo "DOCS_RPM_EXPECTED=$DOCS_RPM_EXPECTED"
if $DOCS_RPM_EXPECTED; then
rlAssertRpm "$ANNOBIN_DOCS_RPM_NAME"
rlRun "rpm -q --provides $ANNOBIN_DOCS_RPM_NAME >provides.out"
# We expect just one or two Provides items
rlRun 'ITEMS_COUNT=$(wc -l <provides.out)'
rlLogInfo "In the Provides list found: ITEMS_COUNT=$ITEMS_COUNT"
if [[ "$ITEMS_COUNT" != 1 ]] && [[ "$ITEMS_COUNT" != 2 ]]; then
rlFail "ITEMS_COUNT=$ITEMS_COUNT mismatches expected 1 or 2"
fi
# This is what we expect always
rlAssertGrep '^[^ ]*annobin-docs ' provides.out
# This can happen for a GTS/DTS build
if [[ "$ITEMS_COUNT" != 1 ]]; then
rlAssertGrep '^scl-package(' provides.out
fi
# This should already be covered by the above but let's make it explicit
rlAssertNotGrep 'annobin[ ]*$' provides.out
rlAssertNotGrep 'annobin[ ]*=' provides.out
if ! rlGetPhaseState; then
rlLogError "Against expectations, $ANNOBIN_DOCS_RPM_NAME provides:"
while read line; do
rlLogError "$line"
done <provides.out
rlLogError "(EOF)"
fi
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,19 @@
summary: identify
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 10m
enabled: true
tag:
- CI-Tier-1
extra-nitrate: TC#0604430
extra-summary: /tools/annobin/Regression/identify
extra-task: /tools/annobin/Regression/identify
id: 594f9117-8d59-4846-8a55-9c82b486d36d

39
Regression/identify/runtest.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/identify
# Description: identify
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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
rlJournalStart
rlPhaseStartTest
rlRun "tool_v=$(annocheck --version | awk '/^annocheck: Version/ {print $3}')"
rlRun "__RPM=$(rpm --queryformat='%{name}\n' -qf $(man -w annobin))"
rlRun "rpm_v=$(rpm -q --queryformat='%{version}\n' $__RPM)"
rlRun "[[ "x${tool_v}" == "x${rpm_v}." ]]"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,35 @@
summary: lto-preprocessor-options
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- redhat-rpm-config
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1743635
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1998472
adjust:
- enabled: false
when: distro < rhel-8
continue: false
because: No annobin there, older redhat-rpm-config
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.4 and collection is not defined
continue: false
because: annobin<9.23, known to fail
extra-nitrate: TC#0607751
extra-summary: /tools/annobin/Regression/lto-preprocessor-options
extra-task: /tools/annobin/Regression/lto-preprocessor-options
id: 878eadae-6f02-4d8b-b7e0-22b8d4280f32

View file

@ -0,0 +1,39 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/lto-preprocessor-options
# Description: lto-preprocessor-options
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2020 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
rlJournalStart
rlPhaseStartTest
b=`mktemp`
rlRun "echo 'int main (void) { return 0; }' | gcc -xc -o $b `rpm --eval "%build_cflags %build_ldflags"` -flto - "
rlRun "annocheck -v $b"
rm $b
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,31 @@
summary: missing-check-for-x86-property-note-content
description: |
Bug summary: annobin: Missing check for contents of x86 property note
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1991931
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1991931
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<9.85, known to fail
extra-nitrate: TC#0611377
extra-summary: /tools/annobin/Regression/missing-check-for-x86-property-note-content
extra-task: /tools/annobin/Regression/missing-check-for-x86-property-note-content
id: 1d637272-8d85-442a-acd6-47680ccf4d00

View file

@ -0,0 +1,38 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/missing-check-for-x86-property-note-content
# Description: missing-check-for-x86-property-note-content
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
rlJournalStart
rlPhaseStartTest
rlRun "annocheck main" 1
rlRun "annocheck --fixed-format-messages main | \
grep '^Hardened: FAIL: test: cf-protection file: main.$'"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,31 @@
summary: processing-params-in-reverse-order
description: |
Bug summary: annocheck processes (reports) parameters in reverse order
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1988714
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1988714
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<9.84, known to fail
extra-nitrate: TC#0611374
extra-summary: /tools/annobin/Regression/processing-params-in-reverse-order
extra-task: /tools/annobin/Regression/processing-params-in-reverse-order
id: 3c1562a5-f3af-4ae9-9996-9137798a33a1

View file

@ -0,0 +1,40 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/processing-params-in-reverse-order
# Description: processing-params-in-reverse-order
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
rlJournalStart
rlPhaseStartTest
rlRun "TMP=$(mktemp)"
rlRun "annocheck --verbose --skip-all --test-stack-prot /bin/bash /bin/cat |& tee $TMP"
rlRun "fgrep -i /bin/ $TMP | head -1 | fgrep /bash"
rlRun "fgrep -i /bin/ $TMP | tail -1 | fgrep /cat"
rlRun "rm -f $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,40 @@
summary: Test for BZ#1703500
description: |
Bug summary: annobin: Missing _FORTIFY_SOURCE macro results in MAYBE
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1703500
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- redhat-rpm-config
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1703500
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1904479
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1908699
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<10.12, known to fail
- enabled: false
when: collection is defined
continue: false
because: written for system annobin only
extra-nitrate: TC#0602252
extra-summary: /tools/annobin/Regression/report-missing-FORTIFY-SOURCE-as-error
extra-task: /tools/annobin/Regression/report-missing-FORTIFY-SOURCE-as-error
id: ff18936f-b5e1-4072-85aa-f22852356407

View file

@ -0,0 +1,104 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/report-missing-FORTIFY-SOURCE-as-error
# Description: Test for BZ#1703500
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlRun "echo 'int main(void) {}' > u.c"
rlRun "rpm --eval '%build_cflags' | grep -o -- '-D_FORTIFY_SOURCE=[2|3]'"
rlPhaseEnd
rlPhaseStartTest
# Notes on LTO: RHBZ#1703500 was a RHEL8 bug. On RHEL9, LTO is used
# by default. LTO discards preprocessor options:
# https://sourceware.org/git/?p=annobin.git;a=commit;h=153a180de5421cc27c2de90c003366592fc4eb8c
# On top of the original reproducer, we need to disable LTO (at least since RHEL9).
rlRun "gcc `rpm --eval "%build_cflags %build_ldflags" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//' -e 's/-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3//' -e 's/-flto=auto -ffat-lto-objects//'` u.c"
rlRun "annocheck -v a.out |& tee annocheck.log"
rlRun "grep -F 'MAYB: Some parts of the binary do not record if -D_FORTIFY_SOURCE=' annocheck.log" 1
rlRun "grep -F \
\
-e 'FAIL: Some parts of the binary were not compiled with -D_FORTIFY_SOURCE=2' \
-e 'FAIL: Parts of the binary were compiled without -D_FORTIFY_SOURCE=2' \
-e 'FAIL: The binary was compiled without -DFORTIFY_SOURCE=2' \
-e 'FAIL: fortify test because -D_FORTIFY_SOURCE=2 was not present on command line' \
-e 'FAIL: fortify test because -D_FORTIFY_SOURCE=2 was not present on the command line' \
\
-e 'FAIL: Some parts of the binary were not compiled with -D_FORTIFY_SOURCE=[2|3]' \
-e 'FAIL: Parts of the binary were compiled without -D_FORTIFY_SOURCE=[2|3]' \
-e 'FAIL: The binary was compiled without -DFORTIFY_SOURCE=[2|3]' \
-e 'FAIL: fortify test because -D_FORTIFY_SOURCE=[2|3] was not present on command line' \
-e 'FAIL: fortify test because -D_FORTIFY_SOURCE=[2|3] was not present on the command line' \
\
annocheck.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,34 @@
summary: segv-when-processing-multiple-params-incl-symlink
description: |
Bug summary: annocheck segfaults sometimes when processing multiple parameters and symlink is involved
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1988715
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- libstdc++
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1988715
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<9.87, known to fail
extra-nitrate: TC#0611375
extra-summary: /tools/annobin/Regression/segv-when-processing-multiple-params-incl-symlink
extra-task: /tools/annobin/Regression/segv-when-processing-multiple-params-incl-symlink
id: f75cab47-3558-41b8-b37f-982bb25872a2

View file

@ -0,0 +1,63 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/segv-when-processing-multiple-params-incl-symlink
# Description: segv-when-processing-multiple-params-incl-symlink
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
ANNOCHECK_RPM_VERSION=$(rpm --qf '%{version}' -qf $ANNOCHECK)
rlJournalStart
rlPhaseStartSetup
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ANNOCHECK_RPM_NAME=$ANNOCHECK_RPM_NAME"
rlLogInfo "ANNOCHECK_RPM_VERSION=$ANNOCHECK_RPM_VERSION"
if rlTestVersion $ANNOCHECK_RPM_VERSION '>=' 10.56; then
IS_NEW=true
rlLogInfo 'annocheck knows --follow-links/--ignore-links'
else
IS_NEW=false
rlLogInfo 'annocheck does not know --follow-links/--ignore-links'
fi
rlPhaseEnd
rlPhaseStartTest
# This tries to test https://bugzilla.redhat.com/show_bug.cgi?id=1988715#c0
# keeping in mind that annocheck will evolve in the future, along its
# rules / policies, and the surrounding OS will evolve too. This test
# shouldn't report false positives though.
rlRun "rpm -qf /usr/lib64/libstdc++.so*"
if $IS_NEW; then
rlRun "annocheck --follow-links --skip-all /usr/lib64/libstdc++.so*"
rlRun "annocheck --ignore-links --skip-all /usr/lib64/libstdc++.so*"
else
rlRun "annocheck --skip-all /usr/lib64/libstdc++.so*"
fi
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,43 @@
summary: testsuite
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- binutils-devel
- bzip2-devel
- make
- rpm-build
- rpm-devel
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
- dnf-utils
- yum-utils
- elfutils
- elfutils-devel
- gcc-c++
- gcc-plugin-devel
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2101443
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2054571
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2017039
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2040688
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2031133
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1986846
adjust:
- enabled: false
when: distro < rhel-7
continue: false
because: known to fail, won't be fixed (RHBZ#2040688 and others)
extra-nitrate: TC#0590691
extra-summary: /tools/annobin/Regression/testsuite
extra-task: /tools/annobin/Regression/testsuite
id: 39498e38-82ff-47b7-884e-dfdecd2f0a9f

83
Regression/testsuite/runtest.sh Executable file
View file

@ -0,0 +1,83 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/testsuite
# Description: testsuite
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 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
PACKAGE="${PACKAGE:-$(rpm -qf --queryformat=%{name} $(man -w annobin))}"
export PACKAGE
GCC="${GCC:-$(which gcc)}"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "X_SCLS=$X_SCLS"
rlLogInfo "GCC=$GCC"
# In case more than one devtoolset- or gcc-toolset -build package is
# installed (they can co-exist from the packaging persp, but their
# coexistence causes unexpected results with rpm macros), then we have
# a mess of defined rpm macros coming e.g. from
# /etc/rpm/macros.gcc-toolset-10-config
# /etc/rpm/macros.gcc-toolset-9-config etc. To have just the needed
# macros (respective to given SCL under test) defined without
# uninstalling unneeded RPMs, we'll need an override mechanism. The
# following assumes just one SCL *enabled* (more than one installed),
# and doesn't care of a (useless) revert:
echo ${X_SCLS} | fgrep toolset && \
rlRun "cat /etc/rpm/*${X_SCLS%\ }* > ~/.rpmmacros"
rlAssertRpm $PACKAGE
rlRun "TMP=\$(mktemp -d)"
rlRun "pushd $TMP"
rlFetchSrcForInstalled $PACKAGE
rlRun "yum-builddep -y *src.rpm"
rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm"
rlRun "rpmbuild --define='_topdir $TMP' --with tests -bc SPECS/annobin.spec"
rlPhaseEnd
rlPhaseStartTest
rlRun "pushd BUILD/annobin-*"
set -o pipefail
rlRun "make check CLANG_TESTS=\"check-pre-clang-13\" |& tee $TMP/check.log"
rlRun -l "grep '^PASS:' $TMP/check.log" 0
rlRun -l "grep '^FAIL:' $TMP/check.log" 1
PASSCOUNT=$(grep '^PASS:' $TMP/check.log | wc -l)
rlRun "[[ $PASSCOUNT -ge 7 ]]"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,33 @@
summary: wrong-compiler-flags-but-no-failure
description: |
Bug summary: annobin: No annocheck failure despite wrong compiler flags
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1991943
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1991943
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2097643
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<9.88, known to fail
extra-nitrate: TC#0611398
extra-summary: /tools/annobin/Regression/wrong-compiler-flags-but-no-failure
extra-task: /tools/annobin/Regression/wrong-compiler-flags-but-no-failure
id: b0536591-5e26-4b9e-80e2-a3b78fba3089

View file

@ -0,0 +1,98 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Regression/wrong-compiler-flags-but-no-failure
# Description: wrong-compiler-flags-but-no-failure
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
ANNOCHECK_RPM_VERSION=$(rpm --qf '%{version}' -qf $ANNOCHECK)
PACKAGES="$ANNOCHECK_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "cp files/* $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
# Reproducer of https://bugzilla.redhat.com/show_bug.cgi?id=1991943#c0
rlPhaseStartTest main_with_gaps_in_notes
rlRun "FILE=main_with_gaps_in_notes"
rlRun "OUTPUT=${FILE}.out"
rlRun "annocheck --fixed-format-messages $FILE &>$OUTPUT" 0-255
rlRun "grep 'Hardened: PASS: test: .* file: $FILE.' $OUTPUT"
rlRun "grep -F 'Hardened: FAIL: test: cf-protection file: $FILE.' $OUTPUT"
# See https://bugzilla.redhat.com/show_bug.cgi?id=2097643#c6 for how
# the behaviour changed and why.
if rlTestVersion $ANNOCHECK_RPM_VERSION '>=' 10.75; then
rlRun "grep -F 'Hardened: FAIL: test: gaps file: $FILE.' $OUTPUT"
else
rlRun "grep -E 'Hardened: (MAYB|FAIL): test: notes file: $FILE.' $OUTPUT"
fi
rlGetPhaseState || rlFileSubmit $OUTPUT $OUTPUT
rlPhaseEnd
# Binary with no notes. Created from the previous one by:
# strip --remove-section .gnu.build.attributes
# See https://bugzilla.redhat.com/show_bug.cgi?id=2097643#c6 for details.
rlPhaseStartTest main_with_no_notes
rlRun "FILE=main_with_no_notes"
rlRun "OUTPUT=${FILE}.out"
rlRun "annocheck --fixed-format-messages $FILE &>$OUTPUT" 0-255
rlRun "grep 'Hardened: PASS: test: .* file: $FILE.' $OUTPUT"
rlRun "grep -F 'Hardened: FAIL: test: cf-protection file: $FILE.' $OUTPUT"
rlRun "grep -E 'Hardened: (MAYB|FAIL): test: notes file: $FILE' $OUTPUT"
rlGetPhaseState || rlFileSubmit $OUTPUT $OUTPUT
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,39 @@
summary: Allow multiple instances of -fplugin in CLI
description: |
Bug summary: Allow multiple instances of -fplugin in CLI
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2162746
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2162746
tag: []
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
adjust:
- enabled: false
when: collection is not defined and distro < rhel-8
continue: false
because: no system annobin
- enabled: false
when: collection is not defined and distro == rhel-8 and distro ~< rhel-8.9
continue: false
because: annobin < 11.11, known to fail
- enabled: false
when: collection is not defined and distro == rhel-9 and distro ~< rhel-9.3
continue: false
because: annobin < 11.11, known to fail
- enabled: false
when: collection == gcc-toolset-11, devtoolset-11, gcc-toolset-12, devtoolset-12
continue: false
because: annobin < 11.11, known to fail
- require+:
- annobin-annocheck
- annobin-plugin-gcc
when: distro == fedora
test: $WITH_SCL ./runtest.sh
framework: beakerlib
duration: 30m
extra-nitrate: TC#0614896
extra-summary: /tools/annobin/Sanity/allow_multiple_instances_of_fplugin
extra-task: /tools/annobin/Sanity/allow_multiple_instances_of_fplugin
id: 3e6cf1e0-5b5a-4313-9050-f08b14c58be7

View file

@ -0,0 +1,102 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Sanity/allow_multiple_instances_of_fplugin
# Description: Allow multiple instances of -fplugin in CLI
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2023 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
# Relevancy: expected to fail with annobin<11.11
# In practice, expected to fail with
# - system annobin of RHEL <8.9 or <9.3
# - GTS/DTS <13.0
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlMountRedhat
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
PLUGIN_LINK=$(rpm -ql $ANNOBIN_RPM_NAME | grep -m 1 -e '/annobin\.so$' -e '/[gd]ts-annobin\.so$')
PLUGIN_FILE=$(readlink --canonicalize-existing "$PLUGIN_LINK")
PLUGIN_NAME=${PLUGIN_LINK##*/}
PLUGIN_NAME=${PLUGIN_NAME%.so}
rlLogInfo "PLUGIN_LINK=$PLUGIN_LINK"
rlLogInfo "PLUGIN_FILE=$PLUGIN_FILE"
rlLogInfo "PLUGIN_NAME=$PLUGIN_NAME"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlRun 'echo "int main(void) { return 0; }" >main.c'
rlPhaseEnd
rlPhaseStartTest
rlAssertExists "$PLUGIN_FILE"
for i in 1 2 3; do
rlRun "cp '$PLUGIN_FILE' copy${i}.so"
done
rlRun "gcc -fplugin=$PLUGIN_NAME -fplugin=$PWD/copy1.so -fplugin=$PWD/copy2.so -fplugin=$PWD/copy3.so main.c &>compile.log"
while read line; do
rlLogError "$line"
done <compile.log
rlAssertNotGrep 'symbol .*\.annobin.* already defined' compile.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun popd
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,36 @@
summary: Test for BZ#1973981 (annocheck silently ignores any file parameter)
description: |
Bug summary: annocheck silently ignores any file parameter beyond 256
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1973981
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-plugin-gcc
- annobin
- annobin-annocheck
duration: 48h
enabled: true
tag:
- CI-Tier-1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1973981
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: No annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.6 and collection is not defined
continue: false
because: annobin<9.78, known to fail
- enabled: false
when: collection == gcc-toolset-10, devtoolset-10
continue: false
because: annobin<9.78, known to fail
extra-nitrate: TC#0611175
extra-summary: /tools/annobin/Sanity/annocheck-silently-ignores-any-file-parameter
extra-task: /tools/annobin/Sanity/annocheck-silently-ignores-any-file-parameter
id: c083513a-d534-4cf2-a56f-833f68e40db0

View file

@ -0,0 +1,60 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Sanity/annocheck-silently-ignores-any-file-parameter
# Description: Test for BZ#1973981 (annocheck silently ignores any file parameter)
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: expected to fail with annobin<9.78
# In practice, expected to fail with
# - system annobin of RHEL <8.6
# - GTS/DTS <11
rlJournalStart
rlPhaseStartSetup
rlRun "TMP=$(mktemp -d)"
rlRun "pushd $TMP"
rlPhaseEnd
rlPhaseStartTest
for i in `seq 0 299`; do touch ${i}.sample; done
samplecnt=$(ls *.sample | wc -l)
testcnt=$(ls *.sample | \
xargs annocheck |& \
grep -F \
-e '.sample: unable to read magic number' \
-e '.sample: is not an ELF format file' \
| wc -l)
rlRun "test $samplecnt -eq 300"
rlRun "test $testcnt -eq 300"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,42 @@
summary: Update Annobin for automatic syncing with gcc
description: ''
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
require:
- annobin-annocheck
- binutils-devel
- gcc
- gcc-c++
- gcc-plugin-devel
- perl
- redhat-rpm-config
- rpm-build
- rpm-devel
recommend:
- annobin-plugin-gcc
- annobin
duration: 30m
enabled: true
tag:
- CI-Tier-1
- NoRHEL6
- NoRHEL7
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2067148
adjust:
- enabled: false
when: distro < rhel-8
continue: false
- enabled: false
when: distro == rhel-8 and distro < rhel-8.7
continue: false
- enabled: false
when: collection is defined
continue: false
extra-nitrate: TC#0613129
extra-summary: /tools/annobin/Sanity/bz2067148-support_syncing_with_gcc
extra-task: /tools/annobin/Sanity/bz2067148-support_syncing_with_gcc
id: b821b6f6-6911-4a40-a35c-7d022f0b1a72

View file

@ -0,0 +1,124 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Sanity/bz2067148-support_syncing_with_gcc
# Description: Update Annobin for automatic syncing with gcc
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2022 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
# Not implemented for devtoolset/gcc-toolset. Suggested TCMS relevancy:
# distro < rhel-8: False
# distro = rhel-8 && distro < rhel-8.7: False
# collection defined: False
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
# We need to consider GCC of the same "set" annobin belongs to, e.g. system
# GCC if we are testing system annobin, GTS-11 GCC for GTS-11 annobin etc.
GCC_RPM_NAME=${ANNOCHECK_RPM_NAME%%annocheck} # remove trailing "annocheck"
GCC_RPM_NAME=${GCC_RPM_NAME%%annobin-} # remove trailing "annobin-" if present
GCC_RPM_NAME=${GCC_RPM_NAME}gcc
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME $GCC_RPM_NAME redhat-rpm-config rpm-build"
rlJournalStart
rlPhaseStartSetup
rlMountRedhat
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "ARCH=$ARCH"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "PLUGIN_DIR=$(gcc -print-file-name=plugin)"
rlRun "GCC_VERSION=$(rpm -q --qf='%{VERSION}' $GCC_RPM_NAME)"
rlRun "GCC_MAJOR_VERSION=${GCC_VERSION%%.*}"
rlRun "VERSION_INFO_FILE=$PLUGIN_DIR/annobin-plugin-version-info"
rlRun 'SRC_TARBALL=/usr/src/annobin/latest-annobin.tar.xz'
rlRun "ANNOBIN_SOURCE_RPM=$(rpm -q --qf='%{SOURCERPM}' $ANNOBIN_RPM_NAME)"
rlRun "ANNOBIN_VERSION=$(rpm -q --qf='%{VERSION}' $ANNOBIN_RPM_NAME)"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlFetchSrcForInstalled "$ANNOBIN_RPM_NAME"
rlRun 'mkdir -p my_rpmbuild'
rlRun "yum -y builddep $ANNOBIN_SOURCE_RPM"
rlRun "rpm -ivh --define='_topdir $PWD/my_rpmbuild' $ANNOBIN_SOURCE_RPM"
rlRun "rpmbuild --define '_topdir ${PWD}/my_rpmbuild' -bp my_rpmbuild/SPECS/*.spec"
rlPhaseEnd
rlPhaseStartTest RPM_IS_SANE
rlRun "rpm -ql $ANNOBIN_RPM_NAME >files.txt"
rlAssertGrep "^${VERSION_INFO_FILE}$" files.txt
rlAssertGrep "^${SRC_TARBALL}$" files.txt
rlPhaseEnd
rlPhaseStartTest VERSION_RECORDED
# annobin-plugin-version-info should exist and look sane
rlAssertExists "$VERSION_INFO_FILE"
rlAssertEquals "$VERSION_INFO_FILE has 1 line" "$(wc -l <$VERSION_INFO_FILE)" 1
rlAssertGrep "^${GCC_RPM_NAME}-${GCC_MAJOR_VERSION}\." "$VERSION_INFO_FILE"
rlPhaseEnd
rlPhaseStartTest SOURCES_ATTACHED
# annobin sources tarball should exist and match the SRPM's sources
rlAssertExists "$SRC_TARBALL"
rlAssertNotDiffer "$SRC_TARBALL" "my_rpmbuild/SOURCES/annobin-${ANNOBIN_VERSION}.tar.xz"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,37 @@
summary: Check if man pages are present
description: ''
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
- annobin-annocheck
- annobin-plugin-gcc
- annobin
- util-linux-ng
duration: 5m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- NoRHEL6
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2018541
adjust:
- enabled: false
when: distro < rhel-8 and collection is not defined
continue: false
because: no annobin there
- enabled: false
when: distro == rhel-8 and distro ~< rhel-8.4 and collection is not defined
continue: false
because: known to fail
- enabled: false
when: collection == gcc-toolset-10, devtoolset-10
continue: false
because: known to fail
extra-nitrate: TC#0612012
extra-summary: /tools/annobin/Sanity/man_pages_present
extra-task: /tools/annobin/Sanity/man_pages_present
id: 419e4450-e96b-4955-b6d3-f29494d84ab8

View file

@ -0,0 +1,108 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Sanity/man_pages_present
# Description: Check if man pages are present
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
# Relevancy: Should work with
# - system annobin of RHEL 8.4+ or 9+
# - annobin of GTS/DTS 11+
ANNOCHECK="${ANNOCHECK:-$(type -P annocheck)}"
ANNOCHECK_RPM_NAME=$(rpm --qf '%{name}' -qf $ANNOCHECK)
if [[ "$ANNOCHECK_RPM_NAME" == *toolset* ]]; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
elif rlIsRHEL '>9' || rlIsFedora; then
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}-plugin-gcc
else
ANNOBIN_RPM_NAME=${ANNOCHECK_RPM_NAME%-annocheck}
fi
PACKAGES="$ANNOCHECK_RPM_NAME $ANNOBIN_RPM_NAME"
rlJournalStart
rlPhaseStartSetup
rlMountRedhat
rlRun "yum -y install --skip-broken $PACKAGES" 0-255 # best effort
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "ANNOCHECK=$ANNOCHECK"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
# We optionally need to skip checking for the presence of the metapackage
# because that would pull in all the dependent toolset subrpms. We do not
# always want that, especially in CI.
_COLLECTIONS="$COLLECTIONS"
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
rlLogInfo "ignoring metapackage check for collection $c"
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
done
fi
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
rlAssertRpm --all
export COLLECTIONS="$_COLLECTIONS"
rlRun "TmpDir=\$(mktemp -d)"
rlRun "pushd $TmpDir"
rlRun "rpm -ql $PACKAGES >files"
while read i; do
[[ "$i" == */bin/* ]] && echo "${i##*/bin/}" >>commands.txt
[[ "$i" == */man1/* ]] && echo "$i" >>manfiles.txt
done <files
for i in $(<commands.txt); do rlLogInfo "command found: $i"; done
for i in $(<manfiles.txt); do rlLogInfo "man file found: $i"; done
rlPhaseEnd
rlPhaseStartTest MANPAGE_FOR_EACH_COMMAND
for i in $(<commands.txt); do
rlAssertGrep "/man1/$i\.1" manfiles.txt
done
rlPhaseEnd
rlPhaseStartTest MANPAGES_WORK
for i in $(<manfiles.txt); do
rlRun "man $i >dump.man"
if rlIsRHEL '<7'; then
rlRun 'col -b <dump.man >plaintext.man'
rlRun 'mv plaintext.man dump.man'
fi
rlAssertGrep DESCRIPTION dump.man
rlRun 'rm dump.man'
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

27
Sanity/smoke/main.fmf Normal file
View file

@ -0,0 +1,27 @@
summary: smoke test for annobin plugin
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- annobin
test: $WITH_SCL ./runtest.sh
framework: beakerlib
recommend:
# newer name of the plugin
- annobin-plugin-gcc
# older name of the plugin
- annobin
duration: 15m
enabled: true
tag:
- CI-Tier-1
- DTS9-INTEROP-CI
- NoRHEL4
- NoRHEL5
adjust:
- enabled: false
when: distro < rhel-6
continue: false
extra-nitrate: TC#0605363
extra-summary: /tools/annobin/Sanity/smoke
extra-task: /tools/annobin/Sanity/smoke
id: 53d76909-4863-4ce6-8e7b-5413b5faa6df

44
Sanity/smoke/runtest.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/annobin/Sanity/smoke
# Description: smoke test for annobin plugin
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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
PACKAGE="annobin"
rlJournalStart
rlPhaseStartSetup
rlRun "which gcc"
rlRun "man -w annobin"
rlRun "echo $X_SCLS"
rlPhaseEnd
rlPhaseStartTest
rlRun "echo 'int main() {return 0;}' | gcc -xc -fplugin=annobin -o /dev/null -"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd