From dc3264a1bc732e3ab96773d249cc8dcf77a77fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Wed, 19 May 2021 13:16:01 +0200 Subject: [PATCH] Import RHEL's regression test for #1360259 --- .../Makefile | 64 +++++++++++++++++ .../PURPOSE | 5 ++ .../main.fmf | 18 +++++ .../runtest.sh | 71 +++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/Makefile create mode 100644 tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/PURPOSE create mode 100644 tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/main.fmf create mode 100755 tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/runtest.sh diff --git a/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/Makefile b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/Makefile new file mode 100644 index 0000000..66c0e2e --- /dev/null +++ b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/PURPOSE b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/PURPOSE new file mode 100644 index 0000000..1ff38ce --- /dev/null +++ b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/PURPOSE @@ -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 +Bug summary: ltrace crashes when run on certain processes with the -S option +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1360259 diff --git a/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/main.fmf b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/main.fmf new file mode 100644 index 0000000..5be886c --- /dev/null +++ b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/main.fmf @@ -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 +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 diff --git a/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/runtest.sh b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/runtest.sh new file mode 100755 index 0000000..1ae4c93 --- /dev/null +++ b/tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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