Import RHEL's regression test for #447404

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

View File

@ -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 <http://www.gnu.org/licenses/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
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 <mnowak@redhat.com>" > $(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)

View File

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

View File

@ -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 <mnowak@redhat.com>
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

View File

@ -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 <http://www.gnu.org/licenses/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# 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