From 57106a8254006fb7375c2629e714f5272702d2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Wed, 14 Apr 2021 06:31:29 +0200 Subject: [PATCH] Import RHEL's regression test for #1465318 --- .../Makefile | 65 ++++++++++++++++ .../PURPOSE | 5 ++ .../gprof.file.c | 4 + .../main.fmf | 15 ++++ .../runtest.sh | 77 +++++++++++++++++++ 5 files changed, 166 insertions(+) create mode 100644 tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/Makefile create mode 100644 tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/PURPOSE create mode 100644 tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/gprof.file.c create mode 100644 tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/main.fmf create mode 100755 tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/runtest.sh diff --git a/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/Makefile b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/Makefile new file mode 100644 index 0000000..0bd4caa --- /dev/null +++ b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/Makefile @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/PURPOSE b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/PURPOSE new file mode 100644 index 0000000..98ed854 --- /dev/null +++ b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/PURPOSE @@ -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 +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 diff --git a/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/gprof.file.c b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/gprof.file.c new file mode 100644 index 0000000..005c451 --- /dev/null +++ b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/gprof.file.c @@ -0,0 +1,4 @@ +static void fun2(){int i=0;} + void fun1(){int i=0;} + void fun3(){} + int main(){ fun1(); fun2(); return 0;} diff --git a/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/main.fmf b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/main.fmf new file mode 100644 index 0000000..8dfb13a --- /dev/null +++ b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/main.fmf @@ -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 +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 diff --git a/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/runtest.sh b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/runtest.sh new file mode 100755 index 0000000..78a4bea --- /dev/null +++ b/tests/Regression/bz1465318-FJ7-4-Bug-REG-The-results-of-gprof-command/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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