Make test tst-cpuclock2 run more reliably (RHEL-84305)
Resolves: RHEL-84305
This commit is contained in:
parent
f98d82d9fc
commit
e959d3bd71
161
glibc-RHEL-84305.patch
Normal file
161
glibc-RHEL-84305.patch
Normal file
@ -0,0 +1,161 @@
|
||||
commit f3c6c190388bb445568cfbf190a0942fc3c28553
|
||||
Author: DJ Delorie <dj@redhat.com>
|
||||
Date: Tue Oct 5 14:52:05 2021 -0400
|
||||
|
||||
Remove unreliable parts of rt/tst-cpuclock2
|
||||
|
||||
This is a follow-up to the tst-cpuclock1.c change here:
|
||||
9a29f1a2ae3d4bb253ee368e0d71db0ca9494120
|
||||
|
||||
This test, like tst-cpuclock1, may fail on heavily loaded VM
|
||||
servers (and has occasionally failed on the 32bit trybot),
|
||||
so tests that rely on "wall time" have been removed.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c
|
||||
index 6981b00376aca030..90ff101841ce8b43 100644
|
||||
--- a/rt/tst-cpuclock2.c
|
||||
+++ b/rt/tst-cpuclock2.c
|
||||
@@ -64,22 +64,9 @@ chew_cpu (void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static unsigned long long int
|
||||
-tsdiff (const struct timespec *before, const struct timespec *after)
|
||||
-{
|
||||
- struct timespec diff = { .tv_sec = after->tv_sec - before->tv_sec,
|
||||
- .tv_nsec = after->tv_nsec - before->tv_nsec };
|
||||
- while (diff.tv_nsec < 0)
|
||||
- {
|
||||
- --diff.tv_sec;
|
||||
- diff.tv_nsec += 1000000000;
|
||||
- }
|
||||
- return diff.tv_sec * 1000000000ULL + diff.tv_nsec;
|
||||
-}
|
||||
-
|
||||
-static unsigned long long int
|
||||
+static void
|
||||
test_nanosleep (clockid_t clock, const char *which,
|
||||
- const struct timespec *before, int *bad)
|
||||
+ int *bad)
|
||||
{
|
||||
const struct timespec sleeptime = { .tv_nsec = 100000000 };
|
||||
int e = clock_nanosleep (clock, 0, &sleeptime, NULL);
|
||||
@@ -87,13 +74,13 @@ test_nanosleep (clockid_t clock, const char *which,
|
||||
{
|
||||
printf ("clock_nanosleep not supported for %s CPU clock: %s\n",
|
||||
which, strerror (e));
|
||||
- return 0;
|
||||
+ return;
|
||||
}
|
||||
if (e != 0)
|
||||
{
|
||||
printf ("clock_nanosleep on %s CPU clock: %s\n", which, strerror (e));
|
||||
*bad = 1;
|
||||
- return 0;
|
||||
+ return;
|
||||
}
|
||||
|
||||
struct timespec after;
|
||||
@@ -102,16 +89,7 @@ test_nanosleep (clockid_t clock, const char *which,
|
||||
printf ("clock_gettime on %s CPU clock %lx => %s\n",
|
||||
which, (unsigned long int) clock, strerror (errno));
|
||||
*bad = 1;
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- unsigned long long int diff = tsdiff (before, &after);
|
||||
- if (diff < sleeptime.tv_nsec || diff > sleeptime.tv_nsec * 2)
|
||||
- {
|
||||
- printf ("clock_nanosleep on %s slept %llu (outside reasonable range)\n",
|
||||
- which, diff);
|
||||
- *bad = 1;
|
||||
- return diff;
|
||||
+ return;
|
||||
}
|
||||
|
||||
struct timespec sleeptimeabs = sleeptime;
|
||||
@@ -128,7 +106,7 @@ test_nanosleep (clockid_t clock, const char *which,
|
||||
printf ("absolute clock_nanosleep on %s CPU clock: %s\n",
|
||||
which, strerror (e));
|
||||
*bad = 1;
|
||||
- return diff;
|
||||
+ return;
|
||||
}
|
||||
|
||||
struct timespec afterabs;
|
||||
@@ -137,28 +115,10 @@ test_nanosleep (clockid_t clock, const char *which,
|
||||
printf ("clock_gettime on %s CPU clock %lx => %s\n",
|
||||
which, (unsigned long int) clock, strerror (errno));
|
||||
*bad = 1;
|
||||
- return diff;
|
||||
- }
|
||||
-
|
||||
- unsigned long long int sleepdiff = tsdiff (&sleeptimeabs, &afterabs);
|
||||
- if (sleepdiff > sleeptime.tv_nsec)
|
||||
- {
|
||||
- printf ("\
|
||||
-absolute clock_nanosleep on %s %llu past target (outside reasonable range)\n",
|
||||
- which, sleepdiff);
|
||||
- *bad = 1;
|
||||
+ return;
|
||||
}
|
||||
|
||||
- unsigned long long int diffabs = tsdiff (&after, &afterabs);
|
||||
- if (diffabs < sleeptime.tv_nsec || diffabs > sleeptime.tv_nsec * 2)
|
||||
- {
|
||||
- printf ("\
|
||||
-absolute clock_nanosleep on %s slept %llu (outside reasonable range)\n",
|
||||
- which, diffabs);
|
||||
- *bad = 1;
|
||||
- }
|
||||
-
|
||||
- return diff + diffabs;
|
||||
+ return;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,37 +252,12 @@ do_test (void)
|
||||
printf ("self thread after sleep => %ju.%.9ju\n",
|
||||
(uintmax_t) me_after.tv_sec, (uintmax_t) me_after.tv_nsec);
|
||||
|
||||
- unsigned long long int th_diff = tsdiff (&before, &after);
|
||||
- unsigned long long int pdiff = tsdiff (&process_before, &process_after);
|
||||
- unsigned long long int my_diff = tsdiff (&me_before, &me_after);
|
||||
-
|
||||
- if (th_diff < 100000000 || th_diff > 600000000)
|
||||
- {
|
||||
- printf ("live thread before - after %llu outside reasonable range\n",
|
||||
- th_diff);
|
||||
- result = 1;
|
||||
- }
|
||||
-
|
||||
- if (my_diff > 100000000)
|
||||
- {
|
||||
- printf ("self thread before - after %llu outside reasonable range\n",
|
||||
- my_diff);
|
||||
- result = 1;
|
||||
- }
|
||||
-
|
||||
- if (pdiff < th_diff)
|
||||
- {
|
||||
- printf ("process before - after %llu outside reasonable range (%llu)\n",
|
||||
- pdiff, th_diff);
|
||||
- result = 1;
|
||||
- }
|
||||
-
|
||||
- process_after.tv_nsec += test_nanosleep (th_clock, "live thread",
|
||||
- &after, &result);
|
||||
- process_after.tv_nsec += test_nanosleep (process_clock, "process",
|
||||
- &process_after, &result);
|
||||
+ test_nanosleep (th_clock, "live thread",
|
||||
+ &result);
|
||||
+ test_nanosleep (process_clock, "process",
|
||||
+ &result);
|
||||
test_nanosleep (CLOCK_PROCESS_CPUTIME_ID,
|
||||
- "PROCESS_CPUTIME_ID", &process_after, &result);
|
||||
+ "PROCESS_CPUTIME_ID", &result);
|
||||
|
||||
pthread_cancel (th);
|
||||
|
@ -157,7 +157,7 @@ end \
|
||||
Summary: The GNU libc libraries
|
||||
Name: glibc
|
||||
Version: %{glibcversion}
|
||||
Release: 180%{?dist}
|
||||
Release: 181%{?dist}
|
||||
|
||||
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
||||
# libraries.
|
||||
@ -1153,6 +1153,7 @@ Patch845: glibc-RHEL-61561.patch
|
||||
Patch846: glibc-RHEL-83527-1.patch
|
||||
Patch847: glibc-RHEL-83527-2.patch
|
||||
Patch848: glibc-RHEL-83007.patch
|
||||
Patch849: glibc-RHEL-84305.patch
|
||||
|
||||
##############################################################################
|
||||
# Continued list of core "glibc" package information:
|
||||
@ -3146,6 +3147,9 @@ update_gconv_modules_cache ()
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Mar 20 2025 Arjun Shankar <arjun@redhat.com> - 2.34-181
|
||||
- Make test tst-cpuclock2 run more reliably (RHEL-84305)
|
||||
|
||||
* Fri Mar 14 2025 Arjun Shankar <arjun@redhat.com> - 2.34-180
|
||||
- Fix a race condition in a threaded fopen test (RHEL-83007)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user