Fix infinite loop in testsuite

Resolves: #871067

upstream commit: ebaf32fcb8ebb922bcc4e28ad49fabe3de126e9e
This commit is contained in:
Pavel Raiskup 2012-10-29 15:44:24 +01:00
parent 1977fdf652
commit efcbd2ba43
2 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,67 @@
diff --git a/libatomic_ops/tests/test_atomic.c b/libatomic_ops/tests/test_atomic.c
index e354024..b8906e9 100644
--- a/libatomic_ops/tests/test_atomic.c
+++ b/libatomic_ops/tests/test_atomic.c
@@ -77,7 +77,10 @@ void * acqrel_thr(void *id)
{
AO_t my_counter1;
if (me != 1)
- fprintf(stderr, "acqrel test: too many threads\n");
+ {
+ fprintf(stderr, "acqrel test: too many threads\n");
+ abort();
+ }
my_counter1 = AO_load(&counter1);
AO_store(&counter1, my_counter1 + 1);
AO_store_release_write(&counter2, my_counter1 + 1);
diff --git a/libatomic_ops/tests/test_malloc.c b/libatomic_ops/tests/test_malloc.c
index a1f4179..a19ffd5 100644
--- a/libatomic_ops/tests/test_malloc.c
+++ b/libatomic_ops/tests/test_malloc.c
@@ -151,6 +151,7 @@ void * run_one_test(void * arg) {
if (0 == p) {
# ifdef HAVE_MMAP
fprintf(stderr, "AO_malloc(%d) failed\n", LARGE_OBJ_SIZE);
+ abort();
# else
fprintf(stderr, "AO_malloc(%d) failed: This is normal without mmap\n",
LARGE_OBJ_SIZE);
diff --git a/libatomic_ops/tests/test_stack.c b/libatomic_ops/tests/test_stack.c
index bf3180d..e654c35 100644
--- a/libatomic_ops/tests/test_stack.c
+++ b/libatomic_ops/tests/test_stack.c
@@ -97,14 +97,23 @@ void check_list(int n)
p = (list_element *)AO_REAL_NEXT_PTR(p -> next))
{
if (p -> data > n || p -> data <= 0)
- fprintf(stderr, "Found erroneous list element %d\n", p -> data);
+ {
+ fprintf(stderr, "Found erroneous list element %d\n", i);
+ abort();
+ }
if (marks[p -> data] != 0)
- fprintf(stderr, "Found duplicate list element %d\n", p -> data);
+ {
+ fprintf(stderr, "Found duplicate list element %d\n", i);
+ abort();
+ }
marks[p -> data] = 1;
}
for (i = 1; i <= n; ++i)
if (marks[i] != 1)
- fprintf(stderr, "Missing list element %d\n", i);
+ {
+ fprintf(stderr, "Missing list element %d\n", i);
+ abort();
+ }
}
volatile AO_t ops_performed = 0;
@@ -218,6 +227,7 @@ int main(int argc, char **argv)
int code;
if ((code = pthread_join(thread[i], 0)) != 0) {
fprintf(stderr, "Thread join failed %u\n", code);
+ abort();
}
}
times[nthreads][exper_n] = (unsigned long)(get_msecs() - start_time);

View File

@ -2,12 +2,13 @@ Summary: A garbage collector for C and C++
Name: gc Name: gc
%global base_ver 7.2 %global base_ver 7.2
Version: 7.2c Version: 7.2c
Release: 4%{?dist} Release: 5%{?dist}
Group: System Environment/Libraries Group: System Environment/Libraries
License: BSD License: BSD
Url: http://www.hpl.hp.com/personal/Hans_Boehm/gc/ Url: http://www.hpl.hp.com/personal/Hans_Boehm/gc/
Source0: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-%{version}%{?pre}.tar.gz Source0: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-%{version}%{?pre}.tar.gz
Patch1: gc-7.2c-test-stack-infinite-loop.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
## upstreamable patches ## upstreamable patches
@ -51,6 +52,7 @@ that involves minimum overhead across a variety of architectures.
%prep %prep
%setup -q -n gc-%{base_ver}%{?pre} %setup -q -n gc-%{base_ver}%{?pre}
%patch1 -p1 -b .infinite-loop-in-tests
# refresh auto*/libtool to purge rpaths # refresh auto*/libtool to purge rpaths
rm -f libtool libtool.m4 rm -f libtool libtool.m4
@ -139,6 +141,9 @@ rm -rf %{buildroot}
%changelog %changelog
* Mon Oct 29 2012 Pavel Raiskup <praiskup@redhat.com> - 7.2c-5
- fix possible infinite loop in test suite (#871067)
* Mon Oct 29 2012 Pavel Raiskup <praiskup@redhat.com> - 7.2c-4 * Mon Oct 29 2012 Pavel Raiskup <praiskup@redhat.com> - 7.2c-4
- trim lines, s/[tabs]/[spaces]/ - trim lines, s/[tabs]/[spaces]/