Skip to content

Commit

Permalink
selftests: timers: clocksource-switch: fix passing errors from child
Browse files Browse the repository at this point in the history
[ Upstream commit 4d8f52a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Wolfram Sang authored and gregkh committed Aug 17, 2022
1 parent 4d34813 commit 8ff5be7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/testing/selftests/timers/clocksource-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ int run_tests(int secs)

sprintf(buf, "./inconsistency-check -t %i", secs);
ret = system(buf);
if (ret)
return ret;
if (WIFEXITED(ret) && WEXITSTATUS(ret))
return WEXITSTATUS(ret);
ret = system("./nanosleep");
return ret;
return WIFEXITED(ret) ? WEXITSTATUS(ret) : 0;
}


Expand Down

0 comments on commit 8ff5be7

Please sign in to comment.