Import RHEL's regression test for #1465318

This commit is contained in:
Václav Kadlčík 2021-04-14 06:31:29 +02:00
parent 6a906104d9
commit 57106a8254
5 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
# Description: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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=/CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE gprof.file.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: Milos Prchlik <mprchlik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils" >> $(METADATA)
@echo "Requires: binutils gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1465318" >> $(METADATA)
@echo "Releases: RHEL7" >> $(METADATA)
@echo "Architectures: x86_64" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
Description: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)
Author: Milos Prchlik <mprchlik@redhat.com>
Bug summary: [FJ7.4 Bug]: [REG] The results of gprof command with some options differ between RHEL7.4 beta and RHEL7.3.
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1465318

View File

@ -0,0 +1,4 @@
static void fun2(){int i=0;}
void fun1(){int i=0;}
void fun3(){}
int main(){ fun1(); fun2(); return 0;}

View File

@ -0,0 +1,15 @@
summary: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)
description: |
Bug summary: [FJ7.4 Bug]: [REG] The results of gprof command with some options differ between RHEL7.4 beta and RHEL7.3.
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1465318
contact: Milos Prchlik <mprchlik@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc
duration: 5m
extra-summary: /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
extra-task: /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command

View File

@ -0,0 +1,77 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/binutils/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command
# Description: Test for BZ#1465318 ([FJ7.4 Bug] [REG] The results of gprof command)
# Author: Milos Prchlik <mprchlik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
LD="${LD:-$(which ld)}"
PACKAGE=$(rpm --qf '%{name}\n' -qf $(which $LD) | head -1)
PACKAGES=${PACKAGE}
REQUIRES="${REQUIRES:-gcc}"
rlJournalStart
rlPhaseStartSetup
rlLogInfo "PACKAGES=$PACKAGES"
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "LD=$LD"
rlLogInfo "$(type gcc)"
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp gprof.file.c $TmpDir/"
rlRun "pushd $TmpDir"
rlRun "gcc -pg -g gprof.file.c -o gprof.file"
rlRun "./gprof.file"
rlAssertExists "gmon.out"
rlPhaseEnd
rlPhaseStartTest
rlRun "gprof -A gprof.file > option-large_A"
rlRun "gprof -C gprof.file > option-large_C"
rlRun "gprof -l gprof.file > option-l"
rlLogInfo "$(cat option-large_A)"
rlLogInfo "$(cat option-large_C)"
rlLogInfo "$(cat option-l)"
rlRun "grep -E '##### -> +void fun3\(\)\{\}' option-large_A"
rlRun "grep -E '1 -> +void fun1\(\)\{int i=0;\}' option-large_A"
rlRun "grep -E 'gprof.file.c:2: \(fun1:0x[0-9a-z]+\) 1 executions' option-large_C"
rlRun "grep -E '0.00 +0.00 +0.00 +1 +0.00 +0.00 +fun1 \(gprof.file.c:2 @ [0-9a-z]+\)' option-l"
rlRun "grep -E '\[1\] +0.0 +0.00 +0.00 +1 +fun1 \(gprof.file.c:2 @ [0-9a-z]+\) \[1\]' option-l"
rlRun "grep -E '\[1\] fun1 \(gprof.file.c:2 @ [0-9a-z]+\) \[2\] fun2 \(gprof.file.c:1 @ [0-9a-z]+\)' option-l"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd