Import RHEL's regression test for #1360259

This commit is contained in:
Václav Kadlčík 2021-05-19 13:16:01 +02:00
parent fa03fb9fb0
commit dc3264a1bc
4 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
# Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
# Author: Edjunior Machado <emachado@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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Edjunior Machado <emachado@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: ltrace" >> $(METADATA)
@echo "Requires: ltrace dbus" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1360259" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
Author: Edjunior Machado <emachado@redhat.com>
Bug summary: ltrace crashes when run on certain processes with the -S option
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1360259

View File

@ -0,0 +1,18 @@
summary: Test for BZ#1360259 (ltrace crashes when run on certain processes with the
-S option)
description: |
Bug summary: ltrace crashes when run on certain processes with the -S option
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1360259
contact: Edjunior Machado <emachado@redhat.com>
component:
- ltrace
test: ./runtest.sh
framework: beakerlib
recommend:
- ltrace
- dbus
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1360259
extra-summary: /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
extra-task: /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option

View File

@ -0,0 +1,71 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/ltrace/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option
# Description: Test for BZ#1360259 (ltrace crashes when run on certain processes with the -S option)
# Author: Edjunior Machado <emachado@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
CMD='ltrace'
BIN=$(which --skip-alias $CMD)
PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}"
if rlIsRHEL 9 || rlIsFedora; then
PROC_NAME=dbus-broker
SERVICE_NAME=dbus-broker
elif rlIsRHEL 6; then
PROC_NAME=dbus-daemon
SERVICE_NAME=messagebus
else
PROC_NAME=dbus-daemon
SERVICE_NAME=dbus
fi
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "pgrep $PROC_NAME || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "PID=$(pidof $PROC_NAME)"
# try to ltrace dbus-daemon. If there is a bug (BZ#1360259), it will crash
rlWatchdog "ltrace -S -p $PID > output.log 2>&1" 30 INT
rlAssertEquals "ltrace is expected to be terminated by watchdog" 1 "$?"
rlLog "output.log: $(cat output.log)"
rlAssertNotGrep "\(Assertion.*failed\|Segmentation fault\)" output.log
rlAssertEquals "$PROC_NAME is expected to be still running" $PID "$(pidof $PROC_NAME)"
rlFileSubmit output.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "service $SERVICE_NAME status --no-pager || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd