From fa03fb9fb0ee83df003f32e655bb39163b167b7e 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 01/44] Import RHEL's regression test for #1427140 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 5 ++ .../main.fmf | 27 ++++++++ .../runtest.sh | 55 ++++++++++++++++ 4 files changed, 151 insertions(+) create mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile create mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE create mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf create mode 100755 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile new file mode 100644 index 0000000..664b7c4 --- /dev/null +++ b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch +# Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 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/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 30m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace autoconf automake dejagnu elfutils-devel elfutils-libelf-devel libselinux-devel libtool scl-utils-build yum-utils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1427140" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE new file mode 100644 index 0000000..321dfcd --- /dev/null +++ b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch +Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) +Author: Michal Kolar +Bug summary: ltrace: ltrace-0.7.91-unwind-elfutils.patch modifies backup file created by previous patch +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf new file mode 100644 index 0000000..e8f7554 --- /dev/null +++ b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf @@ -0,0 +1,27 @@ +summary: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) +description: | + Bug summary: ltrace: ltrace-0.7.91-unwind-elfutils.patch modifies backup file created by previous patch + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 +contact: Michal Kolar +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- autoconf +- automake +- dejagnu +- elfutils-devel +- elfutils-libelf-devel +- libselinux-devel +- libtool +- scl-utils-build +- yum-utils +- koji +- rpm-build +duration: 30m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 +extra-summary: /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch +extra-task: /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh new file mode 100755 index 0000000..4f7fecc --- /dev/null +++ b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch +# Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 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)}" +export $PACKAGE + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "koji download-build --arch=src $(rpm -q $PACKAGE)" + rlRun "rpm --define='_topdir $TmpDir' -Uvh *src.rpm" + rlRun "dnf builddep -y SPECS/*.spec" + rlPhaseEnd + + rlPhaseStartTest + rlRun "rpmbuild -bp --define='_topdir $TmpDir' --define='_default_patch_flags -s --no-backup-if-mismatch' --quiet SPECS/*.spec" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd 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 02/44] 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 From cd59e55c7a893340174a308384eb29e6eef8deec 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 03/44] Import RHEL's regression test for #1053765 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 3 + .../main.fmf | 14 ++++ .../runtest.sh | 59 +++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 tests/Regression/bz1053765-invalid-command-assertion-failure/Makefile create mode 100644 tests/Regression/bz1053765-invalid-command-assertion-failure/PURPOSE create mode 100644 tests/Regression/bz1053765-invalid-command-assertion-failure/main.fmf create mode 100755 tests/Regression/bz1053765-invalid-command-assertion-failure/runtest.sh diff --git a/tests/Regression/bz1053765-invalid-command-assertion-failure/Makefile b/tests/Regression/bz1053765-invalid-command-assertion-failure/Makefile new file mode 100644 index 0000000..d6c30c0 --- /dev/null +++ b/tests/Regression/bz1053765-invalid-command-assertion-failure/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure +# Description: The test tries to ltrace a non-existing app, ltrace should handle that. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure +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: Michael Petlan " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: The test tries to ltrace a non-existing app, ltrace should handle that." >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1053765" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1053765-invalid-command-assertion-failure/PURPOSE b/tests/Regression/bz1053765-invalid-command-assertion-failure/PURPOSE new file mode 100644 index 0000000..9afbcc2 --- /dev/null +++ b/tests/Regression/bz1053765-invalid-command-assertion-failure/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure +Description: The test tries to ltrace a non-existing app, ltrace should handle that. +Author: Michael Petlan diff --git a/tests/Regression/bz1053765-invalid-command-assertion-failure/main.fmf b/tests/Regression/bz1053765-invalid-command-assertion-failure/main.fmf new file mode 100644 index 0000000..75b068c --- /dev/null +++ b/tests/Regression/bz1053765-invalid-command-assertion-failure/main.fmf @@ -0,0 +1,14 @@ +summary: The test tries to ltrace a non-existing app, ltrace should handle that. +description: '' +contact: Michael Petlan +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1053765 +extra-summary: /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure +extra-task: /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure diff --git a/tests/Regression/bz1053765-invalid-command-assertion-failure/runtest.sh b/tests/Regression/bz1053765-invalid-command-assertion-failure/runtest.sh new file mode 100755 index 0000000..1a18424 --- /dev/null +++ b/tests/Regression/bz1053765-invalid-command-assertion-failure/runtest.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz1053765-invalid-command-assertion-failure +# Description: The test tries to ltrace a non-existing app, ltrace should handle that. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlPhaseEnd + + rlPhaseStartTest + rlRun "{ ltrace blahblahblah0123546213208412321 2> err.log > out.log; } 2> superr.log" 1 "Running ltrace with a non-existing binary." + rlAssertNotGrep "Aborted" superr.log + rlAssertNotGrep "destroy" err.log + rlAssertNotGrep "Assertion" err.log + rlAssertNotGrep "assertion" err.log + rlAssertNotGrep "relocs" err.log + rlAssertNotGrep "failed" err.log + echo "==== stderr ====" + cat err.log + echo "==== stdout ====" + cat out.log + echo "==== external stderr ====" + cat superr.log + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm err.log out.log superr.log" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From 4d182004cfcceca8d5f55d3cc9fcf0d76eed21ca 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 04/44] Import RHEL's regression test for #1051221 --- .../Makefile | 64 ++++++++++++++++ .../PURPOSE | 3 + .../hello.c | 7 ++ .../main.fmf | 17 +++++ .../runtest.sh | 74 +++++++++++++++++++ 5 files changed, 165 insertions(+) create mode 100644 tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/Makefile create mode 100644 tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/PURPOSE create mode 100644 tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/hello.c create mode 100644 tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/main.fmf create mode 100755 tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/runtest.sh diff --git a/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/Makefile b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/Makefile new file mode 100644 index 0000000..eca6d5f --- /dev/null +++ b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 +# Description: The test tries to workaround of a bz1051221 a little. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE hello.c + +.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: Michael Petlan " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: The test tries to workaround of a bz1051221 a little." >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace prelink binutils gcc" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1051221" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/PURPOSE b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/PURPOSE new file mode 100644 index 0000000..94c033b --- /dev/null +++ b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 +Description: The test tries to workaround of a bz1051221 a little. +Author: Michael Petlan diff --git a/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/hello.c b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/hello.c new file mode 100644 index 0000000..b3c185b --- /dev/null +++ b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/hello.c @@ -0,0 +1,7 @@ +#include +#include + +int main(void) +{ + puts("Hello world...\n"); +} diff --git a/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/main.fmf b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/main.fmf new file mode 100644 index 0000000..f91b6d4 --- /dev/null +++ b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/main.fmf @@ -0,0 +1,17 @@ +summary: The test tries to workaround of a bz1051221 a little. +description: '' +contact: Michael Petlan +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- prelink +- binutils +- gcc +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1051221 +extra-summary: /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 +extra-task: /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 diff --git a/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/runtest.sh b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/runtest.sh new file mode 100755 index 0000000..6caa6f8 --- /dev/null +++ b/tests/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64/runtest.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz1051221-untraced-symbols-cause-sigsegv-ppc64 +# Description: The test tries to workaround of a bz1051221 a little. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="ltrace" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp hello.c $TmpDir/" + rlRun "pushd $TmpDir" + rlRun "gcc -o hello-raw hello.c" + rlRun "cp hello-raw hello-stripped" + rlRun "strip ./hello-stripped" + if rpm -q prelink; then + rlRun "cp hello-raw hello-prelinked" + rlRun "cp hello-raw hello-stripped-prelinked" + rlRun "cp hello-raw hello-prelinked-stripped" + rlRun "prelink ./hello-prelinked" + rlRun "strip ./hello-stripped-prelinked" + rlRun "prelink hello-stripped-prelinked" + rlRun "prelink hello-prelinked-stripped" + rlRun "strip hello-prelinked-stripped" + fi + rlPhaseEnd + + rlPhaseStartTest + for binary in hello-*; do + rlLog "==== TESTING $binary ====" + rlRun "{ ltrace -e __libc_start_main ./$binary 2> err_$binary.log > out_$binary.log; } 2> superr_$binary.log" + rlAssertNotGrep "Aborted" superr_$binary.log + rlAssertNotGrep "SIGSEGV" superr_$binary.log + rlAssertNotGrep "Segmentation fault" superr_$binary.log + rlAssertNotGrep "killed" err_$binary.log + rlAssertNotGrep "SIGSEGV" err_$binary.log + rlAssertNotGrep "Segmentation fault" err_$binary.log + rlLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" + done + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From b190a780c0cad4497189e4a7cffcc67f1c339a2c 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 05/44] Import RHEL's regression test for #890961 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 5 ++ .../ksh_bug.ksh | 8 +++ .../main.fmf | 18 ++++++ .../runtest.sh | 58 +++++++++++++++++ 5 files changed, 153 insertions(+) create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh create mode 100644 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf create mode 100755 tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile new file mode 100644 index 0000000..5e95fda --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE ksh_bug.ksh + +.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: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace ksh ltrace-debuginfo" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 890961" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE new file mode 100644 index 0000000..d1ca455 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +Author: Miroslav Franc +Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free() +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961 diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh new file mode 100644 index 0000000..09f2bf7 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/ksh_bug.ksh @@ -0,0 +1,8 @@ +#!/usr/bin/env ksh +# from bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=890961 + +echo "Before processing a subshell" + +NUMFILES=$(ls | wc -l) + +echo "After processing a subshell" diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf new file mode 100644 index 0000000..4e0962f --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/main.fmf @@ -0,0 +1,18 @@ +summary: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +description: | + Bug summary: [RHEL 5] ltrace crashes with memory corruption due to double free() + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=890961 +contact: Miroslav Franc +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- ksh +- ltrace-debuginfo +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=890961 +extra-summary: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +extra-task: /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due diff --git a/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh new file mode 100755 index 0000000..5cc8819 --- /dev/null +++ b/tests/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due/runtest.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz890961-RHEL-5-ltrace-crashes-with-memory-corruption-due +# Description: Test for BZ#890961 ([RHEL 5] ltrace crashes with memory corruption due) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm ksh + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp ksh_bug.ksh $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + for ((i=0; i<10; ++i)); do + rlPhaseStartTest "test... $i" + rlRun "LIBC_FATAL_STDERR_=1 ltrace -f -o ./ltrace.out ksh ./ksh_bug.ksh 2> log.err > log.out" + rlAssertNotGrep 'glibc detected' log.err + rlRun "[[ $(wc -l Date: Wed, 19 May 2021 13:16:01 +0200 Subject: [PATCH 06/44] Import RHEL's regression test for #868281 --- .../Makefile | 67 +++++++++++ .../PURPOSE | 5 + .../main.fmf | 23 ++++ .../runtest.sh | 113 ++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile create mode 100644 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/PURPOSE create mode 100644 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf create mode 100755 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile new file mode 100644 index 0000000..4f22633 --- /dev/null +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile @@ -0,0 +1,67 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries +# Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries +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: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace gcc" >> $(METADATA) + @echo "Requires: libgcc.i686 glibc-devel.i686" >> $(METADATA) # 32-bit + @echo "Requires: libgcc.ppc64 glibc-devel.ppc64" >> $(METADATA) # 32-bit + @echo "Requires: libgcc.s390 glibc-devel.s390" >> $(METADATA) # 32-bit + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 868281" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/PURPOSE b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/PURPOSE new file mode 100644 index 0000000..6f46d12 --- /dev/null +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries +Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries) +Author: Miroslav Franc +Bug summary: ltrace doesn't work on PIE binaries +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=868281 diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf new file mode 100644 index 0000000..a78d993 --- /dev/null +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf @@ -0,0 +1,23 @@ +summary: Test for BZ#868281 (ltrace doesn't work on PIE binaries) +description: | + Bug summary: ltrace doesn't work on PIE binaries + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=868281 +contact: Miroslav Franc +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- libgcc.i686 +- glibc-devel.i686 +- libgcc.ppc64 +- glibc-devel.ppc64 +- libgcc.s390 +- glibc-devel.s390 +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=868281 +extra-summary: /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries +extra-task: /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh new file mode 100755 index 0000000..714dfc4 --- /dev/null +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries +# Description: Test for BZ#868281 (ltrace doesn't work on PIE binaries) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +LTRACE_RPM=$(rpm -qf `which ltrace`) +GCC="${GCC:-$(which gcc)}" +GCC_RPM=$(rpm -qf $GCC) +BINUTILS_RPM=$(rpm -qf `which ld`) + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $LTRACE_RPM + rlAssertRpm $GCC_RPM + rlAssertRpm $BINUTILS_RPM + for arch in $(rlGetPrimaryArch) $(rlGetSecondaryArch); do + rlCheckRpm glibc.$arch + done + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + + if [ -d /usr/lib64 ]; then + ARCH=`uname -i` + if [[ $ARCH =~ s390.* ]]; then + if rlIsRHEL '>=8'; then + rlLogInfo "RHEL-8 and newer do not support s390x 31-bit compilation" + MBITS= + else + MBITS=31 + if [[ "$LTRACE_RPM" =~ devtoolset-(9|10) ]] ; then + rlLogInfo "devtoolset-(9|10)-gcc do not support s390, hence using base gcc" + rlRun "GCC=/usr/bin/gcc" + rlAssertRpm $(rpm -qf $GCC) + fi + fi + elif [[ $ARCH =~ ia64|aarch64|ppc64le ]]; then + rlLogInfo "$ARCH does not support 32-bit compilation" + MBITS= + else + MBITS=32 + fi + fi + + rlLogInfo "MBITS=$MBITS" + + rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -x c -o a-native.out -" + rlAssertExists a-native.out + + if [ -n "$MBITS" ]; then + rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -m$MBITS -x c -o a-$MBITS.out -" + rlAssertExists a-$MBITS.out + fi + rlPhaseEnd + + rlPhaseStartTest "Native binary testing" + rlRun "ltrace ./a-native.out > log 2>&1" + LIBC_START_MAIN=true + if [[ "$ARCH" = "x86_64" ]]; then + if rlIsRHEL '>=8' || rlIsFedora; then + rlLogInfo "x86_64: Since RHEL-8 __libc_start_main has been optimized into non-PLT call, no longer ltraced (bz#1654734)" + LIBC_START_MAIN=false + fi + fi + if $LIBC_START_MAIN; then + rlAssertGrep "__libc_start_main" log + fi + rlAssertGrep "alarm(42)" log + rlAssertGrep "exited (status 0)" log + rlLog "log file:\n$(cat log)" + rlPhaseEnd + + if [ -n "$MBITS" ]; then + rlPhaseStartTest "$MBITS bit binary testing" + rlRun "ltrace ./a-$MBITS.out > log-$MBITS 2>&1" + rlAssertGrep "__libc_start_main" log-$MBITS + rlAssertGrep "alarm(42)" log-$MBITS + rlAssertGrep "exited (status 0)" log-$MBITS + rlLog "log file:\n$(cat log-$MBITS)" + rlPhaseEnd + fi + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From f2f13e861b57fa85edfaa6041a221b581f406595 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 07/44] Import RHEL's regression test for #797761 --- .../Makefile | 65 +++++++++++++++++ .../PURPOSE | 3 + .../main.fmf | 15 ++++ .../runtest.sh | 69 +++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 tests/Regression/bz797761-ltrace-c-ommits-execl-call/Makefile create mode 100644 tests/Regression/bz797761-ltrace-c-ommits-execl-call/PURPOSE create mode 100644 tests/Regression/bz797761-ltrace-c-ommits-execl-call/main.fmf create mode 100755 tests/Regression/bz797761-ltrace-c-ommits-execl-call/runtest.sh diff --git a/tests/Regression/bz797761-ltrace-c-ommits-execl-call/Makefile b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/Makefile new file mode 100644 index 0000000..e202e57 --- /dev/null +++ b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/Makefile @@ -0,0 +1,65 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call +# Description: The test tries to ltrace an app which uses execl calls. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call +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: Michael Petlan " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: The test tries to ltrace an app which uses execl calls." >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Requires: glibc-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 797761" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz797761-ltrace-c-ommits-execl-call/PURPOSE b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/PURPOSE new file mode 100644 index 0000000..c9adac9 --- /dev/null +++ b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call +Description: The test tries to ltrace an app which uses execl calls. +Author: Michael Petlan diff --git a/tests/Regression/bz797761-ltrace-c-ommits-execl-call/main.fmf b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/main.fmf new file mode 100644 index 0000000..2617dea --- /dev/null +++ b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/main.fmf @@ -0,0 +1,15 @@ +summary: The test tries to ltrace an app which uses execl calls. +description: '' +contact: Michael Petlan +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- glibc-devel +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=797761 +extra-summary: /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call +extra-task: /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call diff --git a/tests/Regression/bz797761-ltrace-c-ommits-execl-call/runtest.sh b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/runtest.sh new file mode 100755 index 0000000..6fffcb4 --- /dev/null +++ b/tests/Regression/bz797761-ltrace-c-ommits-execl-call/runtest.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz797761-ltrace-c-ommits-execl-call +# Description: The test tries to ltrace an app which uses execl calls. +# Author: Michael Petlan +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="ltrace" + +create_reproducer() +{ +cat < reproducer.c +#include +#include +int main () +{ + execl("/bin/ls","ls",0); + return 0; +} +EOF +} + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + create_reproducer + rlRun "gcc -o reproducer reproducer.c" + rlPhaseEnd + + rlPhaseStartTest + # The main purpose of this section is to check if the file ltrace-c.log contains the 'exec' substring. + rlRun "ltrace ./reproducer 2>&1 >/dev/null | tee ltrace.log" + rlRun "ltrace -c ./reproducer 2>&1 >/dev/null | tee ltrace-c.log" + rlAssertGrep "exec" ltrace.log + rlAssertGrep "exec" ltrace-c.log + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From d7b87c04312d8d989e3213d6facd4f9d205bb850 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 08/44] Import RHEL's regression test for #754096 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 5 ++ .../main.fmf | 16 +++++ .../runtest.sh | 52 +++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/Makefile create mode 100644 tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/PURPOSE create mode 100644 tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/main.fmf create mode 100755 tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/runtest.sh diff --git a/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/Makefile b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/Makefile new file mode 100644 index 0000000..9960d98 --- /dev/null +++ b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by +# Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by +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: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 2m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 754096" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/PURPOSE b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/PURPOSE new file mode 100644 index 0000000..8953b3d --- /dev/null +++ b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by +Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by) +Author: Miroslav Franc +Bug summary: ltrace crashes on PowerPC if tracing is limited by `-e' to event not present in trace +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=754096 diff --git a/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/main.fmf b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/main.fmf new file mode 100644 index 0000000..3c01c00 --- /dev/null +++ b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by) +description: | + Bug summary: ltrace crashes on PowerPC if tracing is limited by `-e' to event not present in trace + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=754096 +contact: Miroslav Franc +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +duration: 2m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=754096 +extra-summary: /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by +extra-task: /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by diff --git a/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/runtest.sh b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/runtest.sh new file mode 100755 index 0000000..d59239d --- /dev/null +++ b/tests/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by/runtest.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz754096-ltrace-crashes-on-PowerPC-if-tracing-is-limited-by +# Description: Test for BZ#754096 (ltrace crashes on PowerPC if tracing is limited by) +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "ltrace -e puts /bin/true" + rlRun "ltrace -e sprintf /bin/true" + rlRun "ltrace -e puts -e gets /bin/true" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From ec8db7cf57c9ad64879cd8d6424c65b0d1f6e94d 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 09/44] Import RHEL's regression test for #447404 --- .../Makefile | 60 ++++++++++ .../PURPOSE | 4 + .../main.fmf | 18 +++ .../runtest.sh | 103 ++++++++++++++++++ 4 files changed, 185 insertions(+) create mode 100644 tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile create mode 100644 tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/PURPOSE create mode 100644 tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/main.fmf create mode 100755 tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile new file mode 100644 index 0000000..4b68558 --- /dev/null +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile @@ -0,0 +1,60 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +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) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: When executing ltrace command with both -o and -c option, the result of ltrace command is not output into file" >> $(METADATA) + @echo "Bug: 447404" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME) gcc" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/PURPOSE b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/PURPOSE new file mode 100644 index 0000000..0cd29d1 --- /dev/null +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/PURPOSE @@ -0,0 +1,4 @@ +When executing ltrace command with both -o and -c option, +the result of ltrace command is not output into the file +which is specified by -o option. + diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/main.fmf b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/main.fmf new file mode 100644 index 0000000..6357723 --- /dev/null +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/main.fmf @@ -0,0 +1,18 @@ +summary: When executing ltrace command with both -o and -c option, the result of ltrace + command is not output into file +description: "When executing ltrace command with both -o and -c option, \nthe result\ + \ of ltrace command is not output into the file \nwhich is specified by -o option.\n\ + \n" +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=447404 +extra-summary: /tools/ltrace/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file +extra-task: /tools/ltrace/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh new file mode 100755 index 0000000..77fbfef --- /dev/null +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf --queryformat '%{name}' $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlShowRunningKernel + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest "ltrace with -o and -c options tracing testing binary" + rlRun "echo 'int main(){alarm(42);return 0;}'| gcc -x c -o test.bin -" + rlRun "ltrace -o ltrace-test.log -c ./test.bin" 0 "ltrace is crunching a testing binary" + rlRun -l "cat ltrace-test.log" + rlAssertGrep "alarm" ltrace-test.log + rlAssertGreater "There has to be something in output file" $(cat ltrace-test.log | wc -l) 5 + rlPhaseEnd + + rlPhaseStartTest "ltrace with -o and -c options tracing system binary" + rlRun "ltrace -o ltrace-test-sys.log -c ls" 0 "ltrace is crunching ls" + rlRun -l "cat ltrace-test-sys.log" + if rlIsRHEL 8; then + case "$PACKAGE" in + "ltrace") + # bz#1655368 was fixed on ltrace-0.7.91-28.el8.x86_64, but it is still reproducible on ppc64le + if [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL8 ltrace fails to trace system binaries on ppc64le due to bz#1618748/bz#1655368, hence skipping failure checking" + skip_system_binary_test=1 + fi + ;; + "gcc-toolset-9-ltrace" | "gcc-toolset-10-ltrace") + if [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL8 gcc-toolset-9-ltrace/gcc-toolset-10-ltrace fails to trace system binaries on ppc64le due to bz#1731119, hence skipping failure checking" + skip_system_binary_test=1 + fi + ;; + esac + elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" + skip_system_binary_test=1 + elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking" + skip_system_binary_test=1 + fi + + # ltrace no longer reports __libc_start_main on rhel-8 x86_64 (rhbz#1654734) + if grep "ioctl" ltrace-test-sys.log; then + if [ $skip_system_binary_test ]; then + rlLogWarning "Test was skipped but it seems ok. Review skip check." + fi + else + if [ $skip_system_binary_test ]; then + rlLogInfo "ltrace output does not contain ioctl calls (expected failure)" + else + rlFail "ltrace output does not contain ioctl calls" + fi + fi + + rlRun "n_lines=$(grep -c . ltrace-test-sys.log)" + if [ $n_lines -gt 10 ]; then + if [ $skip_system_binary_test ]; then + rlLogWarning "Test was skipped but it seems ok. Review skip check." + fi + else + if [ $skip_system_binary_test ]; then + rlLogInfo "ltrace output does not contain more than 10 lines (expected failure)" + else + rlFail "ltrace output does not contain more than 10 lines" + fi + fi + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rlFileSubmit ltrace-test.log + rlFileSubmit ltrace-test-sys.log + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From 644de0d37c2a18e620ec1045d68e846440484484 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:02 +0200 Subject: [PATCH 10/44] Import RHEL's regression test for #427444 --- .../Makefile | 62 +++++++++++++++++ .../PURPOSE | 1 + .../main.fmf | 17 +++++ .../reproducer.c | 69 +++++++++++++++++++ .../runtest.sh | 46 +++++++++++++ 5 files changed, 195 insertions(+) create mode 100644 tests/Regression/427444-ltrace-crashes-process-to-be-analysed/Makefile create mode 100644 tests/Regression/427444-ltrace-crashes-process-to-be-analysed/PURPOSE create mode 100644 tests/Regression/427444-ltrace-crashes-process-to-be-analysed/main.fmf create mode 100644 tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c create mode 100755 tests/Regression/427444-ltrace-crashes-process-to-be-analysed/runtest.sh diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/Makefile b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/Makefile new file mode 100644 index 0000000..b3b39d4 --- /dev/null +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/Makefile @@ -0,0 +1,62 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/427444-ltrace-crashes-process-to-be-analysed + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: ltrace crashes process to be analysed" >> $(METADATA) + @echo "Bug: 427444" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: gcc" >> $(METADATA) + @echo "Requires: glibc-devel" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/PURPOSE b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/PURPOSE new file mode 100644 index 0000000..3d0230b --- /dev/null +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/PURPOSE @@ -0,0 +1 @@ +ltrace could possibly crash traced application on s390 and s390x. diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/main.fmf b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/main.fmf new file mode 100644 index 0000000..6430ffa --- /dev/null +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/main.fmf @@ -0,0 +1,17 @@ +summary: ltrace crashes process to be analysed +description: | + ltrace could possibly crash traced application on s390 and s390x. +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- glibc-devel +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=427444 +extra-summary: /tools/ltrace/Regression/427444-ltrace-crashes-process-to-be-analysed +extra-task: /tools/ltrace/Regression/427444-ltrace-crashes-process-to-be-analysed diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c new file mode 100644 index 0000000..d0ccb5d --- /dev/null +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include + + +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif // NI_MAX_HOST + +// On a DARWIN system EAI_OVERFLOW is define as EAI_MAX +#ifndef EAI_OVERFLOW +#define EAI_OVERFLOW EAI_MAX +#endif // EAI_OVERFLOW + +int main(int argc, char *argv[]) +{ +// sleep before we can catch you via ltrace + sleep(5); + struct addrinfo * result; + + size_t hostname_len = NI_MAXHOST; + char * hostname = NULL; + + int error; + + if ( 0 != ( error = getaddrinfo( "www.example.com", NULL, NULL, &result ) ) ) + { + fprintf( stderr, "error using getaddrinfo: %s\n", gai_strerror( error ) ); + } + + if ( result ) + { + for( ; ; hostname_len *= 2 ) + { + hostname = ( char * ) realloc( hostname, hostname_len ); + + if ( NULL == hostname ) + { + perror( "" ); + break; + } + + error = getnameinfo( result->ai_addr, result->ai_addrlen, hostname, hostname_len, NULL, 0, 0 ); + + if ( 0 == error ) + { + break; + } + + if ( EAI_OVERFLOW != error ) + { + fprintf( stderr, "error using getaddrinfo: %s\n", gai_strerror( error ) ); + break; + } + } + + if ( NULL != hostname ) + { + free( hostname ); + } + + freeaddrinfo( result ); + } + + return 0; +} + diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/runtest.sh b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/runtest.sh new file mode 100755 index 0000000..d945edc --- /dev/null +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/runtest.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/bin/rhts_environment.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup "Gathering information & compiling" + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlShowRunningKernel + + rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer" + rlPhaseEnd + + rlPhaseStartTest "Testing the executable under ltrace" + rlRun "./reproducer &" 0 "Fire the reproducer in the background" + rlWatchdog "ltrace -o ltrace-test.log -p $( pgrep reproducer )" 200 + rlAssertNotGrep "gimme_arg called with wrong arguments" ltrace-test.log + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rlBundleLogs "ltrace-outputs" ltrace-test.log + rlRun "rm -f ltrace-test.log reproducer" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From 724196798c3bfef09e58d478ace94929afa7009d 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:02 +0200 Subject: [PATCH 11/44] Import RHEL's regression test for #235671 --- .../Makefile | 60 +++++++++++++++++++ .../PURPOSE | 2 + .../main.fmf | 16 +++++ .../runtest.sh | 43 +++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 tests/Regression/235671-ltrace-receives-SIGILL-signal/Makefile create mode 100644 tests/Regression/235671-ltrace-receives-SIGILL-signal/PURPOSE create mode 100644 tests/Regression/235671-ltrace-receives-SIGILL-signal/main.fmf create mode 100755 tests/Regression/235671-ltrace-receives-SIGILL-signal/runtest.sh diff --git a/tests/Regression/235671-ltrace-receives-SIGILL-signal/Makefile b/tests/Regression/235671-ltrace-receives-SIGILL-signal/Makefile new file mode 100644 index 0000000..baafe0e --- /dev/null +++ b/tests/Regression/235671-ltrace-receives-SIGILL-signal/Makefile @@ -0,0 +1,60 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/235671-ltrace-receives-SIGILL-signal + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +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) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: ltrace receives SIGILL signal and terminates" >> $(METADATA) + @echo "Bug: 235671" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/Regression/235671-ltrace-receives-SIGILL-signal/PURPOSE b/tests/Regression/235671-ltrace-receives-SIGILL-signal/PURPOSE new file mode 100644 index 0000000..e727338 --- /dev/null +++ b/tests/Regression/235671-ltrace-receives-SIGILL-signal/PURPOSE @@ -0,0 +1,2 @@ +ltrace receives SIGILL signal instead of the ltraced program, +which terminates ltrace. diff --git a/tests/Regression/235671-ltrace-receives-SIGILL-signal/main.fmf b/tests/Regression/235671-ltrace-receives-SIGILL-signal/main.fmf new file mode 100644 index 0000000..f1ba1aa --- /dev/null +++ b/tests/Regression/235671-ltrace-receives-SIGILL-signal/main.fmf @@ -0,0 +1,16 @@ +summary: ltrace receives SIGILL signal and terminates +description: | + ltrace receives SIGILL signal instead of the ltraced program, + which terminates ltrace. +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=235671 +extra-summary: /tools/ltrace/Regression/235671-ltrace-receives-SIGILL-signal +extra-task: /tools/ltrace/Regression/235671-ltrace-receives-SIGILL-signal diff --git a/tests/Regression/235671-ltrace-receives-SIGILL-signal/runtest.sh b/tests/Regression/235671-ltrace-receives-SIGILL-signal/runtest.sh new file mode 100755 index 0000000..8682bb6 --- /dev/null +++ b/tests/Regression/235671-ltrace-receives-SIGILL-signal/runtest.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/bin/rhts_environment.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup "Gathering information" + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlShowRunningKernel + rlPhaseEnd + + rlPhaseStartTest "Running tar inside ltrace" + rlRun "ltrace -o ltrace-test.log tar" 0 "ltrace is crunching tar" + rlAssertNotGrep "SIGILL" ltrace-test.log -A1 + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rlBundleLogs "ltrace-outputs" ltrace-test.log + rlRun "rm -f ltrace-test.log" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From 6dd7382d3cc24ec3d122e3c6db187e7115b10657 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:02 +0200 Subject: [PATCH 12/44] Import RHEL's regression test for #223732 --- .../223732-man-page-of-ltrace/Makefile | 60 +++++++++++++++++++ .../223732-man-page-of-ltrace/PURPOSE | 7 +++ .../223732-man-page-of-ltrace/main.fmf | 21 +++++++ .../223732-man-page-of-ltrace/runtest.sh | 41 +++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 tests/Regression/223732-man-page-of-ltrace/Makefile create mode 100644 tests/Regression/223732-man-page-of-ltrace/PURPOSE create mode 100644 tests/Regression/223732-man-page-of-ltrace/main.fmf create mode 100755 tests/Regression/223732-man-page-of-ltrace/runtest.sh diff --git a/tests/Regression/223732-man-page-of-ltrace/Makefile b/tests/Regression/223732-man-page-of-ltrace/Makefile new file mode 100644 index 0000000..c303f27 --- /dev/null +++ b/tests/Regression/223732-man-page-of-ltrace/Makefile @@ -0,0 +1,60 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/223732-man-page-of-ltrace + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +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) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: man page of ltrace had a note about ELF32-support-only" >> $(METADATA) + @echo "Bug: 223732" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/Regression/223732-man-page-of-ltrace/PURPOSE b/tests/Regression/223732-man-page-of-ltrace/PURPOSE new file mode 100644 index 0000000..8f8da66 --- /dev/null +++ b/tests/Regression/223732-man-page-of-ltrace/PURPOSE @@ -0,0 +1,7 @@ +Man page of ltrace said, +'Only ELF32 binaries are supported.' + +I seemed ltrace does not support ia64 architecture. + +That's not true. + diff --git a/tests/Regression/223732-man-page-of-ltrace/main.fmf b/tests/Regression/223732-man-page-of-ltrace/main.fmf new file mode 100644 index 0000000..ef24105 --- /dev/null +++ b/tests/Regression/223732-man-page-of-ltrace/main.fmf @@ -0,0 +1,21 @@ +summary: man page of ltrace had a note about ELF32-support-only +description: |+ + Man page of ltrace said, + 'Only ELF32 binaries are supported.' + + I seemed ltrace does not support ia64 architecture. + + That's not true. + +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=223732 +extra-summary: /tools/ltrace/Regression/223732-man-page-of-ltrace +extra-task: /tools/ltrace/Regression/223732-man-page-of-ltrace diff --git a/tests/Regression/223732-man-page-of-ltrace/runtest.sh b/tests/Regression/223732-man-page-of-ltrace/runtest.sh new file mode 100755 index 0000000..3f794dc --- /dev/null +++ b/tests/Regression/223732-man-page-of-ltrace/runtest.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/bin/rhts_environment.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE=ltrace + +rlJournalStart + rlPhaseStartSetup "Gathering information" + rlShowPackageVersion $PACKAGE + rlShowRunningKernel + rlPhaseEnd + + rlPhaseStartTest "Running tar inside ltrace" + man ltrace > trace.man + rlAssertNotGrep "Only ELF32 binaries are supported" trace.man + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rm -f trace.man + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From 6c7c2d2b361fe8bf8120d20ec2d588ada36695fb 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:02 +0200 Subject: [PATCH 13/44] Import RHEL's regression test for #211163 --- .../Makefile | 61 ++++++++++ .../PURPOSE | 1 + .../main.fmf | 17 +++ .../reproducer.c | 9 ++ .../runtest.sh | 109 ++++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 tests/Regression/211163-ltrace-with--c-omit-execl-call/Makefile create mode 100644 tests/Regression/211163-ltrace-with--c-omit-execl-call/PURPOSE create mode 100644 tests/Regression/211163-ltrace-with--c-omit-execl-call/main.fmf create mode 100644 tests/Regression/211163-ltrace-with--c-omit-execl-call/reproducer.c create mode 100755 tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/Makefile b/tests/Regression/211163-ltrace-with--c-omit-execl-call/Makefile new file mode 100644 index 0000000..30571dd --- /dev/null +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/Makefile @@ -0,0 +1,61 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/211163-ltrace-with--c-omit-execl-call + +export TEST=/tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: ltrace with -c omit execl call" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace gcc glibc-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 211163 528466" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/PURPOSE b/tests/Regression/211163-ltrace-with--c-omit-execl-call/PURPOSE new file mode 100644 index 0000000..4dd4371 --- /dev/null +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/PURPOSE @@ -0,0 +1 @@ +ltrace with -c omit execl call diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/main.fmf b/tests/Regression/211163-ltrace-with--c-omit-execl-call/main.fmf new file mode 100644 index 0000000..aa6cfa6 --- /dev/null +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/main.fmf @@ -0,0 +1,17 @@ +summary: ltrace with -c omit execl call +description: | + ltrace with -c omit execl call +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- glibc-devel +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=211163 +extra-summary: /tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call +extra-task: /tools/ltrace/Regression/211163-ltrace-with--c-omit-execl-call diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/reproducer.c b/tests/Regression/211163-ltrace-with--c-omit-execl-call/reproducer.c new file mode 100644 index 0000000..7a7847e --- /dev/null +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/reproducer.c @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + execl("/bin/ls","ls",0); + return 0; +} + diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh b/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh new file mode 100755 index 0000000..68b0814 --- /dev/null +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh @@ -0,0 +1,109 @@ +#!/bin/bash + +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/bin/rhts_environment.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE=$(rpm -qf $(which ltrace)) + +rlJournalStart + rlPhaseStartSetup "Gathering information & compiling" + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlShowRunningKernel + + rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer" + rlPhaseEnd + + rlPhaseStartTest "Counting the number of calls noted by ltrace" + rlRun "ltrace -o ltrace-test-c.log -c ./reproducer" 0 "Execute reproducer" + rlRun "cat -n ltrace-test-c.log" + # Check if exec is not omitted (rhbz#797761) + rlAssertGrep "exec" ltrace-test-c.log + + # Check if ltrace is able to trace system binaries with execl /bin/ls (rhbz#1618748/rhbz#1655368/rhbz#1731119) + if rlIsRHEL 8; then + case "$PACKAGE" in + ltrace*) + # bz#1655368 was fixed on ltrace-0.7.91-28.el8.x86_64, but it is still reproducible on ppc64le + if [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL8 ltrace fails to trace system binaries on ppc64le due to bz#1618748/bz#1655368, hence skipping failure checking" + skip_test=1 + fi + ;; + gcc-toolset-*) + if [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL8 gcc-toolset-*-ltrace fails to trace system binaries on ppc64le due to bz#1731119, hence skipping failure checking" + skip_test=1 + fi + ;; + esac + elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" + skip_test=1 + elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking" + skip_test=1 + fi + + rlRun "n_lines_c=$(grep -c . ltrace-test-c.log)" + if [ $n_lines_c -gt 20 ]; then + if [ $skip_test ]; then + rlLogWarning "Test was skipped but it seems ok. Review skip check." + fi + else + if [ $skip_test ]; then + rlLogInfo"'ltrace -c ./reproducer' does not report more than 20 lines of trace summary output (expected failure)" + else + rlFail "'ltrace -c ./reproducer' does not report more than 20 lines of trace summary output" + fi + fi + rlPhaseEnd + + rlPhaseStartTest "Looking for SEGFAULT of reproducer under ltrace" + rlRun "ltrace -o ltrace-test.log ./reproducer" 0 "Execute reproducer" + rlRun "cat -n ltrace-test.log" + # Check if neither segfault nor 'unexpected breakpoint' errors occur (rhbz#211163) + rlAssertNotGrep "SIGSEGV" ltrace-test.log + rlAssertNotGrep "unexpected breakpoint" ltrace-test.log + # Check if exec is not omitted (rhbz#797761) + rlAssertGrep "exec" ltrace-test.log + + # Check if ltrace is able to trace system binaries with execl /bin/ls (rhbz#1618748/rhbz#1655368/rhbz#1731119) + rlRun "n_lines=$(grep -c . ltrace-test.log)" + if [ $n_lines -gt 20 ]; then + if [ $skip_test ]; then + rlLogWarning "Test was skipped but it seems ok. Review skip check." + fi + else + if [ $skip_test ]; then + rlLogInfo"'ltrace ./reproducer' does not report more than 20 lines of trace summary output (expected failure)" + else + rlFail "'ltrace ./reproducer' does not report more than 20 lines of trace summary output" + fi + fi + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rlBundleLogs "ltrace-outputs" ltrace-test.log ltrace-test-c.log + rlRun "rm -f ltrace-test.log ltrace-test-c.log reproducer" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From 9af7a027b204184dd0c7f5f8403dd37b3eec18a1 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:02 +0200 Subject: [PATCH 14/44] Import RHEL's regression test for #211135 --- .../Makefile | 61 +++++++++++++++++++ .../PURPOSE | 2 + .../main.fmf | 17 ++++++ .../reproducer.c | 31 ++++++++++ .../runtest.sh | 49 +++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/Makefile create mode 100644 tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/PURPOSE create mode 100644 tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/main.fmf create mode 100644 tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c create mode 100755 tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/runtest.sh diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/Makefile b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/Makefile new file mode 100644 index 0000000..67183de --- /dev/null +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/Makefile @@ -0,0 +1,61 @@ +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + + +TOPLEVEL_NAMESPACE=/tools +PACKAGE_NAME=ltrace +RELATIVE_PATH=Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + + +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: ltrace hangs while tracing child process with -f option" >> $(METADATA) + @echo "Bug: 211135" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: glibc-devel" >> $(METADATA) + @echo "License: GPLv3+" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/PURPOSE b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/PURPOSE new file mode 100644 index 0000000..2c9e3fd --- /dev/null +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/PURPOSE @@ -0,0 +1,2 @@ +ltrace could possibly crash/hang when tracing fork() on ppc/ppc64 +in ltrace with option "-f". diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/main.fmf b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/main.fmf new file mode 100644 index 0000000..f0627ff --- /dev/null +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/main.fmf @@ -0,0 +1,17 @@ +summary: ltrace hangs while tracing child process with -f option +description: | + ltrace could possibly crash/hang when tracing fork() on ppc/ppc64 + in ltrace with option "-f". +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- glibc-devel +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=211135 +extra-summary: /tools/ltrace/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option +extra-task: /tools/ltrace/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c new file mode 100644 index 0000000..1d11ad6 --- /dev/null +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c @@ -0,0 +1,31 @@ +/* Ltrace Test : trace-fork.c + * Objectives : Verify that ltrace can trace to child process after + * fork called. + * + * This file was written by Yao Qi + * + */ + +#include +#include + +void child() { + printf("Fork Child\n"); + sleep(1); +} + +int main() { + pid_t pid; + pid = fork (); + + if (pid == -1) + printf("fork failed!\n"); + else if (pid == 0) + child(); + else { + printf("My child pid is %d\n",pid); + wait(); + } + return 0; +} + diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/runtest.sh b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/runtest.sh new file mode 100755 index 0000000..ce3bf9f --- /dev/null +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/runtest.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright (c) 2008 Red Hat, Inc. All rights reserved. +# +# 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 3 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 . +# +# Author: Michal Nowak + +# source the test script helpers +. /usr/bin/rhts_environment.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup "Gathering information & compiling" + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlShowRunningKernel + + rlRun "gcc reproducer.c -o reproducer" 0 "Compiling the reproducer" + rlPhaseEnd + + rlPhaseStartTest + rlRun "ltrace -o ltrace-test.log -f ./reproducer" 0 "'ltrace -f' is crunching the reproducer" + + rlAssertGrep "My child pid is" ltrace-test.log + rlAssertNotGrep "signal from wrong pid" ltrace-test.log + rlAssertGrep "SIGCHLD (Child exited)" ltrace-test.log + rlAssertNotGrep "Cannot attach to pid" ltrace-test.log + rlPhaseEnd + + rlPhaseStartCleanup "Doing clean-up" + rlBundleLogs "ltrace-outputs" ltrace-test.log + rlRun "rm -f ltrace-test.log reproducer" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd From f20f6a9ea6142c1f833e298849d80e8440609d1c 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:24:04 +0200 Subject: [PATCH 15/44] Import RHEL's regression test for #1158713 Note: I've prefixed the test with "bz1158713-" because ltrace's repo in Fedora ignores "ltrace-*/". See the .gitignore file. --- .../Makefile | 63 +++++++++++ .../PURPOSE | 5 + .../main.fmf | 18 +++ .../runtest.sh | 107 ++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/Makefile create mode 100644 tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/PURPOSE create mode 100644 tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/main.fmf create mode 100755 tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh diff --git a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/Makefile b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/Makefile new file mode 100644 index 0000000..29d9876 --- /dev/null +++ b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +# Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +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: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace gcc gawk" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1158713" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/PURPOSE b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/PURPOSE new file mode 100644 index 0000000..87ed099 --- /dev/null +++ b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +Author: Martin Cermak +Bug summary: ltrace assigns wrong names to glibc PLT slots +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1158713 diff --git a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/main.fmf b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/main.fmf new file mode 100644 index 0000000..8beae33 --- /dev/null +++ b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/main.fmf @@ -0,0 +1,18 @@ +summary: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +description: | + Bug summary: ltrace assigns wrong names to glibc PLT slots + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1158713 +contact: Martin Cermak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- gawk +duration: 10m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1158713 +extra-summary: /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +extra-task: /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots diff --git a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh new file mode 100755 index 0000000..9758773 --- /dev/null +++ b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +# Description: bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlRun "TMPD=$(mktemp -d)" + rlRun "pushd $TMPD" + + cat > test.c < +#include +#include +#include + +int main() +{ + char *s = malloc(1000); + + // trigger a free() call from libc: + setpwent(); + getpwent(); + endpwent(); + + // print maps + sprintf(s, "grep -F '[heap]' /proc/%d/maps", getpid()); + system (s); + + free(s); +} +EOFA + + cat > test.awk < limit_max) { + print "ERROR 2 ("addrs[i]">"limit_max")" + exit 2 + } + } +} +EOFB + + rlRun "gcc test.c -o test" + rlPhaseEnd + + rlPhaseStartTest + rlRun "ltrace -e free ./test |& tee log | awk -f test.awk" || \ + rlRun "cat log" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPD" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From d73a4e1684d08fe110d4f777572fc7db6959fab6 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:29:09 +0200 Subject: [PATCH 16/44] Import a regression test from RHEL. Sorry, no specific bug number, it wasn't recorded at that time and now I can't find it, at least easily. --- .../Makefile | 64 ++++++++++++++ .../pthread-program-assertion-failure/PURPOSE | 6 ++ .../main.fmf | 16 ++++ .../runtest.sh | 83 +++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 tests/Regression/pthread-program-assertion-failure/Makefile create mode 100644 tests/Regression/pthread-program-assertion-failure/PURPOSE create mode 100644 tests/Regression/pthread-program-assertion-failure/main.fmf create mode 100755 tests/Regression/pthread-program-assertion-failure/runtest.sh diff --git a/tests/Regression/pthread-program-assertion-failure/Makefile b/tests/Regression/pthread-program-assertion-failure/Makefile new file mode 100644 index 0000000..bb8e743 --- /dev/null +++ b/tests/Regression/pthread-program-assertion-failure/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Regression/pthread-program-assertion-failure +# Description: pthread-program-assertion-failure +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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/pthread-program-assertion-failure +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: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: pthread-program-assertion-failure" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Requires: gcc" >> $(METADATA) + @echo "Requires: glibc-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/pthread-program-assertion-failure/PURPOSE b/tests/Regression/pthread-program-assertion-failure/PURPOSE new file mode 100644 index 0000000..00eb57b --- /dev/null +++ b/tests/Regression/pthread-program-assertion-failure/PURPOSE @@ -0,0 +1,6 @@ +PURPOSE of /tools/ltrace/Regression/pthread-program-assertion-failure +Description: pthread-program-assertion-failure +Author: Martin Cermak + +Issue reproduced using an f20 arm (32 bit) fedora system with ltrace-0.7.91-13.fc22.armv7hl. + diff --git a/tests/Regression/pthread-program-assertion-failure/main.fmf b/tests/Regression/pthread-program-assertion-failure/main.fmf new file mode 100644 index 0000000..0e9d856 --- /dev/null +++ b/tests/Regression/pthread-program-assertion-failure/main.fmf @@ -0,0 +1,16 @@ +summary: pthread-program-assertion-failure +description: |+ + Issue reproduced using an f20 arm (32 bit) fedora system with ltrace-0.7.91-13.fc22.armv7hl. + +contact: Martin Cermak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- glibc-devel +duration: 10m +extra-summary: /tools/ltrace/Regression/pthread-program-assertion-failure +extra-task: /tools/ltrace/Regression/pthread-program-assertion-failure diff --git a/tests/Regression/pthread-program-assertion-failure/runtest.sh b/tests/Regression/pthread-program-assertion-failure/runtest.sh new file mode 100755 index 0000000..a2b1c31 --- /dev/null +++ b/tests/Regression/pthread-program-assertion-failure/runtest.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Regression/pthread-program-assertion-failure +# Description: pthread-program-assertion-failure +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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="$(rpm -qf $(which ltrace))" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm $(rpm -qf $(which gcc)) + rlRun "TMP=\$(mktemp -d)" + rlRun "pushd $TMP" + cat > test.c < +#include + +extern void print (char *); + +#define PRINT_LOOP 10 + +void * +th_main (void *arg) +{ + int i; + for (i=0; i Date: Wed, 19 May 2021 14:59:30 +0200 Subject: [PATCH 17/44] Log more information in a regression test To make the bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch work not only for regular builds but for scratch builds as well, we need to know how to refer them. This commit is just a temporary attempt to find the environment variable holding the reference. I'll make use of it in a follow-up commit. --- .../runtest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh index 4f7fecc..380c4d6 100755 --- a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh +++ b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh @@ -35,6 +35,7 @@ export $PACKAGE rlJournalStart rlPhaseStartSetup + rlLogInfo "$(env)" rlAssertRpm $PACKAGE rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" From 04309572bed8f60c57eb92b4b004e900e1c8ea11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Wed, 19 May 2021 15:40:27 +0200 Subject: [PATCH 18/44] Remove RHEL's test for #1427140 Right now it cannot work; it needs to access the source RPM for the ltrace being tested which, in case of scratch builds, isn't currently possible. --- .../Makefile | 64 ------------------- .../PURPOSE | 5 -- .../main.fmf | 27 -------- .../runtest.sh | 56 ---------------- 4 files changed, 152 deletions(-) delete mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile delete mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE delete mode 100644 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf delete mode 100755 tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile deleted file mode 100644 index 664b7c4..0000000 --- a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch -# Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) -# Author: Michal Kolar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2017 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/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Michal Kolar " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch)" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 30m" >> $(METADATA) - @echo "RunFor: ltrace" >> $(METADATA) - @echo "Requires: ltrace autoconf automake dejagnu elfutils-devel elfutils-libelf-devel libselinux-devel libtool scl-utils-build yum-utils" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1427140" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE deleted file mode 100644 index 321dfcd..0000000 --- a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch -Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) -Author: Michal Kolar -Bug summary: ltrace: ltrace-0.7.91-unwind-elfutils.patch modifies backup file created by previous patch -Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf deleted file mode 100644 index e8f7554..0000000 --- a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/main.fmf +++ /dev/null @@ -1,27 +0,0 @@ -summary: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) -description: | - Bug summary: ltrace: ltrace-0.7.91-unwind-elfutils.patch modifies backup file created by previous patch - Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 -contact: Michal Kolar -component: -- ltrace -test: ./runtest.sh -framework: beakerlib -recommend: -- ltrace -- autoconf -- automake -- dejagnu -- elfutils-devel -- elfutils-libelf-devel -- libselinux-devel -- libtool -- scl-utils-build -- yum-utils -- koji -- rpm-build -duration: 30m -link: -- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1427140 -extra-summary: /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch -extra-task: /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch diff --git a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh b/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh deleted file mode 100755 index 380c4d6..0000000 --- a/tests/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch/runtest.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/ltrace/Regression/bz1427140-ltrace-ltrace-0-7-91-unwind-elfutils-patch -# Description: Test for BZ#1427140 (ltrace ltrace-0.7.91-unwind-elfutils.patch) -# Author: Michal Kolar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2017 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)}" -export $PACKAGE - -rlJournalStart - rlPhaseStartSetup - rlLogInfo "$(env)" - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlRun "koji download-build --arch=src $(rpm -q $PACKAGE)" - rlRun "rpm --define='_topdir $TmpDir' -Uvh *src.rpm" - rlRun "dnf builddep -y SPECS/*.spec" - rlPhaseEnd - - rlPhaseStartTest - rlRun "rpmbuild -bp --define='_topdir $TmpDir' --define='_default_patch_flags -s --no-backup-if-mismatch' --quiet SPECS/*.spec" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd From 5ed23e066e2d40ea0e94593b5fcfb73e16094b96 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 13:14:52 +0000 Subject: [PATCH 19/44] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 7602f71..67a4ff8 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 41%{?dist} +Release: 42%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -207,6 +207,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jul 22 2021 Fedora Release Engineering - 0.7.91-42 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon Feb 8 2021 DJ Delorie - 0.7.91-41 - Add support for SCV syscall insn for ppc64le From c8ea90148a887a5cf760c5a8c229983b348e9290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Fri, 9 Jul 2021 16:20:03 +0200 Subject: [PATCH 20/44] Import RHEL's test for RFE #1449588 --- .../Makefile | 64 +++++++++++++++++++ .../PURPOSE | 5 ++ .../main.fmf | 16 +++++ .../runtest.sh | 53 +++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/Makefile create mode 100644 tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/PURPOSE create mode 100644 tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/main.fmf create mode 100755 tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/runtest.sh diff --git a/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/Makefile b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/Makefile new file mode 100644 index 0000000..dc867e7 --- /dev/null +++ b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support +# Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?) +# 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/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support +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#1449588 (Can ltrace be built with backtrace support?)" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1449588" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/PURPOSE b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/PURPOSE new file mode 100644 index 0000000..6da4e88 --- /dev/null +++ b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/PURPOSE @@ -0,0 +1,5 @@ +PURPOSE of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support +Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?) +Author: Edjunior Machado +Bug summary: Can ltrace be built with backtrace support? +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1449588 diff --git a/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/main.fmf b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/main.fmf new file mode 100644 index 0000000..91de65d --- /dev/null +++ b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#1449588 (Can ltrace be built with backtrace support?) +description: | + Bug summary: Can ltrace be built with backtrace support? + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1449588 +contact: Edjunior Machado +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +duration: 5m +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1449588 +extra-summary: /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support +extra-task: /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support diff --git a/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/runtest.sh b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/runtest.sh new file mode 100755 index 0000000..829db70 --- /dev/null +++ b/tests/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support/runtest.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Sanity/bz1449588-Can-ltrace-be-built-with-backtrace-support +# Description: Test for BZ#1449588 (Can ltrace be built with backtrace support?) +# 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" +PACKAGE=$(rpm -qf $(which $CMD)) + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + set -o pipefail + rlRun -l "ltrace --help |& tee help-output.log" 0 "Collecting help output" + rlRun -l "grep -- '-w, --where=NR.*print backtrace showing NR stack frames at most.' help-output.log" 0 "Checking if '-w, --where=NR' parameter is available on help output" + rlRun -l "ltrace -w 4 /bin/ls" 0 "Trivial smoke test" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From 0554fda54f6173ec4244e8ffd2259039374161b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Fri, 9 Jul 2021 16:24:48 +0200 Subject: [PATCH 21/44] Import RHEL's test Sanity/random-apps Note than several sub-tests (apps) had to be removed as unsuitable for publishing. --- tests/Sanity/random-apps/Makefile | 64 ++++++ tests/Sanity/random-apps/PURPOSE | 3 + tests/Sanity/random-apps/abort.c | 6 + tests/Sanity/random-apps/main.fmf | 14 ++ .../Sanity/random-apps/many_looping_threads.c | 35 +++ tests/Sanity/random-apps/mthd2.c | 43 ++++ tests/Sanity/random-apps/reproducer.c | 14 ++ tests/Sanity/random-apps/reproducer2.c | 15 ++ tests/Sanity/random-apps/reproducer3.c | 14 ++ tests/Sanity/random-apps/runtest.sh | 101 +++++++++ tests/Sanity/random-apps/say_linux.c | 8 + tests/Sanity/random-apps/sleeping-c.c | 6 + tests/Sanity/random-apps/t_thread.c | 211 ++++++++++++++++++ tests/Sanity/random-apps/test1.c | 52 +++++ tests/Sanity/random-apps/test_fork.c | 78 +++++++ tests/Sanity/random-apps/test_select.c | 70 ++++++ tests/Sanity/random-apps/thread-test2.c | 34 +++ tests/Sanity/random-apps/vfork.c | 15 ++ 18 files changed, 783 insertions(+) create mode 100644 tests/Sanity/random-apps/Makefile create mode 100644 tests/Sanity/random-apps/PURPOSE create mode 100644 tests/Sanity/random-apps/abort.c create mode 100644 tests/Sanity/random-apps/main.fmf create mode 100644 tests/Sanity/random-apps/many_looping_threads.c create mode 100644 tests/Sanity/random-apps/mthd2.c create mode 100644 tests/Sanity/random-apps/reproducer.c create mode 100644 tests/Sanity/random-apps/reproducer2.c create mode 100644 tests/Sanity/random-apps/reproducer3.c create mode 100755 tests/Sanity/random-apps/runtest.sh create mode 100644 tests/Sanity/random-apps/say_linux.c create mode 100644 tests/Sanity/random-apps/sleeping-c.c create mode 100644 tests/Sanity/random-apps/t_thread.c create mode 100644 tests/Sanity/random-apps/test1.c create mode 100644 tests/Sanity/random-apps/test_fork.c create mode 100644 tests/Sanity/random-apps/test_select.c create mode 100644 tests/Sanity/random-apps/thread-test2.c create mode 100644 tests/Sanity/random-apps/vfork.c diff --git a/tests/Sanity/random-apps/Makefile b/tests/Sanity/random-apps/Makefile new file mode 100644 index 0000000..cc7d4a8 --- /dev/null +++ b/tests/Sanity/random-apps/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Sanity/random-apps +# Description: Runs random app which caused strace problems in the past +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/ltrace/Sanity/random-apps +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE *.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Runs random app which caused strace problems in the past" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 1h" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Requires: gcc glibc-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: yes" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/random-apps/PURPOSE b/tests/Sanity/random-apps/PURPOSE new file mode 100644 index 0000000..49e48ae --- /dev/null +++ b/tests/Sanity/random-apps/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Sanity/random-apps +Description: Runs random app which caused strace problems in the past +Author: Michal Nowak diff --git a/tests/Sanity/random-apps/abort.c b/tests/Sanity/random-apps/abort.c new file mode 100644 index 0000000..b1db3c3 --- /dev/null +++ b/tests/Sanity/random-apps/abort.c @@ -0,0 +1,6 @@ +#include + +int main() { + abort(); +} + diff --git a/tests/Sanity/random-apps/main.fmf b/tests/Sanity/random-apps/main.fmf new file mode 100644 index 0000000..65d54ee --- /dev/null +++ b/tests/Sanity/random-apps/main.fmf @@ -0,0 +1,14 @@ +summary: Runs random app which caused strace problems in the past +description: '' +contact: Michal Nowak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- glibc-devel +duration: 1h +extra-summary: /tools/ltrace/Sanity/random-apps +extra-task: /tools/ltrace/Sanity/random-apps diff --git a/tests/Sanity/random-apps/many_looping_threads.c b/tests/Sanity/random-apps/many_looping_threads.c new file mode 100644 index 0000000..87d837b --- /dev/null +++ b/tests/Sanity/random-apps/many_looping_threads.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include +#include + +static int thd_no; + +static void *sub_thd(void *c) +{ + fprintf(stderr, "sub-thread %d created\n", ++thd_no); + for (;;) + getuid(); + return NULL; +} + +int main(int argc, char *argv[]) +{ + int i; + pthread_t *thd; + int num_threads = 1; + + if (argv[1]) + num_threads = atoi(argv[1]); + + thd = malloc(num_threads * sizeof(thd[0])); + fprintf(stderr, "test start, num_threads:%d...\n", num_threads); + for (i = 0; i < num_threads; i++) { + pthread_create(&thd[i], NULL, sub_thd, NULL); + fprintf(stderr, "after pthread_create\n"); + } + /* Exit. This kills all threads */ + return 0; +} diff --git a/tests/Sanity/random-apps/mthd2.c b/tests/Sanity/random-apps/mthd2.c new file mode 100644 index 0000000..6c0f154 --- /dev/null +++ b/tests/Sanity/random-apps/mthd2.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include + +#define NTHD 60 + +int thd_no; + + +long sub_func(void) +{ + uid_t uid; + + printf("sub-thread created: %d\n", ++thd_no); + + for (;;) { + uid = getuid(); + sleep(1); + } + + return (long)uid; +} + +void *sub_thd(void *c) +{ + sub_func(); +} + +main(int argc, char *argv[]) +{ + int i; + pthread_t thd[NTHD]; + + printf("test start...\n"); + + for (i = 0; i < NTHD; i++) { + pthread_create(&thd[i], NULL, sub_thd, NULL); + } +// pause(); +} + diff --git a/tests/Sanity/random-apps/reproducer.c b/tests/Sanity/random-apps/reproducer.c new file mode 100644 index 0000000..cca818c --- /dev/null +++ b/tests/Sanity/random-apps/reproducer.c @@ -0,0 +1,14 @@ +#include + +void *start (void *arg) { + return arg; +} + +pthread_t thread1; + +int main () { + pthread_create (&thread1, NULL, start, NULL); + sleep (1); + return 0; +} + diff --git a/tests/Sanity/random-apps/reproducer2.c b/tests/Sanity/random-apps/reproducer2.c new file mode 100644 index 0000000..404e8d6 --- /dev/null +++ b/tests/Sanity/random-apps/reproducer2.c @@ -0,0 +1,15 @@ +#include +#include + +static void h(int sig) {} + +int main() +{ + struct sigaction sa; + sigemptyset(&sa.sa_mask); + sa.sa_handler = h; + sa.sa_flags = SA_RESETHAND | SA_NODEFER; + sigaction (SIGUSR1, &sa, NULL); + return 0; +} + diff --git a/tests/Sanity/random-apps/reproducer3.c b/tests/Sanity/random-apps/reproducer3.c new file mode 100644 index 0000000..cca818c --- /dev/null +++ b/tests/Sanity/random-apps/reproducer3.c @@ -0,0 +1,14 @@ +#include + +void *start (void *arg) { + return arg; +} + +pthread_t thread1; + +int main () { + pthread_create (&thread1, NULL, start, NULL); + sleep (1); + return 0; +} + diff --git a/tests/Sanity/random-apps/runtest.sh b/tests/Sanity/random-apps/runtest.sh new file mode 100755 index 0000000..99e7612 --- /dev/null +++ b/tests/Sanity/random-apps/runtest.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Sanity/random-apps +# Description: Runs random app which caused strace problems in the past +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +CMD='ltrace' +BIN=$(which --skip-alias $CMD) +PACKAGE="$(rpm -qf --qf='%{name}\n' $BIN)" +#export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" + cp *.c $TmpDir + rlRun "pushd $TmpDir" + rlPhaseEnd + + touch FAILED PASSED + PASSED_CNT=0 + FAILED_CNT=0 + ALL_CNT=0 + for test in *.c; do + RESULT="PASS" + rlPhaseStartTest "Test ${test}" + rlRun "gcc $test -o ${test}.bin -lpthread" 0 "Compile $test" + rlAssertExists "${test}.bin" + rlRun "ltrace -o ${test}.LOG -f ./${test}.bin" 0 "Run $test under ltrace" + [ $? -ne 0 ] && RESULT=FAIL + + echo + cat ${test}.LOG + echo + + rlAssertNotGrep "\-\-\- SIGKILL" ${test}.LOG + [ $? -ne 0 ] && RESULT=FAIL + rlAssertNotGrep "\-\-\- SIGSEGV" ${test}.LOG + [ $? -ne 0 ] && RESULT=FAIL + rlAssertNotGrep "\-\-\- SIGILL" ${test}.LOG + [ $? -ne 0 ] && RESULT=FAIL + rlAssertNotGrep "\-\-\- SIGTRAP" ${test}.LOG + [ $? -ne 0 ] && RESULT=FAIL + rlAssertNotGrep "\-\-\- SIGINT" ${test}.LOG + [ $? -ne 0 ] && RESULT=FAIL + if [[ "$RESULT" == "PASS" ]]; then + let "PASSED_CNT = $PASSED_CNT + 1" + echo "$test $opt" >> PASSED + else + let "FAILED_CNT = $FAILED_CNT + 1" + echo "$test $opt" >> FAILED + fi + let "ALL_CNT = $ALL_CNT + 1" + rlPhaseEnd + done + + rlPhaseStartTest + rlLog "PASSED : $PASSED_CNT of $ALL_CNT" + cat PASSED + rlLog "FAILED : $FAILED_CNT of $ALL_CNT" + cat FAILED + if [ $FAILED_CNT -eq 0 ]; then + rlPass "All testcases passed." + else + rlFail "There are some errors." + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "tar c *.LOG *.bin PASSED FAILED | gzip > logs.tar.gz" + rlFileSubmit "logs.tar.gz" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Sanity/random-apps/say_linux.c b/tests/Sanity/random-apps/say_linux.c new file mode 100644 index 0000000..79f2d61 --- /dev/null +++ b/tests/Sanity/random-apps/say_linux.c @@ -0,0 +1,8 @@ +#include +#include + +int main() { + printf("Linux\n"); + exit(0); +} + diff --git a/tests/Sanity/random-apps/sleeping-c.c b/tests/Sanity/random-apps/sleeping-c.c new file mode 100644 index 0000000..4739a56 --- /dev/null +++ b/tests/Sanity/random-apps/sleeping-c.c @@ -0,0 +1,6 @@ +#include + +int main() +{ + sleep (15); +} diff --git a/tests/Sanity/random-apps/t_thread.c b/tests/Sanity/random-apps/t_thread.c new file mode 100644 index 0000000..e1f24c3 --- /dev/null +++ b/tests/Sanity/random-apps/t_thread.c @@ -0,0 +1,211 @@ +#include +#include +#include +#include +#include +#include +#include +#include +//#include "trigger_error.h" +#define THREAD_NUM 100 +#define MALLOC_LEN 1024*1024*10 +#define DEFAULT_NUM 0 +#define MAXSEM 5 + +int fd[10000]; +int fullid; +int emptyid; +int mutxid; + +void *thread_handle_a(void *temp); + +int main(int argc, char *argv[]) +{ + pthread_t tid_a; + int i; + int ai[THREAD_NUM]; + int ret_a = -1; + int file_num; + char filename[10]; + char str[20]; + struct sembuf P, V;; + union semun arg; + pid_t pid; + + int *array; + int *sum; + int *set; + int *get; + + if (DEFAULT_NUM == 0) { + file_num = 10; + } + +#ifdef STS_SLEEP + sleep(10); +#endif + + for (i = 0; i < file_num; i++) { + sprintf(filename, "%d", i); + printf("open fd%d\n", i); + fd[i] = open(filename, O_RDONLY); + if (fd[i] < 0) + continue; + + if (read(fd[i], str, sizeof(str)) < 0) { + close(fd[i]); + fd[i] = -1; + continue; + } + printf("%s", str); + } + + for (i = 0; i < file_num; i++) { + if (fd[i] >= 0) { + close(fd[i]); + } + } + + for (i = 0; i < file_num; i++) { + fd[0] = open("/dev/null", O_RDONLY); + if (fd[0] < 0) { + perror("open /dev/null"); + continue; + } + close(fd[0]); + } + + for (i = 0; i < file_num; i++) { + fd[0] = open("/proc/meminfo", O_RDONLY); + if (fd[0] < 0) { + perror("open /proc/meminfo"); + continue; + } + if (read(fd[0], str, sizeof(str)) < 0) { + close(fd[0]); + continue; + } + printf("%s\n", str); + close(fd[0]); + } + for (i = 0; i < file_num; i++) { + fd[0] = open("/proc/self/maps", O_RDONLY); + if (fd[0] < 0) { + perror("open /proc/meminfo"); + continue; + } + if (read(fd[0], str, sizeof(str)) < 0) { + close(fd[0]); + continue; + } + printf("%s\n", str); + close(fd[0]); + } + + array = + (int *)mmap(NULL, sizeof(int) * 5, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + sum = + (int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + get = + (int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + set = + (int *)mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + *sum = 0; + *get = 0; + *set = 0; + + fullid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666); + emptyid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666); + mutxid = semget(IPC_PRIVATE, 1, IPC_CREAT | 00666); + + arg.val = 0; + if (semctl(fullid, 0, SETVAL, arg) == -1) + perror("semctl setval error"); + + arg.val = MAXSEM; + if (semctl(emptyid, 0, SETVAL, arg) == -1) + perror("semctl setval error"); + + arg.val = 1; + if (semctl(mutxid, 0, SETVAL, arg) == -1) + perror("setctl setval error"); + + V.sem_num = 0; + V.sem_op = 1; + V.sem_flg = SEM_UNDO; + P.sem_num = 0; + P.sem_op = -1; + P.sem_flg = SEM_UNDO; + + i = 0; + while (i < 5) { + + semop(emptyid, &P, 1); + semop(mutxid, &P, 1); + + array[*(set) % MAXSEM] = i + 1; + printf("Producer %d\n", array[(*set) % MAXSEM]); + (*set)++; + fflush(NULL); + semop(mutxid, &V, 1); + semop(fullid, &V, 1); + i++; + } + semctl(fullid, 0, IPC_RMID); + semctl(emptyid, 0, IPC_RMID); + semctl(mutxid, 0, IPC_RMID); + + if ((pid = fork()) == 0) { + for (i = 0; i < THREAD_NUM; i++) { + ai[i] = i; + ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]); + printf("thread a : \n"); + + if (ret_a == 0) { + pthread_detach(tid_a); + } + } + } else if (pid > 0) { + for (i = 0; i < THREAD_NUM; i++) { + ai[i] = i; + ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]); + printf("thread a : \n"); + + if (ret_a == 0) { + pthread_detach(tid_a); + } + } + } else { + printf("fork error\n"); + } + + fflush(NULL); + write(1, "BEFORE_ERROR\n", 13); + //trigger_error(); + raise(SIGFPE); + write(1, "EXIT_FLAG\n", 10); + return 10; +} + +void *thread_handle_a(void *t) +{ + long page_size = MALLOC_LEN; + int j = *(int *)t; + char *addr; + addr = (char *)malloc(page_size); + if (addr != NULL) { + sprintf(addr, "hello"); + printf("(a) malloc %d success: %s\n", j, addr); + } else { + printf("(a)malloc %d failed\n", j); + } + + printf("thread (a) will exit\n"); + fflush(NULL); + return NULL; +} + diff --git a/tests/Sanity/random-apps/test1.c b/tests/Sanity/random-apps/test1.c new file mode 100644 index 0000000..45a43af --- /dev/null +++ b/tests/Sanity/random-apps/test1.c @@ -0,0 +1,52 @@ +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int pfd[2]; + pid_t pid = -1; + int rc = 0; + char buf[BUFSIZ]; + sigset_t sig_mask; + + /* + * Mask of SIGTRAP + * Initialize of the value of sig_mask + */ + sigemptyset(&sig_mask); + + /* Set of SIGTRAP in sig_mask */ + sigaddset(&sig_mask, SIGTRAP); + + /* Set of SIGTRAP */ + sigprocmask(SIG_SETMASK, &sig_mask, NULL); + + rc = pipe(pfd); + if(rc == -1){ + perror("pipe Error\n"); + exit (1); + } + pid = fork(); + if (pid == -1){ + perror("Fork Error\n"); + exit (1); + } else if (pid == 0) { + close(pfd[0]); + close(1); + dup(pfd[1]); + close(pfd[1]); + execl("./test2.sh", (char *)0); + exit(0); + } else { + close(pfd[1]); + while((read(pfd[0], buf, sizeof(buf))) > 0) { + printf("%s", buf); + } + close(pfd[0]); + wait(NULL); + exit(0); + } +} diff --git a/tests/Sanity/random-apps/test_fork.c b/tests/Sanity/random-apps/test_fork.c new file mode 100644 index 0000000..7afd110 --- /dev/null +++ b/tests/Sanity/random-apps/test_fork.c @@ -0,0 +1,78 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEFAULT_NUM 0 +#define THREAD_NUM 3 +#define MALLOC_LEN 1024*1024*10 + +void *thread_handle_a(void *t) +{ + long page_size = MALLOC_LEN; + int j = *(int *)t; + char *ptr; + char *addr; + + struct stat buf; + addr = (char *)malloc(page_size); + if (addr != NULL) { + sprintf(addr, "hello"); + printf("(a) malloc %d success: %s\n", j, addr); + } else { + printf("(a)malloc %d failed\n", j); + } + + + printf("thread (a) will exit\n"); + fflush(NULL); + if(addr != NULL) + free(addr); + return NULL; +} + +int main() +{ + int i = 0; + pid_t pid; + pthread_t tid_a; + int ai[THREAD_NUM]; + int ret_a = -1; + +#ifdef STS_SLEEP + sleep(10); +#endif + + if ((pid = fork()) == 0) { + for (i = 0; i < THREAD_NUM; i++) { + ai[i] = i; + ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]); + printf("thread a : \n"); + + if (ret_a == 0) { + pthread_detach(tid_a); + } + } + } else if (pid > 0) { + for (i = 0; i < THREAD_NUM; i++) { + ai[i] = i; + ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]); + printf("thread a : \n"); + + if (ret_a == 0) { + pthread_detach(tid_a); + } + } + + waitpid(pid, NULL, 0); + fflush(NULL); + write(1, "EXIT_FLAG\n", 10); + } else { + printf("fork error\n"); + } + return 0; +} diff --git a/tests/Sanity/random-apps/test_select.c b/tests/Sanity/random-apps/test_select.c new file mode 100644 index 0000000..f13df3b --- /dev/null +++ b/tests/Sanity/random-apps/test_select.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include +#include +#include +#include + +#define MAXBUF 1024 +#define THREAD_NUM 100 +#define MALLOC_LEN 1024*1024*10 + +void *thread_handle_a(void *t) +{ + long page_size = MALLOC_LEN; + int j = *(int *)t; + char *addr; + addr = (char *)malloc(page_size); + if (addr != NULL) { + sprintf(addr, "hello"); + printf("(a) malloc %d success: %s\n", j, addr); + } else { + printf("(a)malloc %d failed\n", j); + } + + printf("thread (a) will exit\n"); + fflush(NULL); + return NULL; +} + +int main(int argc, char **argv) +{ + fd_set wfds; + struct timeval tv; + int retval, maxfd = -1; + pthread_t tid_a; + int i; + int ai[THREAD_NUM]; + int ret_a = -1; + + sleep(5); + + for (i = 0; i < THREAD_NUM; i++) { + ai[i] = i; + ret_a = pthread_create(&tid_a, NULL, thread_handle_a, &ai[i]); + printf("thread a : \n"); + + if (ret_a == 0) { + pthread_detach(tid_a); + } + } + + FD_ZERO(&wfds); + FD_SET(STDOUT_FILENO, &wfds); + maxfd = STDOUT_FILENO; + tv.tv_sec = 1; + tv.tv_usec = 0; + + retval = select(maxfd+1, NULL, &wfds, NULL, &tv); + if (retval == -1) { + fprintf(stderr, "select failed\n"); + } else if (retval == 0){ + printf("Time out\n"); + } else { + printf("stdout can be write\n"); + } + + printf("EXIT_FLAG\n"); + return 0; +} diff --git a/tests/Sanity/random-apps/thread-test2.c b/tests/Sanity/random-apps/thread-test2.c new file mode 100644 index 0000000..cce490c --- /dev/null +++ b/tests/Sanity/random-apps/thread-test2.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include +#include + +#define THREAD_NUM 32 + +void *thread_function (void *); + +int main (int argc, char *argv[]) +{ + int i =0, x = 0; + int res = 0; + pthread_t a_thread[THREAD_NUM]; + void *thread_result; + + for (i = 0; i < THREAD_NUM; i++) { + res = pthread_create (&a_thread[i], NULL, thread_function, (void *)0); + if (res != 0) { + printf("Thread create failed\n"); + return (10); + } + } + raise(SIGABRT); + return (0); +} + +void *thread_function (void *arg) +{ + sleep(1); + printf("Thread TEST\n"); +} diff --git a/tests/Sanity/random-apps/vfork.c b/tests/Sanity/random-apps/vfork.c new file mode 100644 index 0000000..a34e09f --- /dev/null +++ b/tests/Sanity/random-apps/vfork.c @@ -0,0 +1,15 @@ +#define _GNU_SOURCE +#include +#include + +int main (void) +{ + pid_t child = vfork (); + + /* PRINTF/SLEEP violate the VFORK operations restriction. */ + printf ("%d pid=%d\n", (int) child, (int) getpid ()); + sleep (1); + if (!child) + execlp ("/bin/true", "/bin/true", NULL); + return 0; +} From 0e4ab8cfe4ce8633a67069a72649300583a615da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Fri, 9 Jul 2021 16:36:36 +0200 Subject: [PATCH 22/44] Import RHEL's wrapper for the upstream test suite Note: In RHEL, it's "testsuite2" outside of categories, here I'm adding it to the Sanity category. Note: I've filed https://bugzilla.redhat.com/show_bug.cgi?id=1963110 and included it as a known failure to make this test pass. --- tests/Sanity/testsuite/Makefile | 71 +++++++++++++++++++++++++++ tests/Sanity/testsuite/PURPOSE | 3 ++ tests/Sanity/testsuite/main.fmf | 23 +++++++++ tests/Sanity/testsuite/runtest.sh | 79 +++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 tests/Sanity/testsuite/Makefile create mode 100644 tests/Sanity/testsuite/PURPOSE create mode 100644 tests/Sanity/testsuite/main.fmf create mode 100755 tests/Sanity/testsuite/runtest.sh diff --git a/tests/Sanity/testsuite/Makefile b/tests/Sanity/testsuite/Makefile new file mode 100644 index 0000000..fec9913 --- /dev/null +++ b/tests/Sanity/testsuite/Makefile @@ -0,0 +1,71 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/ltrace/Sanity/testsuite +# Description: upstream tests for ltrace +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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/Sanity/testsuite +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Martin Cermak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: upstream tests for ltrace" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 5h" >> $(METADATA) + @echo "RunFor: ltrace" >> $(METADATA) + @echo "Requires: ltrace" >> $(METADATA) + @echo "Requires: gcc" >> $(METADATA) + @echo "Requires: gcc-c++" >> $(METADATA) + @echo "Requires: libstdc++" >> $(METADATA) + @echo "Requires: libstdc++-devel" >> $(METADATA) + @echo "Requires: rpm-build yum-utils" >> $(METADATA) + @echo "Requires: elfutils-devel" >> $(METADATA) + @echo "Requires: dejagnu" >> $(METADATA) + @echo "Requires: libselinux-devel" >> $(METADATA) + @echo "Requires: libtool" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/testsuite/PURPOSE b/tests/Sanity/testsuite/PURPOSE new file mode 100644 index 0000000..75f0067 --- /dev/null +++ b/tests/Sanity/testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/ltrace/Sanity/testsuite +Description: upstream tests for ltrace +Author: Martin Cermak diff --git a/tests/Sanity/testsuite/main.fmf b/tests/Sanity/testsuite/main.fmf new file mode 100644 index 0000000..c0c9e11 --- /dev/null +++ b/tests/Sanity/testsuite/main.fmf @@ -0,0 +1,23 @@ +summary: upstream tests for ltrace +description: '' +contact: Martin Cermak +component: +- ltrace +test: ./runtest.sh +framework: beakerlib +recommend: +- ltrace +- gcc +- gcc-c++ +- libstdc++ +- libstdc++-devel +- rpm-build +- yum-utils +- elfutils-devel +- dejagnu +- libselinux-devel +- libtool +- koji +duration: 5h +extra-summary: /tools/ltrace/Sanity/testsuite +extra-task: /tools/ltrace/Sanity/testsuite diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh new file mode 100755 index 0000000..e11c162 --- /dev/null +++ b/tests/Sanity/testsuite/runtest.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/ltrace/Sanity/testsuite +# Description: upstream tests for ltrace +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2015 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 $BIN)}" +export PACKAGE + +GCC=${GCC:-gcc} +export GCC + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun -l "rpm -qf $(which $GCC)" 0 "Checking gcc rpm version" + rlRun "TMP=`mktemp -d`" + rlRun "pushd $TMP" + + rlRun "koji download-build --arch=src $PACKAGE" + rlRun "dnf builddep -y *src.rpm" + rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm" + rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec" + rlPhaseEnd + + rlPhaseStartTest + rlRun "pushd BUILD/${CMD}-*" + + # known issues to be ignored + ignore_list='' + rlRun "ignore_list+=' system_calls.exp'" 0 "Failure reported bz#1963110" + + # define --ignore parameter for 'make check' if there is any testcase to be ignored + [ -n "$ignore_list" ] && rlRun "ignore_param=\"--ignore '$ignore_list'\"" 0 "Ignored testcases that will not be run: $ignore_list" + + # test + set -o pipefail + rlRun "make check RUNTESTFLAGS=\"--tool_exec=$BIN CC_FOR_TARGET=$GCC $ignore_param\" |& tee $TMP/check.log" + rlRun "popd" + + # no unexpected results should appear + rlRun -l "grep '^FAIL:' check.log" 1 + rlRun -l "grep '^# of unexpected' check.log" 1 + + rlFileSubmit "$TMP/check.log" "$PACKAGE-check.log" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From 809fa26deb9989363b3a127ce4d1fad03a45ab0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Fri, 24 Sep 2021 13:12:50 +0200 Subject: [PATCH 23/44] Fix the setup in tests/Sanity/testsuite "koji download-build" is a wrong tool to download artifacts being tested. They are freshly scratch-built and hosted in a local repo called "test-artifacts" unknown to koji. Using "dnf download" directly and limited to that specific repo is a correct way to reach them. I'm adding a fallback using the repo's local files just in case "dnf" suffers some temporary hiccup. --- tests/Sanity/testsuite/runtest.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh index e11c162..7687113 100755 --- a/tests/Sanity/testsuite/runtest.sh +++ b/tests/Sanity/testsuite/runtest.sh @@ -40,12 +40,13 @@ rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE rlRun -l "rpm -qf $(which $GCC)" 0 "Checking gcc rpm version" + rlRun "NVR=$(rpm -q --qf='%{NAME}-%{VERSION}-%{RELEASE}' $PACKAGE)" rlRun "TMP=`mktemp -d`" rlRun "pushd $TMP" - rlRun "koji download-build --arch=src $PACKAGE" - rlRun "dnf builddep -y *src.rpm" - rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm" + rlRun "dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || cp /var/share/test-artifacts/$NVR.src.rpm ." + rlRun "dnf builddep -y $NVR.src.rpm" + rlRun "rpm --define='_topdir $TMP' -Uvh $NVR.src.rpm" rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec" rlPhaseEnd From 8fd295b7c55344a039cdb3c253e1c8b4e2e5b871 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 11 Nov 2021 12:34:11 +0100 Subject: [PATCH 24/44] Do not try to install compat arch requirements --- .../bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf index a78d993..f45f827 100644 --- a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf @@ -10,12 +10,8 @@ framework: beakerlib recommend: - ltrace - gcc -- libgcc.i686 -- glibc-devel.i686 -- libgcc.ppc64 -- glibc-devel.ppc64 -- libgcc.s390 -- glibc-devel.s390 +- libgcc +- glibc-devel duration: 5m link: - relates: https://bugzilla.redhat.com/show_bug.cgi?id=868281 From 101cd9b6c3c8e02ef3a51e53769683c895724451 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 12 Nov 2021 09:09:08 +0100 Subject: [PATCH 25/44] CI testing: Fix the SRPM download Usually, this test is used for gating ltrace. In such case the Fedora infrastructure offers the SRPM along with other ltrace subrpms within a repo called "test-artifacts". However, this test is also used to test dejagnu, because ltrace has dejagnu based testsuite. In such case the "test-artifacts" repo has dejagnu, but not ltrace. We need to be able to get the ltrace SRPM in both cases. --- tests/Sanity/testsuite/runtest.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh index 7687113..d3b2e4a 100755 --- a/tests/Sanity/testsuite/runtest.sh +++ b/tests/Sanity/testsuite/runtest.sh @@ -44,7 +44,12 @@ rlJournalStart rlRun "TMP=`mktemp -d`" rlRun "pushd $TMP" - rlRun "dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || cp /var/share/test-artifacts/$NVR.src.rpm ." + set -x + dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || \ + cp /var/share/test-artifacts/$NVR.src.rpm . || \ + rlFetchSrcForInstalled ltrace + set +x + rlRun "dnf builddep -y $NVR.src.rpm" rlRun "rpm --define='_topdir $TMP' -Uvh $NVR.src.rpm" rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec" From 464fde80d5f517254f636da3d73d8f535feeddb2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 18:10:39 +0000 Subject: [PATCH 26/44] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 67a4ff8..d27d700 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 42%{?dist} +Release: 43%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -207,6 +207,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 0.7.91-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Thu Jul 22 2021 Fedora Release Engineering - 0.7.91-42 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 8b45d8ed688aa9bdda4ba53f84931a6d2550d6ea Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 27 Jan 2022 23:12:51 -0500 Subject: [PATCH 27/44] Fix use-after-free in ppc64le's plt.c Found by gcc 12 Resolves: #2046722 --- ltrace-0.7.91-W-use-after-free.patch | 13 +++++++++++++ ltrace.spec | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ltrace-0.7.91-W-use-after-free.patch diff --git a/ltrace-0.7.91-W-use-after-free.patch b/ltrace-0.7.91-W-use-after-free.patch new file mode 100644 index 0000000..19e802f --- /dev/null +++ b/ltrace-0.7.91-W-use-after-free.patch @@ -0,0 +1,13 @@ +diff -rup a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c +--- a/sysdeps/linux-gnu/ppc/plt.c 2022-01-27 20:40:52.956980433 -0500 ++++ b/sysdeps/linux-gnu/ppc/plt.c 2022-01-27 20:41:37.031599771 -0500 +@@ -687,8 +687,8 @@ arch_elf_add_func_entry(struct process * + if (libsym == NULL + || library_symbol_init(libsym, addr, full_name, 1, + LS_TOPLT_NONE) < 0) { +- free(libsym); + delete_symbol_chain(libsym); ++ free(libsym); + libsym = NULL; + fprintf(stderr, "Couldn't add symbol %s" + "for tracing.\n", name); diff --git a/ltrace.spec b/ltrace.spec index d27d700..b14e9f5 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 43%{?dist} +Release: 44%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -132,6 +132,8 @@ Patch35: ltrace-0.7.91-rh1799619.patch # Support for both SC and SCV sycall insns Patch36: ltrace-0.7.91-ppc64le-scv.patch +Patch37: ltrace-0.7.91-W-use-after-free.patch + %description Ltrace is a debugging program which runs a specified command until the command exits. While the command is executing, ltrace intercepts and @@ -180,6 +182,7 @@ execution of processes. %patch34 -p1 %patch35 -p1 %patch36 -p1 +%patch37 -p1 %build autoreconf -i @@ -207,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jan 27 2022 DJ Delorie - 0.7.91-44 +- Fix use-after-free cases. + * Thu Jan 20 2022 Fedora Release Engineering - 0.7.91-43 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 16ad28b25972766f3e97b196c2193dfa22efb829 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Tue, 3 May 2022 10:03:37 -0400 Subject: [PATCH 28/44] Rebuild ltrace for rawhide (#2046722) Resolves: #2046722 --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index b14e9f5..92e9d4f 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 44%{?dist} +Release: 45%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Fri May 03 2022 Carlos O'Donell - 0.7.91-45 +- Rebuild ltrace for rawhide (#2046722) + * Thu Jan 27 2022 DJ Delorie - 0.7.91-44 - Fix use-after-free cases. From dcc12472127d4e2398fe875763c991abf34dbc16 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 23 Feb 2022 11:49:37 +0100 Subject: [PATCH 29/44] tests: fixes for gating tests * plans/ci: setting "how: beakerlib" in execute step is deprecated. changed to "how: tmt" to comply with newer tmt versions. tmt versions. * ltrace with both --o and --c does not produce output to file: add malloc to the list of syscalls to check for tracing. * ltrace crashes when run on certain processes with --S option: make pgrep to exact match to avoid getting two PIDs, one from dbus-broker and other from dbus-broker-launch. * ltrace doesn't work on PIE-binaries: Added missing 32-bit dependencies. --- plans/ci.fmf | 2 +- .../runtest.sh | 13 ++++++++++--- .../runtest.sh | 2 +- .../main.fmf | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/plans/ci.fmf b/plans/ci.fmf index 1ad2c12..85710d6 100644 --- a/plans/ci.fmf +++ b/plans/ci.fmf @@ -3,4 +3,4 @@ discover: how: fmf directory: tests execute: - how: beakerlib + how: tmt diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh index 77fbfef..bb5c85a 100755 --- a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh @@ -67,15 +67,22 @@ rlJournalStart fi # ltrace no longer reports __libc_start_main on rhel-8 x86_64 (rhbz#1654734) - if grep "ioctl" ltrace-test-sys.log; then + # search for either malloc or ioctl. + func_found=0 + for traced_func in "malloc" "ioctl"; do + if grep "$traced_func" ltrace-test-sys.log; then + func_found=1 + fi + done + if [ $func_found -ne 0 ]; then if [ $skip_system_binary_test ]; then rlLogWarning "Test was skipped but it seems ok. Review skip check." fi else if [ $skip_system_binary_test ]; then - rlLogInfo "ltrace output does not contain ioctl calls (expected failure)" + rlLogInfo "ltrace output does not contain ioctl or malloc calls (expected failure)" else - rlFail "ltrace output does not contain ioctl calls" + rlFail "ltrace output does not contain ioctl or malloc calls" fi fi 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 index 1ae4c93..1434c47 100755 --- 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 @@ -46,7 +46,7 @@ fi rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE - rlRun "pgrep $PROC_NAME || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME" + rlRun "pgrep -x $PROC_NAME || service $SERVICE_NAME start" 0 "Checking/starting $SERVICE_NAME" rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlPhaseEnd diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf index f45f827..bcce809 100644 --- a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/main.fmf @@ -12,6 +12,8 @@ recommend: - gcc - libgcc - glibc-devel +- libgcc.i686 +- glibc-devel.i686 duration: 5m link: - relates: https://bugzilla.redhat.com/show_bug.cgi?id=868281 From 00f430ccbebdbd13bdd4d7ee6303b091cf005542 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 19:58:28 +0000 Subject: [PATCH 30/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 92e9d4f..6d308e2 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 45%{?dist} +Release: 46%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 0.7.91-46 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Fri May 03 2022 Carlos O'Donell - 0.7.91-45 - Rebuild ltrace for rawhide (#2046722) From 3abe3265ff07259553d32fa04a65ef3c12b54c25 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 18:23:03 +0000 Subject: [PATCH 31/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 6d308e2..7c82041 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 46%{?dist} +Release: 47%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 0.7.91-47 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Thu Jul 21 2022 Fedora Release Engineering - 0.7.91-46 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From cbc633d2a20d8b19bec13d89ae7921326b665266 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 13:08:56 +0000 Subject: [PATCH 32/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 7c82041..9540ad3 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 47%{?dist} +Release: 48%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 0.7.91-48 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Thu Jan 19 2023 Fedora Release Engineering - 0.7.91-47 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 15ef50aff44f576100f0bf639082559dec8e7d74 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 06:18:29 +0000 Subject: [PATCH 33/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 9540ad3..4cc9e6e 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 48%{?dist} +Release: 49%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 0.7.91-49 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Thu Jul 20 2023 Fedora Release Engineering - 0.7.91-48 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From a77340edfd6fd37e5a645c19ea65f6fdf65d6a88 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 04:54:45 +0000 Subject: [PATCH 34/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 4cc9e6e..83a8cc2 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 49%{?dist} +Release: 50%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 0.7.91-50 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 0.7.91-49 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 4773a704b6740f9fb1b2e3a6230943f785089832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Tue, 13 Feb 2024 09:30:05 +0000 Subject: [PATCH 35/44] Migrate to SPDX license This is a part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_3 --- ltrace.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 83a8cc2..3751071 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -5,7 +5,7 @@ Release: 50%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace -License: GPLv2+ +License: GPL-2.0-or-later BuildRequires: elfutils-devel dejagnu BuildRequires: libselinux-devel From 6444af4152054d2f4048b89e912027a0121e03ad Mon Sep 17 00:00:00 2001 From: Software Management Team Date: Thu, 30 May 2024 12:46:47 +0200 Subject: [PATCH 36/44] Eliminate use of obsolete %patchN syntax (#2283636) --- ltrace.spec | 74 ++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/ltrace.spec b/ltrace.spec index 3751071..fae9c6f 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -146,43 +146,43 @@ execution of processes. %prep %setup -q -n %{name}-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 -%patch37 -p1 +%patch -P0 -p1 +%patch -P1 -p1 +%patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 +%patch -P10 -p1 +%patch -P11 -p1 +%patch -P13 -p1 +%patch -P14 -p1 +%patch -P15 -p1 +%patch -P16 -p1 +%patch -P17 -p1 +%patch -P18 -p1 +%patch -P19 -p1 +%patch -P20 -p1 +%patch -P21 -p1 +%patch -P22 -p1 +%patch -P23 -p1 +%patch -P24 -p1 +%patch -P25 -p1 +%patch -P26 -p1 +%patch -P27 -p1 +%patch -P28 -p1 +%patch -P29 -p1 +%patch -P30 -p1 +%patch -P31 -p1 +%patch -P32 -p1 +%patch -P33 -p1 +%patch -P34 -p1 +%patch -P35 -p1 +%patch -P36 -p1 +%patch -P37 -p1 %build autoreconf -i From 941e708eb6996913807027f6f37eb89f108d5a60 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 16:05:46 +0000 Subject: [PATCH 37/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index fae9c6f..50baa0b 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 50%{?dist} +Release: 51%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 0.7.91-51 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Thu Jan 25 2024 Fedora Release Engineering - 0.7.91-50 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From d70730248fcd8d00fc29924415dab5bf3dc541bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Wed, 18 Sep 2024 14:16:14 +0200 Subject: [PATCH 38/44] Fix gating tests on Rawhide --- tests/Sanity/testsuite/runtest.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Sanity/testsuite/runtest.sh b/tests/Sanity/testsuite/runtest.sh index d3b2e4a..3f56a91 100755 --- a/tests/Sanity/testsuite/runtest.sh +++ b/tests/Sanity/testsuite/runtest.sh @@ -53,10 +53,16 @@ rlJournalStart rlRun "dnf builddep -y $NVR.src.rpm" rlRun "rpm --define='_topdir $TMP' -Uvh $NVR.src.rpm" rlRun "${RPMBUILD_GCC:+CC=$RPMBUILD_GCC} rpmbuild --define='_topdir $TMP' -bc SPECS/${CMD}.spec" + + MAKEFILE_PATH=$(ls BUILD/${CMD}-*/Makefile 2>/dev/null) + if [[ -z "$MAKEFILE_PATH" ]]; then + MAKEFILE_PATH=$(ls BUILD/${CMD}-*/${CMD}-*/Makefile 2>/dev/null) + fi + rlLogInfo "MAKEFILE_PATH=$MAKEFILE_PATH" rlPhaseEnd rlPhaseStartTest - rlRun "pushd BUILD/${CMD}-*" + rlRun "pushd ${MAKEFILE_PATH%/Makefile}" # known issues to be ignored ignore_list='' From 665a435b81ba15ce0824e1fe16a744e667c4d831 Mon Sep 17 00:00:00 2001 From: Martin Coufal Date: Mon, 11 Nov 2024 12:48:52 +0100 Subject: [PATCH 39/44] tests: fix for rhel10 We use tests in Fedora for RHEL testing as well and some of the tests need to be updated to compile and run successfully on RHEL-10. * tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option: add missing includes, add NULL arg to wait() * tests/Regression/211163-ltrace-with--c-omit-execl-call: fix IF condition to include rhel-10 * tests/Regression/427444-ltrace-crashes-process-to-be-analysed: add missing include * tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file: moved reproducer to a separate file, add missing include, fix IF condition to include rhel-10 * tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots: add missing include * tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option: fix IF condition to include rhel-10 * tests/Sanity/random-apps: add return type and return to main function, add missing includes, add semun union definition --- .../reproducer.c | 4 +++- .../211163-ltrace-with--c-omit-execl-call/runtest.sh | 4 ++-- .../reproducer.c | 1 + .../Makefile | 2 +- .../reproducer.c | 7 +++++++ .../runtest.sh | 7 ++++--- .../runtest.sh | 1 + .../runtest.sh | 2 +- tests/Sanity/random-apps/mthd2.c | 3 ++- tests/Sanity/random-apps/reproducer.c | 1 + tests/Sanity/random-apps/reproducer3.c | 1 + tests/Sanity/random-apps/t_thread.c | 11 ++++++++++- tests/Sanity/random-apps/test_select.c | 1 + 13 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/reproducer.c diff --git a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c index 1d11ad6..f06a96b 100644 --- a/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c +++ b/tests/Regression/211135-ltrace-hangs-while-tracing-child-process-with--f-option/reproducer.c @@ -8,6 +8,8 @@ #include #include +#include +#include void child() { printf("Fork Child\n"); @@ -24,7 +26,7 @@ int main() { child(); else { printf("My child pid is %d\n",pid); - wait(); + wait(NULL); } return 0; } diff --git a/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh b/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh index 68b0814..a4de38c 100755 --- a/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh +++ b/tests/Regression/211163-ltrace-with--c-omit-execl-call/runtest.sh @@ -55,8 +55,8 @@ rlJournalStart fi ;; esac - elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then - rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" + elif rlIsRHEL ">=9" && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL >=9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" skip_test=1 elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking" diff --git a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c index d0ccb5d..3118c8e 100644 --- a/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c +++ b/tests/Regression/427444-ltrace-crashes-process-to-be-analysed/reproducer.c @@ -3,6 +3,7 @@ #include #include #include +#include #ifndef NI_MAXHOST diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile index 4b68558..49c119a 100644 --- a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/Makefile @@ -25,7 +25,7 @@ export TESTVERSION=1.0 BUILT_FILES= -FILES=$(METADATA) runtest.sh Makefile PURPOSE +FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c .PHONY: all install download clean diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/reproducer.c b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/reproducer.c new file mode 100644 index 0000000..5107daa --- /dev/null +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/reproducer.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + alarm(42); + return 0; +} diff --git a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh index bb5c85a..9e6c769 100755 --- a/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh +++ b/tests/Regression/447404-ltrace-with-both--o-and--c-options-does-not-produce-output-to-file/runtest.sh @@ -28,11 +28,12 @@ rlJournalStart rlAssertRpm $(rpm -qf $(which gcc)) rlShowRunningKernel rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp reproducer.c $TmpDir" rlRun "pushd $TmpDir" rlPhaseEnd rlPhaseStartTest "ltrace with -o and -c options tracing testing binary" - rlRun "echo 'int main(){alarm(42);return 0;}'| gcc -x c -o test.bin -" + rlRun "gcc -x c -o test.bin reproducer.c" rlRun "ltrace -o ltrace-test.log -c ./test.bin" 0 "ltrace is crunching a testing binary" rlRun -l "cat ltrace-test.log" rlAssertGrep "alarm" ltrace-test.log @@ -58,8 +59,8 @@ rlJournalStart fi ;; esac - elif rlIsRHEL 9 && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then - rlLogWarning "RHEL-9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" + elif rlIsRHEL ">=9" && [[ $PACKAGE =~ ^ltrace ]] && [ "$(arch)" = "ppc64le" ]; then + rlLogWarning "RHEL >=9 ltrace fails to trace system binaries on ppc64le due to bz#1906881, hence skipping failure checking" skip_system_binary_test=1 elif rlIsFedora 33 && [ "$(arch)" = "ppc64le" ]; then rlLogWarning "FC33 ltrace fails to trace system binaries on ppc64le due to bz#1902770, hence skipping failure checking" diff --git a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh index 9758773..2dd3bb1 100755 --- a/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh +++ b/tests/Regression/bz1158713-ltrace-assigns-wrong-names-to-glibc-PLT-slots/runtest.sh @@ -42,6 +42,7 @@ rlJournalStart #include #include #include +#include int main() { 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 index 1434c47..44d3028 100755 --- 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 @@ -32,7 +32,7 @@ CMD='ltrace' BIN=$(which --skip-alias $CMD) PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' $BIN)}" -if rlIsRHEL 9 || rlIsFedora; then +if rlIsRHEL ">=9" || rlIsFedora; then PROC_NAME=dbus-broker SERVICE_NAME=dbus-broker elif rlIsRHEL 6; then diff --git a/tests/Sanity/random-apps/mthd2.c b/tests/Sanity/random-apps/mthd2.c index 6c0f154..9ef8a41 100644 --- a/tests/Sanity/random-apps/mthd2.c +++ b/tests/Sanity/random-apps/mthd2.c @@ -28,7 +28,7 @@ void *sub_thd(void *c) sub_func(); } -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int i; pthread_t thd[NTHD]; @@ -39,5 +39,6 @@ main(int argc, char *argv[]) pthread_create(&thd[i], NULL, sub_thd, NULL); } // pause(); + return 0; } diff --git a/tests/Sanity/random-apps/reproducer.c b/tests/Sanity/random-apps/reproducer.c index cca818c..c5df5d9 100644 --- a/tests/Sanity/random-apps/reproducer.c +++ b/tests/Sanity/random-apps/reproducer.c @@ -1,4 +1,5 @@ #include +#include void *start (void *arg) { return arg; diff --git a/tests/Sanity/random-apps/reproducer3.c b/tests/Sanity/random-apps/reproducer3.c index cca818c..c5df5d9 100644 --- a/tests/Sanity/random-apps/reproducer3.c +++ b/tests/Sanity/random-apps/reproducer3.c @@ -1,4 +1,5 @@ #include +#include void *start (void *arg) { return arg; diff --git a/tests/Sanity/random-apps/t_thread.c b/tests/Sanity/random-apps/t_thread.c index e1f24c3..d024f07 100644 --- a/tests/Sanity/random-apps/t_thread.c +++ b/tests/Sanity/random-apps/t_thread.c @@ -1,10 +1,11 @@ #include #include -#include +#include #include #include #include #include +#include #include //#include "trigger_error.h" #define THREAD_NUM 100 @@ -17,6 +18,14 @@ int fullid; int emptyid; int mutxid; +union semun +{ + int val; /* Value for SETVAL */ + struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ + unsigned short *array; /* Array for GETALL, SETALL */ + struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */ +}; + void *thread_handle_a(void *temp); int main(int argc, char *argv[]) diff --git a/tests/Sanity/random-apps/test_select.c b/tests/Sanity/random-apps/test_select.c index f13df3b..0ad3c34 100644 --- a/tests/Sanity/random-apps/test_select.c +++ b/tests/Sanity/random-apps/test_select.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include From 4b0ed33102d96241fd237f75a60b464beb204b14 Mon Sep 17 00:00:00 2001 From: Martin Coufal Date: Wed, 13 Nov 2024 10:42:54 +0100 Subject: [PATCH 40/44] tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries: fix for rhel10 * disable 32b part of the test for rhel10 * fix getting ARCH/SARCH * move reproducer to a separate file, add missing include --- .../Makefile | 2 +- .../reproducer.c | 7 +++++++ .../runtest.sh | 13 +++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/reproducer.c diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile index 4f22633..65e57b3 100644 --- a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/Makefile @@ -29,7 +29,7 @@ export TESTVERSION=1.0 BUILT_FILES= -FILES=$(METADATA) runtest.sh Makefile PURPOSE +FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.c .PHONY: all install download clean diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/reproducer.c b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/reproducer.c new file mode 100644 index 0000000..5107daa --- /dev/null +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/reproducer.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + alarm(42); + return 0; +} diff --git a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh index 714dfc4..586a0c6 100755 --- a/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh +++ b/tests/Regression/bz868281-ltrace-doesn-t-work-on-PIE-binaries/runtest.sh @@ -39,14 +39,16 @@ rlJournalStart rlAssertRpm $LTRACE_RPM rlAssertRpm $GCC_RPM rlAssertRpm $BINUTILS_RPM - for arch in $(rlGetPrimaryArch) $(rlGetSecondaryArch); do + ARCH="$(rlGetPrimaryArch)" + SARCH="$(rlGetSecondaryArch)" + for arch in $ARCH $SARCH; do rlCheckRpm glibc.$arch done rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp reproducer.c $TmpDir" rlRun "pushd $TmpDir" if [ -d /usr/lib64 ]; then - ARCH=`uname -i` if [[ $ARCH =~ s390.* ]]; then if rlIsRHEL '>=8'; then rlLogInfo "RHEL-8 and newer do not support s390x 31-bit compilation" @@ -62,6 +64,9 @@ rlJournalStart elif [[ $ARCH =~ ia64|aarch64|ppc64le ]]; then rlLogInfo "$ARCH does not support 32-bit compilation" MBITS= + elif rlIsRHEL ">=10"; then + rlLogInfo "RHEL >=10 does not support 32-bit packages" + MBITS= else MBITS=32 fi @@ -69,11 +74,11 @@ rlJournalStart rlLogInfo "MBITS=$MBITS" - rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -x c -o a-native.out -" + rlRun "$GCC -fPIE -pie -x c reproducer.c -o a-native.out" rlAssertExists a-native.out if [ -n "$MBITS" ]; then - rlRun "echo 'int main(){alarm(42);return 0;}'| $GCC -fPIE -pie -m$MBITS -x c -o a-$MBITS.out -" + rlRun "$GCC -fPIE -pie -m$MBITS -x c reproducer.c -o a-$MBITS.out" rlAssertExists a-$MBITS.out fi rlPhaseEnd From 287df279b5062536e9aaffae262d157104e690a3 Mon Sep 17 00:00:00 2001 From: Martin Coufal Date: Wed, 13 Nov 2024 13:32:35 +0100 Subject: [PATCH 41/44] tests/Regression/bz1360259-ltrace-crashes-when-run-on-certain-processes-with-the--S-option: make pidof return only one PID --- .../runtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 44d3028..9c83e5e 100755 --- 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 @@ -52,13 +52,13 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - rlRun "PID=$(pidof $PROC_NAME)" + rlRun "PID='$(pidof -s $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)" + rlAssertEquals "$PROC_NAME is expected to be still running" $PID "$(pidof -s $PROC_NAME)" rlFileSubmit output.log rlPhaseEnd From 10f68c74442f9c689377c959e16f561a92ed4d5e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 16:07:24 +0000 Subject: [PATCH 42/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index 50baa0b..f4e4d9e 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 51%{?dist} +Release: 52%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 0.7.91-52 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Jul 18 2024 Fedora Release Engineering - 0.7.91-51 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 955c1e43d17cef57e24d373985ab6a4299e68ee6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 20:55:16 +0000 Subject: [PATCH 43/44] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- ltrace.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ltrace.spec b/ltrace.spec index f4e4d9e..f175967 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace Version: 0.7.91 -Release: 52%{?dist} +Release: 53%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -210,6 +210,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 0.7.91-53 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri Jan 17 2025 Fedora Release Engineering - 0.7.91-52 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From a8c41cd3541e3c22a6348350475cd6a1bcb603df Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 16 Sep 2025 12:54:36 -0400 Subject: [PATCH 44/44] Rebase to ltrace 0.8.1 --- .gitignore | 1 + ltrace.spec | 164 ++-------------------------------------------------- sources | 2 +- 3 files changed, 8 insertions(+), 159 deletions(-) diff --git a/.gitignore b/.gitignore index 45c391d..92e00dc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ ltrace-*/ /ltrace-0.7.0.tar.bz2 /ltrace-0.7.2.tar.bz2 /ltrace-0.7.91.tar.bz2 +/ltrace-0.8.1.tar.bz2 diff --git a/ltrace.spec b/ltrace.spec index f175967..15301a6 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace -Version: 0.7.91 -Release: 53%{?dist} +Version: 0.8.1 +Release: 1%{?dist} # In coordination with Juan Céspedes, upstream is now officially on gitlab. # We are going to being sending all of our Fedora patches upstream to gitlab. URL: https://gitlab.com/cespedes/ltrace @@ -13,127 +13,9 @@ BuildRequires: autoconf automake libtool BuildRequires: gcc-c++ BuildRequires: make -# Note: this URL needs to be updated for each release, as the file -# number changes for each file. Full list of released files is at: -# https://alioth.debian.org/frs/?group_id=30892 +# https://gitlab.com/cespedes/ltrace/-/releases Source: ltrace-%{version}.tar.bz2 -# Merge of several upstream commits that fixes compilation on ARM. -Patch0: ltrace-0.7.91-arm.patch - -# Upstream patch that fixes accounting of exec, __libc_start_main and -# others in -c output. -Patch1: ltrace-0.7.91-account_execl.patch - -# Upstream patch that fixes interpretation of PLT on x86_64 when -# IRELATIVE slots are present. -Patch2: ltrace-0.7.91-x86_64-irelative.patch - -# Upstream patch that fixes fetching of system call arguments on s390. -Patch3: ltrace-0.7.91-s390-fetch-syscall.patch - -# Upstream patch that enables tracing of IRELATIVE PLT slots on s390. -Patch4: ltrace-0.7.91-s390-irelative.patch - -# Fix for a regression in tracing across fork. Upstream patch. -Patch5: ltrace-0.7.91-ppc64-fork.patch - -# Fix crashing a prelinked PPC64 binary which makes PLT calls through -# slots that ltrace doesn't trace. -# https://bugzilla.redhat.com/show_bug.cgi?id=1051221 -Patch6: ltrace-0.7.91-breakpoint-on_install.patch -Patch7: ltrace-0.7.91-ppc64-unprelink.patch - -# Man page nits. Backport of an upstream patch. -Patch8: ltrace-0.7.91-man.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1044766 -Patch9: ltrace-0.7.91-cant_open.patch - -# Support Aarch64 architecture. -Patch10: ltrace-0.7.91-aarch64.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1064406 -Patch11: ltrace-0.7.2-e_machine.patch - -# Support for ppc64le, backported from upstream. -# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=eea4ad2cce289753aaa35b4e0258a76d8f8f367c -# https://bugzilla.redhat.com/show_bug.cgi?id=1131956 -Patch13: ltrace-0.7.91-ppc64le-support.patch -# 35a9677dc9dcb7909ebd28f30200474d7e8b660f, -# 437d2377119036346f4dbd93039c847b4cc9d0be, -# eb3993420734f091cde9a6053ca6b4edcf9ae334 -Patch14: ltrace-0.7.91-ppc64le-fixes.patch - -# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=2e9f9f1f5d0fb223b109429b9c904504b7f638e2 -# http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=f96635a03b3868057db5c2d7972d5533e2068345 -Patch15: ltrace-0.7.91-parser-ws_after_id.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1171165 -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d8f1287b85e2c2b2ae0235809e956f4365e53c45 -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d80c5371454383e3f9978622e5578cf02af8c44c -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=bf82100966deda9c7d26ad085d97c08126a8ae88 -Patch16: ltrace-0.7.91-ppc-bias.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1158714 -Patch17: ltrace-0.7.91-x86-plt_map.patch -Patch18: ltrace-0.7.91-x86-unused_label.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1170315 -Patch19: ltrace-0.7.91-unwind-elfutils.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1208351 -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=4724bd5a4a19db117a1d280b9d1a3508fd4e03fa -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=72ee29639c55b5942bc07c8ed0013005f8fc5a97 -Patch20: ltrace-0.7.91-multithread-no-f-1.patch -Patch21: ltrace-0.7.91-multithread-no-f-2.patch - -# Fix problems with building a number of test cases. -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=694d19ff14017926454771cbb63a22355b72f1bf -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=a3a03622fb4ca9772dca13eae724a94ba1e728f4 -Patch22: ltrace-0.7.91-testsuite-includes.patch -Patch23: ltrace-0.7.91-testsuite-includes-2.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1210653 -# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=eea6091f8672b01f7f022b0fc367e0f568225ffc -Patch24: ltrace-0.7.91-ppc64le-configure.patch - -Patch25: ltrace-rh1307754.patch - -# GCC now warns (errors) on "tautological compares", and readdir_r is deprecated. -Patch26: ltrace-0.7.91-tautology.patch - -# ARM code has unreachable code after switch statement, move initialization -Patch27: ltrace-rh1423913.patch - -# AARCH64 large parameters and syscall testsuite fixes. -Patch28: ltrace-0.7.91-aarch64-params.patch - -# gcc-9 fix. Avoid passing NULL as argument to %s -Patch29: ltrace-0.7.91-null.patch - -# Adds support for CET PLTs via second-plt lookups. -Patch30: ltrace-0.7.91-cet.patch - -# Extra #includes for gcc 9 -Patch31: ltrace-0.7.91-aarch64-headers.patch -# Testsuite: AARCH64 ifuncs not supported yet yet. -Patch32: ltrace-rh1225568.patch - -# testsuite fixes for pre-installed config files -Patch33: ltrace-0.7.91-testsuite-system_call_params.patch - -# Ignore bogus files from the environment -Patch34: ltrace-0.7.91-XDG_CONFIG_DIRS.patch - -# GCC erroneously warns about uninitialized values -Patch35: ltrace-0.7.91-rh1799619.patch - -# Support for both SC and SCV sycall insns -Patch36: ltrace-0.7.91-ppc64le-scv.patch - -Patch37: ltrace-0.7.91-W-use-after-free.patch - %description Ltrace is a debugging program which runs a specified command until the command exits. While the command is executing, ltrace intercepts and @@ -146,43 +28,6 @@ execution of processes. %prep %setup -q -n %{name}-%{version} -%patch -P0 -p1 -%patch -P1 -p1 -%patch -P2 -p1 -%patch -P3 -p1 -%patch -P4 -p1 -%patch -P5 -p1 -%patch -P6 -p1 -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 -%patch -P10 -p1 -%patch -P11 -p1 -%patch -P13 -p1 -%patch -P14 -p1 -%patch -P15 -p1 -%patch -P16 -p1 -%patch -P17 -p1 -%patch -P18 -p1 -%patch -P19 -p1 -%patch -P20 -p1 -%patch -P21 -p1 -%patch -P22 -p1 -%patch -P23 -p1 -%patch -P24 -p1 -%patch -P25 -p1 -%patch -P26 -p1 -%patch -P27 -p1 -%patch -P28 -p1 -%patch -P29 -p1 -%patch -P30 -p1 -%patch -P31 -p1 -%patch -P32 -p1 -%patch -P33 -p1 -%patch -P34 -p1 -%patch -P35 -p1 -%patch -P36 -p1 -%patch -P37 -p1 %build autoreconf -i @@ -210,6 +55,9 @@ echo ====================TESTING END===================== %{_datadir}/ltrace %changelog +* Tue Sep 16 2025 DJ Delorie - 0.8.1-1 +- Rebased to ltrace 0.8.1 + * Thu Jul 24 2025 Fedora Release Engineering - 0.7.91-53 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index a8420d6..1dd70e2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9db3bdee7cf3e11c87d8cc7673d4d25b ltrace-0.7.91.tar.bz2 +SHA512 (ltrace-0.8.1.tar.bz2) = 68fdf10abb3c9534987cb4fcf2531502f8376c56299d56908406ba903fa63af2e0a82c3b902ed0cd47e4985154155a4e9387a11ada066515de26486301dddbaf