Skip to content

Commit 4d8f52a

Browse files
Wolfram Sangshuahkh
authored andcommitted
selftests: timers: clocksource-switch: fix passing errors from child
The return value from system() is a waitpid-style integer. Do not return it directly because with the implicit masking in exit() it will always return 0. Access it with appropriate macros to really pass on errors. Fixes: 7290ce1 ("selftests/timers: Add clocksource-switch test from timetest suite") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: John Stultz <jstultz@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 04fd937 commit 4d8f52a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tools/testing/selftests/timers/clocksource-switch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ int run_tests(int secs)
110110

111111
sprintf(buf, "./inconsistency-check -t %i", secs);
112112
ret = system(buf);
113-
if (ret)
114-
return ret;
113+
if (WIFEXITED(ret) && WEXITSTATUS(ret))
114+
return WEXITSTATUS(ret);
115115
ret = system("./nanosleep");
116-
return ret;
116+
return WIFEXITED(ret) ? WEXITSTATUS(ret) : 0;
117117
}
118118

119119

0 commit comments

Comments
 (0)