From: Wolfram Sang Date: Wed, 13 Jul 2022 20:46:17 +0000 (+0200) Subject: selftests: timers: clocksource-switch: fix passing errors from child X-Git-Tag: baikal/mips/sdk5.8.2~3131 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=1d7c026a2d7772b4e03a6a1f2bb23c567eec97d4;p=kernel.git selftests: timers: clocksource-switch: fix passing errors from child [ Upstream commit 20590c8d8f3358374c66716343d0a826fac48263 ] 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: a7ffacd44428 ("selftests/timers: Add clocksource-switch test from timetest suite") Signed-off-by: Wolfram Sang Acked-by: John Stultz Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c index bfc974b4572d5..c18313a5f357b 100644 --- a/tools/testing/selftests/timers/clocksource-switch.c +++ b/tools/testing/selftests/timers/clocksource-switch.c @@ -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; }