]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selftests/timers: Add missing fflush(stdout) calls
authorKees Cook <keescook@chromium.org>
Mon, 20 May 2019 22:37:49 +0000 (15:37 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838824
[ Upstream commit fe48319243a626c860fd666ca032daacc2ba84a5 ]

When running under a pipe, some timer tests would not report output in
real-time because stdout flushes were missing after printf()s that lacked
a newline. This adds them to restore real-time status output that humans
can enjoy.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
tools/testing/selftests/timers/adjtick.c
tools/testing/selftests/timers/leapcrash.c
tools/testing/selftests/timers/mqueue-lat.c
tools/testing/selftests/timers/nanosleep.c
tools/testing/selftests/timers/nsleep-lat.c
tools/testing/selftests/timers/raw_skew.c
tools/testing/selftests/timers/set-tai.c
tools/testing/selftests/timers/set-tz.c
tools/testing/selftests/timers/threadtest.c
tools/testing/selftests/timers/valid-adjtimex.c

index 0caca3a06bd26eebdff08ce7700aff14f58eb558..54d8d87f36b3ca628da694181bfd134039093a23 100644 (file)
@@ -136,6 +136,7 @@ int check_tick_adj(long tickval)
 
        eppm = get_ppm_drift();
        printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm);
+       fflush(stdout);
 
        tx1.modes = 0;
        adjtimex(&tx1);
index 830c462f605d9476b712f909db2a62c09e053959..dc80728ed1915551bf83c1ea855450d0ccc31c8a 100644 (file)
@@ -101,6 +101,7 @@ int main(void)
                }
                clear_time_state();
                printf(".");
+               fflush(stdout);
        }
        printf("[OK]\n");
        return ksft_exit_pass();
index 1867db5d6f5e0fcf9a9f494e54a570dc07aae0d6..7916cf5cc6fff189708caeb61804d25381b558dd 100644 (file)
@@ -102,6 +102,7 @@ int main(int argc, char **argv)
        int ret;
 
        printf("Mqueue latency :                          ");
+       fflush(stdout);
 
        ret = mqueue_lat_test();
        if (ret < 0) {
index 8adb0bb51d4da4a1ab4eddde5d15be21a5ffcfb1..71b5441c2fd9f6f3abb39a9c661556b3e5e13931 100644 (file)
@@ -142,6 +142,7 @@ int main(int argc, char **argv)
                        continue;
 
                printf("Nanosleep %-31s ", clockstring(clockid));
+               fflush(stdout);
 
                length = 10;
                while (length <= (NSEC_PER_SEC * 10)) {
index c3c3dc10db17fe1493994fa2209bd06ce35b94fb..eb3e79ed7b4a9eb5b58b332490b51f1f2a0db204 100644 (file)
@@ -155,6 +155,7 @@ int main(int argc, char **argv)
                        continue;
 
                printf("nsleep latency %-26s ", clockstring(clockid));
+               fflush(stdout);
 
                length = 10;
                while (length <= (NSEC_PER_SEC * 10)) {
index dcf73c5dab6e12e9074d15efae1ba9c65a139d60..b41d8dd0c40c564e8abd607fef00140b8a344b33 100644 (file)
@@ -112,6 +112,7 @@ int main(int argv, char **argc)
                printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n");
 
        printf("Estimating clock drift: ");
+       fflush(stdout);
        sleep(120);
 
        get_monotonic_and_raw(&mon, &raw);
index 70fed27d8fd3cf8db9401542759ed53946e3e512..8c4179ee2ca294a48a4cd9686cbd9377f6434e3d 100644 (file)
@@ -55,6 +55,7 @@ int main(int argc, char **argv)
        printf("tai offset started at %i\n", ret);
 
        printf("Checking tai offsets can be properly set: ");
+       fflush(stdout);
        for (i = 1; i <= 60; i++) {
                ret = set_tai(i);
                ret = get_tai();
index 877fd5532fee03ee9fe25bed1505fcedf78dde60..62bd33eb16f0a5754255c11651c11dc288550f52 100644 (file)
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
        printf("tz_minuteswest started at %i, dst at %i\n", min, dst);
 
        printf("Checking tz_minuteswest can be properly set: ");
+       fflush(stdout);
        for (i = -15*60; i < 15*60; i += 30) {
                ret = set_tz(i, dst);
                ret = get_tz_min();
@@ -76,6 +77,7 @@ int main(int argc, char **argv)
        printf("[OK]\n");
 
        printf("Checking invalid tz_minuteswest values are caught: ");
+       fflush(stdout);
 
        if (!set_tz(-15*60-1, dst)) {
                printf("[FAILED] %i didn't return failure!\n", -15*60-1);
index 759c9c06f1a034d4a566d81c1fb556f0c46bceff..cf3e48919874b3a1a23f8a10bb1e2fce5f9dfadd 100644 (file)
@@ -163,6 +163,7 @@ int main(int argc, char **argv)
        strftime(buf, 255, "%a, %d %b %Y %T %z", localtime(&start));
        printf("%s\n", buf);
        printf("Testing consistency with %i threads for %ld seconds: ", thread_count, runtime);
+       fflush(stdout);
 
        /* spawn */
        for (i = 0; i < thread_count; i++)
index d9d3ab93b31a75a766bb8c1cbf8e30ce2c24bed3..5397de708d3c25bee1f9df965ea98ef1415cac16 100644 (file)
@@ -123,6 +123,7 @@ int validate_freq(void)
        /* Set the leap second insert flag */
 
        printf("Testing ADJ_FREQ... ");
+       fflush(stdout);
        for (i = 0; i < NUM_FREQ_VALID; i++) {
                tx.modes = ADJ_FREQUENCY;
                tx.freq = valid_freq[i];
@@ -250,6 +251,7 @@ int set_bad_offset(long sec, long usec, int use_nano)
 int validate_set_offset(void)
 {
        printf("Testing ADJ_SETOFFSET... ");
+       fflush(stdout);
 
        /* Test valid values */
        if (set_offset(NSEC_PER_SEC - 1, 1))