From patchwork Mon Jul 27 09:40:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1336802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Prx7I+Re; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BFZZ16nShz9sPf for ; Mon, 27 Jul 2020 19:41:13 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 293363C27D4 for ; Mon, 27 Jul 2020 11:41:11 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id C99353C089D for ; Mon, 27 Jul 2020 11:41:08 +0200 (CEST) Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 1E06B2013FB for ; Mon, 27 Jul 2020 11:41:08 +0200 (CEST) Received: by mail-pj1-x1042.google.com with SMTP id i92so1308159pje.0 for ; Mon, 27 Jul 2020 02:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=laLhQTYSl9GPgzsivaiG5g++WpbkBq60FGMWRJCpF48=; b=Prx7I+RetKD+CS1ZvWL3geBXrAEcIpDPZFIBs153lDBgqsSTxvKoPlZPnZB9uBuIFC PNtjwUIqdjq8dXhuc5bzBUk+0jG0xHNpKROd6q8qSJ30lObEm1sjv2ZVL8cKpfz0lwrg o8y7NKvXZN4geSWcf8MvlpKw0BgxNLk0B3chjXg6p0vIABV2z6837nD0E/IMcqIFa3Fs 8EiR7T9VVp9JT+QjHM7PdPFfC4xk/7rAiMkpL9/fi3mga3kqjI73PiptcdN557VC5TpQ yEG/Kqf8SSiCSbsFcAhkvoDNoGLeoUdQaZhzKOLz2ELtV+K3MYXStfpmzfbMLDYaPN/+ 4oAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=laLhQTYSl9GPgzsivaiG5g++WpbkBq60FGMWRJCpF48=; b=EAJ0S+g3C4N4HQE1KJnnffaztWIYiC48IC1wsg+QcZHkkB55Z/jVY5AAhap70ZQuh1 R+qfjxW3jzAnWt9aNjPQg4pZ1tyI4/o+ZkEQ7oij5cK0xFprkWsHfbAtSWgGeK8z2ba7 q4OwgqVoCcAmtbyoRJw5Y/4/KIL+GedgAZtKKdew1y4geATAqVdEpnhg3hod7wMj0YFl eYXnZEBdXLnBM0WKUTSKyOry7INYuSKNUKu9BkPRTynCr5Rn5RsCb28bNTGR57Lp+bva hvVTKU5PcFybDqaUcj3kYXiPGflHBDLd/sIg2uiYxRRW4L5ClGXrnEichDtzOGzM/tYN vLqQ== X-Gm-Message-State: AOAM531xoyp+rAMQ8Ya10qkkKkHuTQoAUYCt2a9bbdxd8HWxYFK5tMjW ejCQf2/2AJSh1J1E5aoy9U+IAD05Q8M= X-Google-Smtp-Source: ABdhPJwabHVPaJOordw8QP+jlscdquADY1kCDNE4sKnaStuD6nvntXAQCTDL5YEnMQN4CkAnZbwwKA== X-Received: by 2002:a17:90b:124c:: with SMTP id gx12mr18736799pjb.191.1595842834308; Mon, 27 Jul 2020 02:40:34 -0700 (PDT) Received: from localhost ([223.190.9.130]) by smtp.gmail.com with ESMTPSA id n14sm14596567pgd.78.2020.07.27.02.40.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jul 2020 02:40:33 -0700 (PDT) From: Viresh Kumar To: ltp@lists.linux.it Date: Mon, 27 Jul 2020 15:10:25 +0530 Message-Id: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH V2 1/2] libs: sigwait: Fix compilation warning around sigprocmask() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Vincent Guittot Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Newer gcc generates following warnings currently: sigwait.c: In function ‘test_masked_matching’: sigwait.c:157:42: warning: passing argument 3 to restrict-qualified parameter aliases with argument 2 [-Wrestrict] 157 | TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask)); Fix these by using different pointers for new and old masks. Reported-by: Petr Vorel Signed-off-by: Viresh Kumar --- V2: New patch libs/libltpsigwait/sigwait.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c index dbd33a61f2b1..0a34e6cc3deb 100644 --- a/libs/libltpsigwait/sigwait.c +++ b/libs/libltpsigwait/sigwait.c @@ -156,11 +156,11 @@ void test_masked_matching(swi_func sigwaitinfo, int signo, && si.si_code == SI_USER && si.si_signo == signo, "Struct siginfo mismatch"); - TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask)); + TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) tst_brk(TBROK | TTERRNO, "restoring original signal mask failed"); - if (sigismember(&oldmask, signo)) + if (sigismember(&sigs, signo)) tst_res(TPASS, "sigwaitinfo restored the original mask"); else tst_res(TFAIL, @@ -214,11 +214,11 @@ void test_masked_matching_rt(swi_func sigwaitinfo, int signo, && si.si_signo == signo + 1, "Struct siginfo mismatch"); - TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask)); + TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) tst_brk(TBROK | TTERRNO, "restoring original signal mask failed"); - if (sigismember(&oldmask, signo)) + if (sigismember(&sigs, signo)) tst_res(TPASS, "sigwaitinfo restored the original mask"); else tst_res(TFAIL, @@ -250,11 +250,11 @@ void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo, TEST(sigwaitinfo(&sigs, NULL, NULL)); REPORT_SUCCESS(signo, 0); - TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask)); + TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) tst_brk(TBROK | TTERRNO, "restoring original signal mask failed"); - if (sigismember(&oldmask, signo)) + if (sigismember(&sigs, signo)) tst_res(TPASS, "sigwaitinfo restored the original mask"); else tst_res(TFAIL, @@ -289,7 +289,7 @@ void test_bad_address(swi_func sigwaitinfo, int signo, TEST(sigwaitinfo(&sigs, (void *)1, NULL)); REPORT_SUCCESS(-1, EFAULT); - TEST(sigprocmask(SIG_SETMASK, &oldmask, &oldmask)); + TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) tst_brk(TBROK | TTERRNO, "sigprocmask() failed"); From patchwork Mon Jul 27 09:40:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1336799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=L18wB3BL; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BFZYb6tpTz9sPf for ; Mon, 27 Jul 2020 19:40:51 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 528AF3C26DE for ; Mon, 27 Jul 2020 11:40:49 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id DA5B13C089D for ; Mon, 27 Jul 2020 11:40:46 +0200 (CEST) Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 20B98600956 for ; Mon, 27 Jul 2020 11:39:23 +0200 (CEST) Received: by mail-pj1-x1044.google.com with SMTP id gc9so9008536pjb.2 for ; Mon, 27 Jul 2020 02:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=NlpWYT0Oj8x/xJL+9ayQ10ROG16Az0w4AYz5XiAIWLM=; b=L18wB3BLa7lXwn+7r35HohpEfTKsGhA/ZyVmn64bvWU/YbDCaqA10TLml2RzhgLE/x bPNzITlLVXqmwPV0urLxGPafOAjJOZPQDUAqTW1Sv7n+7Ejt2OoFnJe7Np7zQbllcdiv f8Q124TeozPnPJTBL+34TvEp+DeRzatVUK00S8xLHq0nlG86TU+kXSL2U/cNziJE4hb4 s4R9HOAwIK7Olg35E190IQI/aB4XGK/6lHBIlZdZxvEKffkr2U1xYHKrauITvBhcAHpA 9XysC3nlg73geJFHBBY9L8LC4+nIZdPtfh4ebmz9KyPIAYs7EwQhpQX3Li5tI741GOcw oXoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=NlpWYT0Oj8x/xJL+9ayQ10ROG16Az0w4AYz5XiAIWLM=; b=oIJibHEHdXxoXeP7jLTwmHSEerTvnK33cFAJ0i2NX+PpZiHIY1V0HUGDR9C/U716Mc d0QKwbIi6Nc1KWpP+DaWO0Yn5tDGIFki3lKQG7G0evLNbpbJN8Otp67O0vs7xSFbjHpS E0GsQaQ+LN4wrNKbdUwL1FKbY94ARErwMquDWiLKJlOu7fF/GFIEChktxTwZfS+Z7Dph N2zdDsTxbwtutHWfrKn0gUapsxHocb6Qy3wr02pHTBoAWulIO135/tL23JrAf87p5rZI zS5foUP4bAsaEVmyNAa3jnMj9nclfGpXpCYbrvbJW5YE+B8rFdypYGUbE8lkuA10qBZX LgGQ== X-Gm-Message-State: AOAM531OO9IsCC5wkRVj3N8TQv1M1q0cp8KnlDF+smfIiBOUa8h6yTh7 u4m6rfho1wNBbw1FcT+RBVc8+kXsNhA= X-Google-Smtp-Source: ABdhPJztYr1A2VkzLo0OUbKo4XPzIkmRPulGnwlyw1g8ztPGNEBIQp8+5AEmcEYgwXLifezpbA0JAw== X-Received: by 2002:a17:90a:1589:: with SMTP id m9mr10926751pja.122.1595842842412; Mon, 27 Jul 2020 02:40:42 -0700 (PDT) Received: from localhost ([223.190.9.130]) by smtp.gmail.com with ESMTPSA id m20sm14133509pgn.62.2020.07.27.02.40.40 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jul 2020 02:40:41 -0700 (PDT) From: Viresh Kumar To: ltp@lists.linux.it Date: Mon, 27 Jul 2020 15:10:26 +0530 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org> References: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org> In-Reply-To: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org> References: <53c9ed8dc17ea6fa0b46502cd1c724a3a8539c8c.1595842740.git.viresh.kumar@linaro.org> X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH V2 2/2] libs: sigwait: Get rid of REPORT_SUCCESS() macro X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Vincent Guittot MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This is rather making the code difficult to read, get rid of it and its associated functions. Signed-off-by: Viresh Kumar --- V2: Improved print messages. libs/libltpsigwait/sigwait.c | 133 +++++++++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 55 deletions(-) diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c index 0a34e6cc3deb..56b7722d0dbf 100644 --- a/libs/libltpsigwait/sigwait.c +++ b/libs/libltpsigwait/sigwait.c @@ -9,39 +9,6 @@ #include "libsigwait.h" #include "tst_sig_proc.h" -/* Report success iff TST_RET and TST_ERR are equal to - exp_return and exp_errno, resp., and cond is true. If cond is not - true, report condition_errmsg -*/ -static void report_success_cond(const char *func, int line, - long exp_return, int exp_errno, int condition, - char *condition_errmsg) -{ - if (exp_return == TST_RET - && (exp_return != -1 || exp_errno == TST_ERR)) - if (condition) - tst_res(TPASS, "%s (%d): Test passed", func, line); - else - tst_res(TFAIL, "%s (%d): %s", func, line, - condition_errmsg); - else if (TST_RET != -1) - tst_res(TFAIL, - "%s (%d): Unexpected return value; expected %ld, got %ld", - func, line, exp_return, TST_RET); - else - tst_res(TFAIL | TTERRNO, "%s (%d): Unexpected failure", - func, line); -} - -#define REPORT_SUCCESS_COND(exp_return, exp_errno, condition, condition_errmsg) \ - report_success_cond(__FUNCTION__, __LINE__, exp_return, exp_errno, condition, condition_errmsg); - -/* Report success iff TST_RET and TST_ERR are equal to - exp_return and exp_errno, resp. -*/ -#define REPORT_SUCCESS(exp_return, exp_errno) \ - REPORT_SUCCESS_COND(exp_return, exp_errno, 1, ""); - void test_empty_set(swi_func sigwaitinfo, int signo, enum tst_ts_type type LTP_ATTRIBUTE_UNUSED) { @@ -55,7 +22,14 @@ void test_empty_set(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, INT_MAX, 100000); TEST(sigwaitinfo(&sigs, &si, NULL)); - REPORT_SUCCESS(-1, EINTR); + if (TST_RET == -1) { + if (TST_ERR == EINTR) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "Expected error number EINTR, got"); + } else { + tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET); + } SAFE_KILL(child, SIGTERM); SAFE_WAIT(NULL); @@ -78,7 +52,14 @@ void test_timeout(swi_func sigwaitinfo, int signo, enum tst_ts_type type) child = create_sig_proc(signo, INT_MAX, 100000); TEST(sigwaitinfo(&sigs, &si, tst_ts_get(&ts))); - REPORT_SUCCESS(-1, EAGAIN); + if (TST_RET == -1) { + if (TST_ERR == EAGAIN) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "Expected error number EAGAIN, got"); + } else { + tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET); + } SAFE_KILL(child, SIGTERM); SAFE_WAIT(NULL); @@ -101,9 +82,15 @@ void test_unmasked_matching(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, INT_MAX, 100000); TEST(sigwaitinfo(&sigs, &si, NULL)); - REPORT_SUCCESS_COND(signo, 0, si.si_pid == child - && si.si_code == SI_USER - && si.si_signo == signo, "Struct siginfo mismatch"); + if (TST_RET == signo) { + if (si.si_pid == child && si.si_code == SI_USER && + si.si_signo == signo) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL, "struct siginfo mismatch"); + } else { + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); + } SAFE_KILL(child, SIGTERM); SAFE_WAIT(NULL); @@ -122,7 +109,10 @@ void test_unmasked_matching_noinfo(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, INT_MAX, 100000); TEST(sigwaitinfo(&sigs, NULL, NULL)); - REPORT_SUCCESS(signo, 0); + if (TST_RET == signo) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); SAFE_KILL(child, SIGTERM); SAFE_WAIT(NULL); @@ -152,9 +142,15 @@ void test_masked_matching(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, 1, 0); TEST(sigwaitinfo(&sigs, &si, NULL)); - REPORT_SUCCESS_COND(signo, 0, si.si_pid == child - && si.si_code == SI_USER - && si.si_signo == signo, "Struct siginfo mismatch"); + if (TST_RET == signo) { + if (si.si_pid == child && si.si_code == SI_USER && + si.si_signo == signo) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL, "struct siginfo mismatch"); + } else { + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); + } TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) @@ -203,16 +199,27 @@ void test_masked_matching_rt(swi_func sigwaitinfo, int signo, SAFE_WAITPID(child[1], &status, 0); TEST(sigwaitinfo(&sigs, &si, NULL)); - REPORT_SUCCESS_COND(signo, 0, si.si_pid == child[0] - && si.si_code == SI_USER - && si.si_signo == signo, "Struct siginfo mismatch"); + if (TST_RET == signo) { + if (si.si_pid == child[0] && si.si_code == SI_USER && + si.si_signo == signo) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL, "struct siginfo mismatch"); + } else { + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); + } /* eat the other signal */ TEST(sigwaitinfo(&sigs, &si, NULL)); - REPORT_SUCCESS_COND(signo + 1, 0, si.si_pid == child[1] - && si.si_code == SI_USER - && si.si_signo == signo + 1, - "Struct siginfo mismatch"); + if (TST_RET == signo + 1) { + if (si.si_pid == child[1] && si.si_code == SI_USER && + si.si_signo == signo + 1) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL, "struct siginfo mismatch"); + } else { + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); + } TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) @@ -248,7 +255,10 @@ void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, 1, 0); TEST(sigwaitinfo(&sigs, NULL, NULL)); - REPORT_SUCCESS(signo, 0); + if (TST_RET == signo) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed"); TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) @@ -287,7 +297,14 @@ void test_bad_address(swi_func sigwaitinfo, int signo, child = create_sig_proc(signo, 1, 0); TEST(sigwaitinfo(&sigs, (void *)1, NULL)); - REPORT_SUCCESS(-1, EFAULT); + if (TST_RET == -1) { + if (TST_ERR == EFAULT) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "Expected error number EFAULT, got"); + } else { + tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET); + } TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask)); if (TST_RET == -1) @@ -316,8 +333,7 @@ void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED, if (TST_RET == -1 && TST_ERR == EFAULT) _exit(0); - tst_res(TINFO | TTERRNO, "swi_func returned: %ld", - TST_RET); + tst_res(TINFO | TTERRNO, "swi_func returned: %ld", TST_RET); _exit(1); } @@ -325,7 +341,7 @@ void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED, if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) { - tst_res(TPASS, "Test passed"); + tst_res(TPASS, "Wait interrupted by a signal"); return; } @@ -346,7 +362,14 @@ void test_bad_address3(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED, SAFE_SIGEMPTYSET(&sigs); TEST(sigwaitinfo(&sigs, NULL, (void *)1)); - REPORT_SUCCESS(-1, EFAULT); + if (TST_RET == -1) { + if (TST_ERR == EFAULT) + tst_res(TPASS, "Wait interrupted by a signal"); + else + tst_res(TFAIL | TTERRNO, "Expected error number EFAULT, got"); + } else { + tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET); + } } static void empty_handler(int sig LTP_ATTRIBUTE_UNUSED)