Import RHEL's regression test for #241252

This commit is contained in:
Václav Kadlčík 2021-05-04 12:54:49 +02:00 committed by mcermak
parent 95e9eaea23
commit 8e50243c45
5 changed files with 269 additions and 0 deletions

View File

@ -0,0 +1,62 @@
# Copyright (c) 2009 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.
#
# Testcases for this bugzilla were provided by Jakub Jelinek <jakub@redhat.com>
# I've only wrapped them to RHTS
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=binutils
RELATIVE_PATH=bugzillas/241252
export TESTVERSION=1.0
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
.PHONY: all install download clean
FILES=$(METADATA) \
runtest.sh \
Makefile \
x.i \
y.i
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: Regression test for bz241252." >> $(METADATA)
@echo "TestTime: 3m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME) gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "Releases: -RHEL4" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,12 @@
summary: Regression test for bz241252.
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- gcc
duration: 3m
extra-summary: /tools/binutils/bugzillas/241252
extra-task: /tools/binutils/bugzillas/241252

View File

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
rlJournalStart
rlPhaseStartSetup Setup
rlAssertRpm $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp x.i y.i $TmpDir
rlRun "pushd $TmpDir"
rlRun "gcc -c -O2 -fpic -o x.o x.i -g" 0 "Compile test case 'x'"
rlRun "gcc -c -O2 -fpic -o y.o y.i -g" 0 "Compile test case 'y'"
rlRun "gcc -Wl,--unique -o x [xy].o" 0 "Link 'x' and 'y'"
# Note: debug_ranges replaced by debug_rnglist (since DWARF 5 in Fedora 34)
rlLogInfo 'x.o + y.o:'
rlLogInfo "$( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS )"
rlLogInfo 'x:'
rlLogInfo "$( readelf -WS x | grep debug_rnglist )"
rlPhaseEnd
rlPhaseStartTest Testing
if [ $( readelf -WS [xy].o | grep debug_rnglist | grep PROGBITS | wc -l ) -eq 2 ] \
&& [ $( readelf -WS x | grep debug_rnglist | wc -l ) -eq 1 ]; then
rlPass "Debug ranges sections were merged"
else
rlFail "Debug ranges sections were not merged"
fi
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlRun "popd"
rlRun "rm -r $TmpDir $rlRun_LOG" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,62 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
foo (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}

View File

@ -0,0 +1,71 @@
extern void __assert_fail (const char *, const char *, unsigned int, const char *)
__attribute__ ((__nothrow__, __noreturn__));
struct gst;
struct gs;
extern void bar (void *) __attribute__ ((__nothrow__));
void bar (void *x)
{
}
typedef int (*gf) (struct gst *, struct gs *,
const unsigned char **, const unsigned char *,
unsigned char **, unsigned long *, int, int);
struct gst
{
gf fct;
int min_needed_from;
};
struct gs
{
unsigned char *outbuf;
unsigned char *outbufend;
int flags;
int invocation_counter;
int internal_use;
};
typedef struct gi
{
unsigned long nsteps;
struct gst *steps;
struct gs data [10];
} *gt;
int
baz (gt cd, const unsigned char **inbuf,
const unsigned char *inbufend, unsigned char **outbuf,
unsigned char *outbufend, unsigned long *irreversible)
{
unsigned long last_step;
int result;
last_step = cd->nsteps - 1;
*irreversible = 0;
cd->data[last_step].outbuf = outbuf != ((void *)0) ? *outbuf : ((void *)0);
cd->data[last_step].outbufend = outbufend;
gf fct = cd->steps->fct;
if (inbuf == ((void *)0) || *inbuf == ((void *)0))
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, ((void *)0), ((void *)0), ((void *)0), irreversible, cd->data[last_step].outbuf == ((void *)0) ? 2 : 1, 0));
else
{
const unsigned char *last_start;
((outbuf != ((void *)0) && *outbuf != ((void *)0)) ? (void) (0) : __assert_fail ("outbuf != ((void *)0) && *outbuf != ((void *)0)", "gconv.c", 67, "foo"));
do
{
last_start = *inbuf;
result = (bar ((void *) (fct)), (*(fct)) (cd->steps, cd->data, inbuf, inbufend, ((void *)0), irreversible, 0, 0));
}
while (result == 4 && last_start != *inbuf
&& *inbuf + cd->steps->min_needed_from <= inbufend);
}
return result;
}
int
main (void)
{
}