Skip to contentSkip to conversation

kselftests: timers: freq-step: Define ADJ_SETOFFSET if device has older kernel headers

RFC PATCH In review John Stultz 3 participants 7 messages Aug 14, 2017 – Aug 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 kselftests: timers: freq-step: Define ADJ_SETOFFSET if device has older kernel headers

On some systems, the kernel headers haven't been updated to include ADJ_SETOFFSET, so define it in the test if needed.

Cc Shuah Khan <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Miroslav Lichvar <[email protected]>
---
 tools/testing/selftests/timers/freq-step.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/timers/freq-step.c +4 -0
index 22312eb..f0d1323 100644
@@ -33,6 +33,10 @@
 #define MAX_FREQ_ERROR 10e-6
 #define MAX_STDDEV 1000e-9
 
+#ifndef ADJ_SETOFFSET
+  #define ADJ_SETOFFSET 0x0100
+#endif
+
 struct sample {
 	double offset;
 	double time;
Signature · 1 line
2.7.4
#1 lore raw

RFC PATCH 2/2 selftests: timers: freq-step: Fix build warning

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

By returning zero at the end of main.

Cc Shuah Khan <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Miroslav Lichvar <[email protected]>
---
 tools/testing/selftests/timers/freq-step.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/timers/freq-step.c +2 -0
index f0d1323..51fcf7c 100644
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
 		ksft_exit_fail();
 
 	ksft_exit_pass();
+
+	return 0;
 }
Signature · 1 line
2.7.4
#2 lore raw

Re: [RFC][PATCH 2/2] selftests: timers: freq-step: Fix build warning

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 273

Quoted 11 lines · John Stultz

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/testing/selftests/timers/freq-step.c +2 -0
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
 		ksft_exit_fail();
 
 	ksft_exit_pass();
+
+	return 0;
 }

It seems most tests use "return ksft_exit_pass();". Would that be preferred over separate return? I don't have a preference.

Both patches in this set look good to me.

Thanks,

Signature · 1 line
Miroslav Lichvar
#3 lore raw

Re: [RFC][PATCH 2/2] selftests: timers: freq-step: Fix build warning

Hi John,

Quoted 7 lines · Miroslav Lichvar

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 268

Quoted 6 lines · John Stultz

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/testing/selftests/timers/freq-step.c +0 -0
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
 		ksft_exit_fail();

This needs to be changes as well to return ksft_exit_fail();

Quoted 8 lines

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 273

Quoted 5 lines
tools/testing/selftests/timers/freq-step.c +2 -0
 	ksft_exit_pass();
+
+	return 0;
 }

It seems most tests use "return ksft_exit_pass();". Would that be preferred over separate return? I don't have a preference.

Let's go with "return ksft_exit_pass();"

Quoted 5 lines

Both patches in this set look good to me.

Thanks,

thanks,
-- Shuah

#4 lore raw

Re: [RFC][PATCH 2/2] selftests: timers: freq-step: Fix build warning

Quoted 18 lines · Shuah Khan

Hi John,

Quoted 7 lines · Miroslav Lichvar

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 268

Quoted 6 lines · John Stultz

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/testing/selftests/timers/freq-step.c +0 -0
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
             ksft_exit_fail();

This needs to be changes as well to return ksft_exit_fail();

Quoted 6 lines
Quoted 5 lines
tools/testing/selftests/timers/freq-step.c +2 -0
     ksft_exit_pass();
+
+    return 0;
 }
Quoted 4 lines
Quoted 2 lines

It seems most tests use "return ksft_exit_pass();". Would that be preferred over separate return? I don't have a preference.

Let's go with "return ksft_exit_pass();"

Thanks for the review, I've made both changes and I'll send these out shortly with the rest of my 4.14 focused queue.

thanks
-john

#5 lore raw

Re: [RFC][PATCH 2/2] selftests: timers: freq-step: Fix build warning

Quoted 19 lines · John Stultz
Quoted 18 lines · Shuah Khan

Hi John,

Quoted 7 lines · Miroslav Lichvar

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 268

Quoted 6 lines · John Stultz

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/testing/selftests/timers/freq-step.c +0 -0
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
             ksft_exit_fail();

This needs to be changes as well to return ksft_exit_fail();

Quoted 6 lines
Quoted 5 lines
tools/testing/selftests/timers/freq-step.c +2 -0
     ksft_exit_pass();
+
+    return 0;
 }
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It seems most tests use "return ksft_exit_pass();". Would that be preferred over separate return? I don't have a preference.

Let's go with "return ksft_exit_pass();"

Thanks for the review, I've made both changes and I'll send these out shortly with the rest of my 4.14 focused queue.

Shuah,
One more question here. I'm noticing that running "make
run_destructive_tests" in the timers dir, the freq-step test returns ksft_exit_skip, which results in the test returning an exit code of 4, which causes make to think it failed, halting the testing.

I'm guessing there is some extra logic for how to properly run extended tests such that the various error codes are handled and a skip doesn't result in the test stopping?

Any suggestions/pointers?

thanks
-john

#6 lore raw

Re: [RFC][PATCH 2/2] selftests: timers: freq-step: Fix build warning

Quoted 25 lines · John Stultz
Quoted 24 lines · John Stultz
Quoted 22 lines · Shuah Khan

Hi John,

Quoted 7 lines · Miroslav Lichvar

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 268

Quoted 6 lines · John Stultz

Fixes the following build warning:
freq-step.c: In function ‘main’:
freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/testing/selftests/timers/freq-step.c +0 -0
@@ -268,4 +268,6 @@ int main(int argc, char **argv)
             ksft_exit_fail();

This needs to be changes as well to return ksft_exit_fail();

Quoted 8 lines

tools/testing/selftests/timers/freq-step.c int main(int argc, char **argv) · line 273

Quoted 5 lines
tools/testing/selftests/timers/freq-step.c +2 -0
     ksft_exit_pass();
+
+    return 0;
 }

It seems most tests use "return ksft_exit_pass();". Would that be preferred over separate return? I don't have a preference.

Let's go with "return ksft_exit_pass();"

Quoted 8 lines
Quoted 2 lines

Thanks for the review, I've made both changes and I'll send these out shortly with the rest of my 4.14 focused queue.

Shuah,
One more question here. I'm noticing that running "make
run_destructive_tests" in the timers dir, the freq-step test returns ksft_exit_skip, which results in the test returning an exit code of 4, which causes make to think it failed, halting the testing.

I think exit code 4 might not be good option. It could be tripping the make target rules.

Quoted 7 lines

I'm guessing there is some extra logic for how to properly run extended tests such that the various error codes are handled and a skip doesn't result in the test stopping?

Any suggestions/pointers?

Skip is really a case of not being able to run the test and it might not be necessary to differentiate SKIP vs. PASS. I think we can just get rid of EXIT_SKIP and use EXIT_PASS. I would rather do that than adding handling for exit code 4.

I can get that change in for 4.14-rc1 if this can wait or I will try to get that into 4.13-rc7 possibly.

Also just FYI - I am going to send out patch series for timers test conversion to TAP13 tomorrow.

thanks,
-- Shuah