lkml.org 
[lkml]   [2022]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.19 0497/1157] selftests: timers: clocksource-switch: fix passing errors from child
    Date
    From: Wolfram Sang <wsa+renesas@sang-engineering.com>

    [ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ]

    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: 7290ce1423c3 ("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>
    ---
    tools/testing/selftests/timers/clocksource-switch.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
    index ef8eb3604595..b57f0a9be490 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;
    }


    --
    2.35.1


    \
     
     \ /
      Last update: 2022-08-16 02:00    [W:4.103 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site