forked from rpms/glibc
Ensure that xtests can be built (RHEL-59494)
Running the tests isn't ideal, but the makefiles currently do not support building xtests without running them. Resolves: RHEL-59494
This commit is contained in:
parent
3d4f500e5c
commit
ecd5a531a3
65
glibc-RHEL-59494-1.patch
Normal file
65
glibc-RHEL-59494-1.patch
Normal file
@ -0,0 +1,65 @@
|
||||
commit 3bea50ccbc925d4fc5f85ec402b6154cbe770b71
|
||||
Author: Yu Chien Peter Lin <peterlin@andestech.com>
|
||||
Date: Fri Sep 30 20:19:50 2022 +0800
|
||||
|
||||
support: Add xpthread_cond_signal wrapper
|
||||
|
||||
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/support/Makefile b/support/Makefile
|
||||
index 154e3a4ff03cebda..bfd8d59285524f4d 100644
|
||||
--- a/support/Makefile
|
||||
+++ b/support/Makefile
|
||||
@@ -160,6 +160,7 @@ libsupport-routines = \
|
||||
xpthread_cancel \
|
||||
xpthread_check_return \
|
||||
xpthread_cond_wait \
|
||||
+ xpthread_cond_signal \
|
||||
xpthread_create \
|
||||
xpthread_detach \
|
||||
xpthread_join \
|
||||
diff --git a/support/xpthread_cond_signal.c b/support/xpthread_cond_signal.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..ed0be1a8abf8559b
|
||||
--- /dev/null
|
||||
+++ b/support/xpthread_cond_signal.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* pthread_cond_signal with error checking.
|
||||
+ Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library 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
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <support/xthread.h>
|
||||
+
|
||||
+void
|
||||
+xpthread_cond_signal (pthread_cond_t *cond)
|
||||
+{
|
||||
+ xpthread_check_return
|
||||
+ ("pthread_cond_signal", pthread_cond_signal (cond));
|
||||
+}
|
||||
diff --git a/support/xthread.h b/support/xthread.h
|
||||
index a4a4ec5b1ef16fd3..1a39b1c0ddda9725 100644
|
||||
--- a/support/xthread.h
|
||||
+++ b/support/xthread.h
|
||||
@@ -58,6 +58,7 @@ void xpthread_mutex_consistent (pthread_mutex_t *);
|
||||
void xpthread_spin_lock (pthread_spinlock_t *lock);
|
||||
void xpthread_spin_unlock (pthread_spinlock_t *lock);
|
||||
void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex);
|
||||
+void xpthread_cond_signal (pthread_cond_t *cond);
|
||||
pthread_t xpthread_create (pthread_attr_t *attr,
|
||||
void *(*thread_func) (void *), void *closure);
|
||||
void xpthread_detach (pthread_t thr);
|
107
glibc-RHEL-59494-2.patch
Normal file
107
glibc-RHEL-59494-2.patch
Normal file
@ -0,0 +1,107 @@
|
||||
commit 365b3af67ecaf176b2e2678afe903bebce598fd7
|
||||
Author: Yu Chien Peter Lin <peterlin@andestech.com>
|
||||
Date: Fri Sep 30 20:19:51 2022 +0800
|
||||
|
||||
nptl: Convert tst-setuid2 to test-driver
|
||||
|
||||
Use <support/test-driver.c> and replace pthread calls to its xpthread
|
||||
equivalents.
|
||||
|
||||
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/nptl/tst-setuid2.c b/nptl/tst-setuid2.c
|
||||
index a9e3a6c4c0a48352..2abe6e20d108ccf9 100644
|
||||
--- a/nptl/tst-setuid2.c
|
||||
+++ b/nptl/tst-setuid2.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
+#include <support/xthread.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -36,30 +37,21 @@ static pthread_cond_t cond_recv;
|
||||
static void *
|
||||
thread_func (void *ctx __attribute__ ((unused)))
|
||||
{
|
||||
- int ret = pthread_mutex_lock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_lock (thread): %d", ret);
|
||||
-
|
||||
+ xpthread_mutex_lock (&mutex);
|
||||
while (true)
|
||||
{
|
||||
if (func_sent != NULL)
|
||||
{
|
||||
void (*func) (void) = func_sent;
|
||||
- ret = pthread_mutex_unlock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_unlock (thread): %d", ret);
|
||||
+ xpthread_mutex_unlock (&mutex);
|
||||
+
|
||||
func ();
|
||||
- ret = pthread_mutex_lock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_lock (thread): %d", ret);
|
||||
+
|
||||
+ xpthread_mutex_lock (&mutex);
|
||||
func_sent = NULL;
|
||||
- ret = pthread_cond_signal (&cond_recv);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_cond_signal (recv): %d", ret);
|
||||
+ xpthread_cond_signal (&cond_recv);
|
||||
}
|
||||
- ret = pthread_cond_wait (&cond_send, &mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_cond_wait (send): %d", ret);
|
||||
+ xpthread_cond_wait (&cond_send, &mutex);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -67,31 +59,18 @@ thread_func (void *ctx __attribute__ ((unused)))
|
||||
static void
|
||||
run_on_thread (void (*func) (void))
|
||||
{
|
||||
- int ret = pthread_mutex_lock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_lock (%s): %d", __func__, ret);
|
||||
+ xpthread_mutex_lock (&mutex);
|
||||
func_sent = func;
|
||||
- ret = pthread_mutex_unlock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_unlock (%s): %d", __func__, ret);
|
||||
+ xpthread_mutex_unlock (&mutex);
|
||||
|
||||
- ret = pthread_cond_signal (&cond_send);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_lock (%s): %d", __func__, ret);
|
||||
-
|
||||
- ret = pthread_mutex_lock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_lock (%s): %d", __func__, ret);
|
||||
+ xpthread_cond_signal (&cond_send);
|
||||
|
||||
+ xpthread_mutex_lock (&mutex);
|
||||
while (func_sent != NULL)
|
||||
{
|
||||
- ret = pthread_cond_wait (&cond_recv, &mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_wait (%s): %d", __func__, ret);
|
||||
+ xpthread_cond_wait (&cond_recv, &mutex);
|
||||
}
|
||||
- ret = pthread_mutex_unlock (&mutex);
|
||||
- if (ret != 0)
|
||||
- FAIL ("pthread_mutex_unlock (%s): %d", __func__, ret);
|
||||
+ xpthread_mutex_unlock (&mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -141,5 +120,4 @@ do_test (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#define TEST_FUNCTION do_test ()
|
||||
-#include "../test-skeleton.c"
|
||||
+#include <support/test-driver.c>
|
25
glibc.spec
25
glibc.spec
@ -157,7 +157,7 @@ end \
|
||||
Summary: The GNU libc libraries
|
||||
Name: glibc
|
||||
Version: %{glibcversion}
|
||||
Release: 125%{?dist}
|
||||
Release: 126%{?dist}
|
||||
|
||||
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
||||
# libraries.
|
||||
@ -869,6 +869,8 @@ Patch630: glibc-RHEL-46979-1.patch
|
||||
Patch631: glibc-RHEL-46979-2.patch
|
||||
Patch632: glibc-RHEL-46979-3.patch
|
||||
Patch633: glibc-RHEL-46979-4.patch
|
||||
Patch634: glibc-RHEL-59494-1.patch
|
||||
Patch635: glibc-RHEL-59494-2.patch
|
||||
|
||||
##############################################################################
|
||||
# Continued list of core "glibc" package information:
|
||||
@ -2666,10 +2668,22 @@ run_tests () {
|
||||
done <rpmbuild.tests.sum.not-passing
|
||||
fi
|
||||
|
||||
# Unconditonally dump differences in the system call list.
|
||||
echo "* System call consistency checks:" >&2
|
||||
cat misc/tst-syscall-list.out >&2
|
||||
# Compile and run the xtests, so that they can be run separately later.
|
||||
# Reduce timeout factor to complete the tests in a reasonable time
|
||||
# (in case something was made an xtest due to excessive run time).
|
||||
# Do not look at the test results; they are expected to fail in most
|
||||
# cases.
|
||||
set -x
|
||||
TIMEOUT_FACTOR=1 %make_build xcheck > rpmbuild.xcheck.log 2>&1 || true
|
||||
if ! grep -q '^Summary of test results for extra tests:$' rpmbuild.xcheck.log ; then
|
||||
echo "FAIL: xcheck test suite build of target: $(basename "$(pwd)")" >& 2
|
||||
cat rpmbuild.xcheck.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Unconditonally dump differences in the system call list.
|
||||
: "* System call consistency checks:"
|
||||
cat misc/tst-syscall-list.out >&2
|
||||
}
|
||||
|
||||
# Increase timeouts
|
||||
@ -3028,6 +3042,9 @@ update_gconv_modules_cache ()
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Sep 19 2024 Florian Weimer <fweimer@redhat.com> - 2.34-126
|
||||
- Ensure that xtests can be built (RHEL-59494)
|
||||
|
||||
* Thu Sep 5 2024 DJ Delorie <dj@redhat.com> - 2.34-125
|
||||
- elf: Rework exception handling in the dynamic loader (RHEL-46979)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user