]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - pending-5.1/selftests-timers-add-missing-fflush-stdout-calls.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / pending-5.1 / selftests-timers-add-missing-fflush-stdout-calls.patch
1 From 439e124aa2e7b24c23590e600373379e525ff81c Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Mon, 20 May 2019 15:37:49 -0700
4 Subject: selftests/timers: Add missing fflush(stdout) calls
5
6 [ Upstream commit fe48319243a626c860fd666ca032daacc2ba84a5 ]
7
8 When running under a pipe, some timer tests would not report output in
9 real-time because stdout flushes were missing after printf()s that lacked
10 a newline. This adds them to restore real-time status output that humans
11 can enjoy.
12
13 Signed-off-by: Kees Cook <keescook@chromium.org>
14 Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
15 Signed-off-by: Sasha Levin <sashal@kernel.org>
16 ---
17 tools/testing/selftests/timers/adjtick.c | 1 +
18 tools/testing/selftests/timers/leapcrash.c | 1 +
19 tools/testing/selftests/timers/mqueue-lat.c | 1 +
20 tools/testing/selftests/timers/nanosleep.c | 1 +
21 tools/testing/selftests/timers/nsleep-lat.c | 1 +
22 tools/testing/selftests/timers/raw_skew.c | 1 +
23 tools/testing/selftests/timers/set-tai.c | 1 +
24 tools/testing/selftests/timers/set-tz.c | 2 ++
25 tools/testing/selftests/timers/threadtest.c | 1 +
26 tools/testing/selftests/timers/valid-adjtimex.c | 2 ++
27 10 files changed, 12 insertions(+)
28
29 diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c
30 index 0caca3a06bd2..54d8d87f36b3 100644
31 --- a/tools/testing/selftests/timers/adjtick.c
32 +++ b/tools/testing/selftests/timers/adjtick.c
33 @@ -136,6 +136,7 @@ int check_tick_adj(long tickval)
34
35 eppm = get_ppm_drift();
36 printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm);
37 + fflush(stdout);
38
39 tx1.modes = 0;
40 adjtimex(&tx1);
41 diff --git a/tools/testing/selftests/timers/leapcrash.c b/tools/testing/selftests/timers/leapcrash.c
42 index 830c462f605d..dc80728ed191 100644
43 --- a/tools/testing/selftests/timers/leapcrash.c
44 +++ b/tools/testing/selftests/timers/leapcrash.c
45 @@ -101,6 +101,7 @@ int main(void)
46 }
47 clear_time_state();
48 printf(".");
49 + fflush(stdout);
50 }
51 printf("[OK]\n");
52 return ksft_exit_pass();
53 diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/selftests/timers/mqueue-lat.c
54 index 1867db5d6f5e..7916cf5cc6ff 100644
55 --- a/tools/testing/selftests/timers/mqueue-lat.c
56 +++ b/tools/testing/selftests/timers/mqueue-lat.c
57 @@ -102,6 +102,7 @@ int main(int argc, char **argv)
58 int ret;
59
60 printf("Mqueue latency : ");
61 + fflush(stdout);
62
63 ret = mqueue_lat_test();
64 if (ret < 0) {
65 diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selftests/timers/nanosleep.c
66 index 8adb0bb51d4d..71b5441c2fd9 100644
67 --- a/tools/testing/selftests/timers/nanosleep.c
68 +++ b/tools/testing/selftests/timers/nanosleep.c
69 @@ -142,6 +142,7 @@ int main(int argc, char **argv)
70 continue;
71
72 printf("Nanosleep %-31s ", clockstring(clockid));
73 + fflush(stdout);
74
75 length = 10;
76 while (length <= (NSEC_PER_SEC * 10)) {
77 diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/selftests/timers/nsleep-lat.c
78 index c3c3dc10db17..eb3e79ed7b4a 100644
79 --- a/tools/testing/selftests/timers/nsleep-lat.c
80 +++ b/tools/testing/selftests/timers/nsleep-lat.c
81 @@ -155,6 +155,7 @@ int main(int argc, char **argv)
82 continue;
83
84 printf("nsleep latency %-26s ", clockstring(clockid));
85 + fflush(stdout);
86
87 length = 10;
88 while (length <= (NSEC_PER_SEC * 10)) {
89 diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
90 index dcf73c5dab6e..b41d8dd0c40c 100644
91 --- a/tools/testing/selftests/timers/raw_skew.c
92 +++ b/tools/testing/selftests/timers/raw_skew.c
93 @@ -112,6 +112,7 @@ int main(int argv, char **argc)
94 printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n");
95
96 printf("Estimating clock drift: ");
97 + fflush(stdout);
98 sleep(120);
99
100 get_monotonic_and_raw(&mon, &raw);
101 diff --git a/tools/testing/selftests/timers/set-tai.c b/tools/testing/selftests/timers/set-tai.c
102 index 70fed27d8fd3..8c4179ee2ca2 100644
103 --- a/tools/testing/selftests/timers/set-tai.c
104 +++ b/tools/testing/selftests/timers/set-tai.c
105 @@ -55,6 +55,7 @@ int main(int argc, char **argv)
106 printf("tai offset started at %i\n", ret);
107
108 printf("Checking tai offsets can be properly set: ");
109 + fflush(stdout);
110 for (i = 1; i <= 60; i++) {
111 ret = set_tai(i);
112 ret = get_tai();
113 diff --git a/tools/testing/selftests/timers/set-tz.c b/tools/testing/selftests/timers/set-tz.c
114 index 877fd5532fee..62bd33eb16f0 100644
115 --- a/tools/testing/selftests/timers/set-tz.c
116 +++ b/tools/testing/selftests/timers/set-tz.c
117 @@ -65,6 +65,7 @@ int main(int argc, char **argv)
118 printf("tz_minuteswest started at %i, dst at %i\n", min, dst);
119
120 printf("Checking tz_minuteswest can be properly set: ");
121 + fflush(stdout);
122 for (i = -15*60; i < 15*60; i += 30) {
123 ret = set_tz(i, dst);
124 ret = get_tz_min();
125 @@ -76,6 +77,7 @@ int main(int argc, char **argv)
126 printf("[OK]\n");
127
128 printf("Checking invalid tz_minuteswest values are caught: ");
129 + fflush(stdout);
130
131 if (!set_tz(-15*60-1, dst)) {
132 printf("[FAILED] %i didn't return failure!\n", -15*60-1);
133 diff --git a/tools/testing/selftests/timers/threadtest.c b/tools/testing/selftests/timers/threadtest.c
134 index 759c9c06f1a0..cf3e48919874 100644
135 --- a/tools/testing/selftests/timers/threadtest.c
136 +++ b/tools/testing/selftests/timers/threadtest.c
137 @@ -163,6 +163,7 @@ int main(int argc, char **argv)
138 strftime(buf, 255, "%a, %d %b %Y %T %z", localtime(&start));
139 printf("%s\n", buf);
140 printf("Testing consistency with %i threads for %ld seconds: ", thread_count, runtime);
141 + fflush(stdout);
142
143 /* spawn */
144 for (i = 0; i < thread_count; i++)
145 diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
146 index d9d3ab93b31a..5397de708d3c 100644
147 --- a/tools/testing/selftests/timers/valid-adjtimex.c
148 +++ b/tools/testing/selftests/timers/valid-adjtimex.c
149 @@ -123,6 +123,7 @@ int validate_freq(void)
150 /* Set the leap second insert flag */
151
152 printf("Testing ADJ_FREQ... ");
153 + fflush(stdout);
154 for (i = 0; i < NUM_FREQ_VALID; i++) {
155 tx.modes = ADJ_FREQUENCY;
156 tx.freq = valid_freq[i];
157 @@ -250,6 +251,7 @@ int set_bad_offset(long sec, long usec, int use_nano)
158 int validate_set_offset(void)
159 {
160 printf("Testing ADJ_SETOFFSET... ");
161 + fflush(stdout);
162
163 /* Test valid values */
164 if (set_offset(NSEC_PER_SEC - 1, 1))
165 --
166 2.20.1
167