summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-24 18:21:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-24 18:21:05 -0400
commit7f8b40e3dbcd7dbeabe6be8f157376ef0b890e06 (patch)
treec86f25d4a081b07727d21d229b4e8fdcfb798d22 /tools
parente7bd3e248bc36451fdbf2a2e3a3c5a23cd0b1f6f (diff)
parentfe48319243a626c860fd666ca032daacc2ba84a5 (diff)
Merge tag 'linux-kselftest-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest fixes from Shuah Khan: - Two fixes to regressions introduced in kselftest Makefile test run output refactoring work (Kees Cook) - Adding Atom support to syscall_arg_fault test (Tong Bo) * tag 'linux-kselftest-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/timers: Add missing fflush(stdout) calls selftests: Remove forced unbuffering for test running selftests/x86: Support Atom for syscall_arg_fault test
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/kselftest/runner.sh12
-rw-r--r--tools/testing/selftests/timers/adjtick.c1
-rw-r--r--tools/testing/selftests/timers/leapcrash.c1
-rw-r--r--tools/testing/selftests/timers/mqueue-lat.c1
-rw-r--r--tools/testing/selftests/timers/nanosleep.c1
-rw-r--r--tools/testing/selftests/timers/nsleep-lat.c1
-rw-r--r--tools/testing/selftests/timers/raw_skew.c1
-rw-r--r--tools/testing/selftests/timers/set-tai.c1
-rw-r--r--tools/testing/selftests/timers/set-tz.c2
-rw-r--r--tools/testing/selftests/timers/threadtest.c1
-rw-r--r--tools/testing/selftests/timers/valid-adjtimex.c2
-rw-r--r--tools/testing/selftests/x86/syscall_arg_fault.c10
12 files changed, 21 insertions, 13 deletions
diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
index eff3ee303d0d..00c9020bdda8 100644
--- a/tools/testing/selftests/kselftest/runner.sh
+++ b/tools/testing/selftests/kselftest/runner.sh
@@ -24,16 +24,6 @@ tap_prefix()
24 fi 24 fi
25} 25}
26 26
27# If stdbuf is unavailable, we must fall back to line-at-a-time piping.
28tap_unbuffer()
29{
30 if ! which stdbuf >/dev/null ; then
31 "$@"
32 else
33 stdbuf -i0 -o0 -e0 "$@"
34 fi
35}
36
37run_one() 27run_one()
38{ 28{
39 DIR="$1" 29 DIR="$1"
@@ -54,7 +44,7 @@ run_one()
54 echo "not ok $test_num $TEST_HDR_MSG" 44 echo "not ok $test_num $TEST_HDR_MSG"
55 else 45 else
56 cd `dirname $TEST` > /dev/null 46 cd `dirname $TEST` > /dev/null
57 (((((tap_unbuffer ./$BASENAME_TEST 2>&1; echo $? >&3) | 47 (((((./$BASENAME_TEST 2>&1; echo $? >&3) |
58 tap_prefix >&4) 3>&1) | 48 tap_prefix >&4) 3>&1) |
59 (read xs; exit $xs)) 4>>"$logfile" && 49 (read xs; exit $xs)) 4>>"$logfile" &&
60 echo "ok $test_num $TEST_HDR_MSG") || 50 echo "ok $test_num $TEST_HDR_MSG") ||
diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selftests/timers/adjtick.c
index 0caca3a06bd2..54d8d87f36b3 100644
--- a/tools/testing/selftests/timers/adjtick.c
+++ b/tools/testing/selftests/timers/adjtick.c
@@ -136,6 +136,7 @@ int check_tick_adj(long tickval)
136 136
137 eppm = get_ppm_drift(); 137 eppm = get_ppm_drift();
138 printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm); 138 printf("%lld usec, %lld ppm", systick + (systick * eppm / MILLION), eppm);
139 fflush(stdout);
139 140
140 tx1.modes = 0; 141 tx1.modes = 0;
141 adjtimex(&tx1); 142 adjtimex(&tx1);
diff --git a/tools/testing/selftests/timers/leapcrash.c b/tools/testing/selftests/timers/leapcrash.c
index 830c462f605d..dc80728ed191 100644
--- a/tools/testing/selftests/timers/leapcrash.c
+++ b/tools/testing/selftests/timers/leapcrash.c
@@ -101,6 +101,7 @@ int main(void)
101 } 101 }
102 clear_time_state(); 102 clear_time_state();
103 printf("."); 103 printf(".");
104 fflush(stdout);
104 } 105 }
105 printf("[OK]\n"); 106 printf("[OK]\n");
106 return ksft_exit_pass(); 107 return ksft_exit_pass();
diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/selftests/timers/mqueue-lat.c
index 1867db5d6f5e..7916cf5cc6ff 100644
--- a/tools/testing/selftests/timers/mqueue-lat.c
+++ b/tools/testing/selftests/timers/mqueue-lat.c
@@ -102,6 +102,7 @@ int main(int argc, char **argv)
102 int ret; 102 int ret;
103 103
104 printf("Mqueue latency : "); 104 printf("Mqueue latency : ");
105 fflush(stdout);
105 106
106 ret = mqueue_lat_test(); 107 ret = mqueue_lat_test();
107 if (ret < 0) { 108 if (ret < 0) {
diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/selftests/timers/nanosleep.c
index 8adb0bb51d4d..71b5441c2fd9 100644
--- a/tools/testing/selftests/timers/nanosleep.c
+++ b/tools/testing/selftests/timers/nanosleep.c
@@ -142,6 +142,7 @@ int main(int argc, char **argv)
142 continue; 142 continue;
143 143
144 printf("Nanosleep %-31s ", clockstring(clockid)); 144 printf("Nanosleep %-31s ", clockstring(clockid));
145 fflush(stdout);
145 146
146 length = 10; 147 length = 10;
147 while (length <= (NSEC_PER_SEC * 10)) { 148 while (length <= (NSEC_PER_SEC * 10)) {
diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/selftests/timers/nsleep-lat.c
index c3c3dc10db17..eb3e79ed7b4a 100644
--- a/tools/testing/selftests/timers/nsleep-lat.c
+++ b/tools/testing/selftests/timers/nsleep-lat.c
@@ -155,6 +155,7 @@ int main(int argc, char **argv)
155 continue; 155 continue;
156 156
157 printf("nsleep latency %-26s ", clockstring(clockid)); 157 printf("nsleep latency %-26s ", clockstring(clockid));
158 fflush(stdout);
158 159
159 length = 10; 160 length = 10;
160 while (length <= (NSEC_PER_SEC * 10)) { 161 while (length <= (NSEC_PER_SEC * 10)) {
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index dcf73c5dab6e..b41d8dd0c40c 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -112,6 +112,7 @@ int main(int argv, char **argc)
112 printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n"); 112 printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n");
113 113
114 printf("Estimating clock drift: "); 114 printf("Estimating clock drift: ");
115 fflush(stdout);
115 sleep(120); 116 sleep(120);
116 117
117 get_monotonic_and_raw(&mon, &raw); 118 get_monotonic_and_raw(&mon, &raw);
diff --git a/tools/testing/selftests/timers/set-tai.c b/tools/testing/selftests/timers/set-tai.c
index 70fed27d8fd3..8c4179ee2ca2 100644
--- a/tools/testing/selftests/timers/set-tai.c
+++ b/tools/testing/selftests/timers/set-tai.c
@@ -55,6 +55,7 @@ int main(int argc, char **argv)
55 printf("tai offset started at %i\n", ret); 55 printf("tai offset started at %i\n", ret);
56 56
57 printf("Checking tai offsets can be properly set: "); 57 printf("Checking tai offsets can be properly set: ");
58 fflush(stdout);
58 for (i = 1; i <= 60; i++) { 59 for (i = 1; i <= 60; i++) {
59 ret = set_tai(i); 60 ret = set_tai(i);
60 ret = get_tai(); 61 ret = get_tai();
diff --git a/tools/testing/selftests/timers/set-tz.c b/tools/testing/selftests/timers/set-tz.c
index 877fd5532fee..62bd33eb16f0 100644
--- a/tools/testing/selftests/timers/set-tz.c
+++ b/tools/testing/selftests/timers/set-tz.c
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
65 printf("tz_minuteswest started at %i, dst at %i\n", min, dst); 65 printf("tz_minuteswest started at %i, dst at %i\n", min, dst);
66 66
67 printf("Checking tz_minuteswest can be properly set: "); 67 printf("Checking tz_minuteswest can be properly set: ");
68 fflush(stdout);
68 for (i = -15*60; i < 15*60; i += 30) { 69 for (i = -15*60; i < 15*60; i += 30) {
69 ret = set_tz(i, dst); 70 ret = set_tz(i, dst);
70 ret = get_tz_min(); 71 ret = get_tz_min();
@@ -76,6 +77,7 @@ int main(int argc, char **argv)
76 printf("[OK]\n"); 77 printf("[OK]\n");
77 78
78 printf("Checking invalid tz_minuteswest values are caught: "); 79 printf("Checking invalid tz_minuteswest values are caught: ");
80 fflush(stdout);
79 81
80 if (!set_tz(-15*60-1, dst)) { 82 if (!set_tz(-15*60-1, dst)) {
81 printf("[FAILED] %i didn't return failure!\n", -15*60-1); 83 printf("[FAILED] %i didn't return failure!\n", -15*60-1);
diff --git a/tools/testing/selftests/timers/threadtest.c b/tools/testing/selftests/timers/threadtest.c
index 759c9c06f1a0..cf3e48919874 100644
--- a/tools/testing/selftests/timers/threadtest.c
+++ b/tools/testing/selftests/timers/threadtest.c
@@ -163,6 +163,7 @@ int main(int argc, char **argv)
163 strftime(buf, 255, "%a, %d %b %Y %T %z", localtime(&start)); 163 strftime(buf, 255, "%a, %d %b %Y %T %z", localtime(&start));
164 printf("%s\n", buf); 164 printf("%s\n", buf);
165 printf("Testing consistency with %i threads for %ld seconds: ", thread_count, runtime); 165 printf("Testing consistency with %i threads for %ld seconds: ", thread_count, runtime);
166 fflush(stdout);
166 167
167 /* spawn */ 168 /* spawn */
168 for (i = 0; i < thread_count; i++) 169 for (i = 0; i < thread_count; i++)
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index d9d3ab93b31a..5397de708d3c 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -123,6 +123,7 @@ int validate_freq(void)
123 /* Set the leap second insert flag */ 123 /* Set the leap second insert flag */
124 124
125 printf("Testing ADJ_FREQ... "); 125 printf("Testing ADJ_FREQ... ");
126 fflush(stdout);
126 for (i = 0; i < NUM_FREQ_VALID; i++) { 127 for (i = 0; i < NUM_FREQ_VALID; i++) {
127 tx.modes = ADJ_FREQUENCY; 128 tx.modes = ADJ_FREQUENCY;
128 tx.freq = valid_freq[i]; 129 tx.freq = valid_freq[i];
@@ -250,6 +251,7 @@ int set_bad_offset(long sec, long usec, int use_nano)
250int validate_set_offset(void) 251int validate_set_offset(void)
251{ 252{
252 printf("Testing ADJ_SETOFFSET... "); 253 printf("Testing ADJ_SETOFFSET... ");
254 fflush(stdout);
253 255
254 /* Test valid values */ 256 /* Test valid values */
255 if (set_offset(NSEC_PER_SEC - 1, 1)) 257 if (set_offset(NSEC_PER_SEC - 1, 1))
diff --git a/tools/testing/selftests/x86/syscall_arg_fault.c b/tools/testing/selftests/x86/syscall_arg_fault.c
index 7db4fc9fa09f..d2548401921f 100644
--- a/tools/testing/selftests/x86/syscall_arg_fault.c
+++ b/tools/testing/selftests/x86/syscall_arg_fault.c
@@ -43,7 +43,7 @@ static sigjmp_buf jmpbuf;
43 43
44static volatile sig_atomic_t n_errs; 44static volatile sig_atomic_t n_errs;
45 45
46static void sigsegv(int sig, siginfo_t *info, void *ctx_void) 46static void sigsegv_or_sigbus(int sig, siginfo_t *info, void *ctx_void)
47{ 47{
48 ucontext_t *ctx = (ucontext_t*)ctx_void; 48 ucontext_t *ctx = (ucontext_t*)ctx_void;
49 49
@@ -73,7 +73,13 @@ int main()
73 if (sigaltstack(&stack, NULL) != 0) 73 if (sigaltstack(&stack, NULL) != 0)
74 err(1, "sigaltstack"); 74 err(1, "sigaltstack");
75 75
76 sethandler(SIGSEGV, sigsegv, SA_ONSTACK); 76 sethandler(SIGSEGV, sigsegv_or_sigbus, SA_ONSTACK);
77 /*
78 * The actual exception can vary. On Atom CPUs, we get #SS
79 * instead of #PF when the vDSO fails to access the stack when
80 * ESP is too close to 2^32, and #SS causes SIGBUS.
81 */
82 sethandler(SIGBUS, sigsegv_or_sigbus, SA_ONSTACK);
77 sethandler(SIGILL, sigill, SA_ONSTACK); 83 sethandler(SIGILL, sigill, SA_ONSTACK);
78 84
79 /* 85 /*