From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754449AbbCMKhX (ORCPT ); Fri, 13 Mar 2015 06:37:23 -0400 Received: from ozlabs.org ([103.22.144.67]:56421 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbbCMKhW (ORCPT ); Fri, 13 Mar 2015 06:37:22 -0400 Message-ID: <1426243040.25086.3.camel@ellerman.id.au> Subject: Re: [PATCH] selftests/kcmp: exit with non-zero code in a fail case From: Michael Ellerman To: Andrey Vagin Cc: linux-kernel@vger.kernel.org, Shuah Khan , Cyrill Gorcunov Date: Fri, 13 Mar 2015 21:37:20 +1100 In-Reply-To: <1426238828-30042-1-git-send-email-avagin@openvz.org> References: <1426238828-30042-1-git-send-email-avagin@openvz.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-03-13 at 12:27 +0300, Andrey Vagin wrote: > diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h > index 572c888..a0ec8b8 100644 > --- a/tools/testing/selftests/kselftest.h > +++ b/tools/testing/selftests/kselftest.h > @@ -58,5 +58,17 @@ static inline int ksft_exit_skip(void) > { > exit(4); > } > +static inline int ksft_exit(void) > +{ > + if (ksft_cnt.ksft_fail) > + return ksft_exit_fail(); > + if (ksft_cnt.ksft_xpass) > + return ksft_exit_xpass(); > + if (ksft_cnt.ksft_xskip) > + return ksft_exit_skip(); > + if (ksft_cnt.ksft_xfail) > + return ksft_exit_xfail(); > + ksft_exit_pass(); > +} This function claims to return 'int', but doesn't. So do all the others. It could be as simple as: static inline void ksft_exit(void) { if (ksft_cnt.ksft_fail) exit(1); if (ksft_cnt.ksft_xpass) exit(3); if (ksft_cnt.ksft_xskip) exit(4); if (ksft_cnt.ksft_xfail) exit(2); exit(0); } cheers