Backport pthread_getcpuclockid tests
Resolves: RHEL-70395
This commit is contained in:
parent
473cc7998b
commit
13a2c1bb05
85
glibc-RHEL-70395-1.patch
Normal file
85
glibc-RHEL-70395-1.patch
Normal file
@ -0,0 +1,85 @@
|
||||
commit 03b8d764109be48a53b18abd4b5050e8cdc2c6da
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Thu Nov 21 17:13:33 2024 -0500
|
||||
|
||||
nptl: Add smoke test for pthread_getcpuclockid failure
|
||||
|
||||
Exercise the case where an exited thread will cause
|
||||
pthread_getcpuclockid to fail.
|
||||
|
||||
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
Conflicts:
|
||||
nptl/Makefile (new test added)
|
||||
|
||||
diff --git a/nptl/Makefile b/nptl/Makefile
|
||||
index 9a56d34313d06444..f89bb07747cf5522 100644
|
||||
--- a/nptl/Makefile
|
||||
+++ b/nptl/Makefile
|
||||
@@ -306,7 +306,8 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
|
||||
tst-pthread-gdb-attach tst-pthread-gdb-attach-static \
|
||||
tst-pthread_exit-nothreads \
|
||||
tst-pthread_exit-nothreads-static \
|
||||
- tst-thread-setspecific
|
||||
+ tst-thread-setspecific \
|
||||
+ tst-pthread-getcpuclockid-invalid \
|
||||
|
||||
tests-nolibpthread = \
|
||||
tst-pthread_exit-nothreads \
|
||||
diff --git a/nptl/tst-pthread-getcpuclockid-invalid.c b/nptl/tst-pthread-getcpuclockid-invalid.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..e88a56342767a83e
|
||||
--- /dev/null
|
||||
+++ b/nptl/tst-pthread-getcpuclockid-invalid.c
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* Smoke test to verify that pthread_getcpuclockid fails with ESRCH when the
|
||||
+ thread in question has exited.
|
||||
+ Copyright the GNU Toolchain Authors.
|
||||
+ 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 <errno.h>
|
||||
+#include <pthread.h>
|
||||
+#include <sched.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+#include <support/check.h>
|
||||
+#include <support/test-driver.h>
|
||||
+#include <support/xthread.h>
|
||||
+
|
||||
+void *
|
||||
+thr (void *in)
|
||||
+{
|
||||
+ return in;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ clockid_t c;
|
||||
+ pthread_t t = xpthread_create (NULL, thr, NULL);
|
||||
+
|
||||
+ int ret = 0;
|
||||
+ while ((ret = pthread_getcpuclockid (t, &c)) == 0)
|
||||
+ sched_yield ();
|
||||
+
|
||||
+ TEST_COMPARE (ret, ESRCH);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
51
glibc-RHEL-70395-2.patch
Normal file
51
glibc-RHEL-70395-2.patch
Normal file
@ -0,0 +1,51 @@
|
||||
commit 19a198f05802fcc05441c364ed75311ef3f6d663
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Thu Nov 28 06:30:40 2024 -0500
|
||||
|
||||
pthread_getcpuclockid: Add descriptive comment to smoke test
|
||||
|
||||
Add a descriptive comment to the tst-pthread-cpuclockid-invalid test and
|
||||
also drop pthread_getcpuclockid from the TODO-testing list since it now
|
||||
has full coverage.
|
||||
|
||||
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
|
||||
diff --git a/nptl/TODO-testing b/nptl/TODO-testing
|
||||
index e076e5624f1cfbaa..f50d2ceb51b247c3 100644
|
||||
--- a/nptl/TODO-testing
|
||||
+++ b/nptl/TODO-testing
|
||||
@@ -10,10 +10,6 @@ pthread_attr_[sg]etstack
|
||||
|
||||
some more tests needed
|
||||
|
||||
-pthread_getcpuclockid
|
||||
-
|
||||
- check that value is reset -> rt subdir
|
||||
-
|
||||
pthread_getschedparam
|
||||
pthread_setschedparam
|
||||
|
||||
diff --git a/nptl/tst-pthread-getcpuclockid-invalid.c b/nptl/tst-pthread-getcpuclockid-invalid.c
|
||||
index e88a56342767a83e..7ac46acad8fe0fd7 100644
|
||||
--- a/nptl/tst-pthread-getcpuclockid-invalid.c
|
||||
+++ b/nptl/tst-pthread-getcpuclockid-invalid.c
|
||||
@@ -1,5 +1,4 @@
|
||||
-/* Smoke test to verify that pthread_getcpuclockid fails with ESRCH when the
|
||||
- thread in question has exited.
|
||||
+/* pthread_getcpuclockid should fail with ESRCH when the thread exits.
|
||||
Copyright the GNU Toolchain Authors.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -17,6 +16,12 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+/* The input thread descriptor to pthread_getcpuclockid needs to be valid when
|
||||
+ the function is called. For the purposes of this test, this means that the
|
||||
+ thread should not be detached, have exited, but not joined. This should be
|
||||
+ good enough to complete coverage for pthread_getcpuclockid alongside
|
||||
+ tst-clock2. */
|
||||
+
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
@ -1046,6 +1046,8 @@ Patch738: glibc-RHEL-58671.patch
|
||||
Patch739: glibc-RHEL-46740.patch
|
||||
Patch740: glibc-RHEL-65910.patch
|
||||
Patch741: glibc-RHEL-69028.patch
|
||||
Patch742: glibc-RHEL-70395-1.patch
|
||||
Patch743: glibc-RHEL-70395-2.patch
|
||||
|
||||
##############################################################################
|
||||
# Continued list of core "glibc" package information:
|
||||
@ -3054,6 +3056,7 @@ update_gconv_modules_cache ()
|
||||
- Backport: Identify unsafe macros in the glibc documentation (RHEL-46740)
|
||||
- Backport: testsuite fixes for rhel-57588, rhel-57589, and rhel-57590 (RHEL-65910)
|
||||
- Backport new multi-threaded test for sem_getvalue (RHEL-69028)
|
||||
- Backport pthread_getcpuclockid tests (RHEL-70395)
|
||||
|
||||
* Thu Dec 19 2024 DJ Delorie <dj@redhat.com> - 2.34-148
|
||||
- Increase ungetc test coverage, guarantee single char pushback (RHEL-46738)
|
||||
|
Loading…
Reference in New Issue
Block a user