From patchwork Thu Aug 11 13:13:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1665551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=M+0IREaf; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=+n1cGyQF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3S1x5Q6hz9sG6 for ; Thu, 11 Aug 2022 23:14:11 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 64CCC3C959E for ; Thu, 11 Aug 2022 15:14:07 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2446F3C925A for ; Thu, 11 Aug 2022 15:14:05 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 7365010000C3 for ; Thu, 11 Aug 2022 15:14:03 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5A8525CD0A for ; Thu, 11 Aug 2022 13:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660223642; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=HyipilkQZg8e+15O3rLNv0YQogrQ1D/pHkfe2naMwGE=; b=M+0IREaf6x/xroqyVZtuUHjkeOwONqhRDl1UtQNcnWT3SCvGbPeb0vaQnzKRlJ/Y85P6ZM HSsURYnAhPNp8k6rajOvWKRcz7Upq3sI31etlpsK+erwoAcpQBJbc0JfeTVfBIE78DN/s/ qQAh6s0lS114TGlWPvH4np3T9v1eN3A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660223642; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=HyipilkQZg8e+15O3rLNv0YQogrQ1D/pHkfe2naMwGE=; b=+n1cGyQFXIP8viq0rB9Pm8+V6WYYCrEIiYrKExNxdctsQUW0DheomxvJqo2t+gGp2MmzSG dPNQwYKYt8ZFHEDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C2A1513A9B for ; Thu, 11 Aug 2022 13:14:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wTH8H5kA9WKSXgAAMHmgww (envelope-from ) for ; Thu, 11 Aug 2022 13:14:01 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Thu, 11 Aug 2022 18:43:54 +0530 Message-Id: <20220811131358.18906-1-akumar@suse.de> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.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,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 1/5] alarm02: simplify using TST_EXP_* macros 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" - copyright update - description comment reword and turn into docparse format - remove duplicated includes - use TST_EXP_PASS and TST_EXP_VAL macros Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/alarm/alarm02.c | 51 +++++++---------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/testcases/kernel/syscalls/alarm/alarm02.c b/testcases/kernel/syscalls/alarm/alarm02.c index 94239060c..7d60b532e 100644 --- a/testcases/kernel/syscalls/alarm/alarm02.c +++ b/testcases/kernel/syscalls/alarm/alarm02.c @@ -1,17 +1,17 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. * Author: Billy Jean Horne - * - * Test Description: - * 1) alarm() return UINT_MAX if seconds is UINT_MAX. - * 2) alarm() return UINT_MAX/2 if seconds is UINT_MAX/2. - * 3) alarm() return UINT_MAX/4 if seconds is UINT_MAX/4. + * Copyright (c) Linux Test Project, 2009-2022 */ -#include -#include -#include -#include +/*\ + * [Description] + * + * Verify that alarm() returns: + * - zero when there was no previously scheduled alarm. + * - number of seconds remaining until any previously scheduled alarm. + */ #include "tst_test.h" @@ -29,37 +29,16 @@ static struct tcase { static void verify_alarm(unsigned int n) { struct tcase *tc = &tcases[n]; - unsigned int ret; - alarms_received = 0; - ret = alarm(tc->sec); - if (ret != 0) { - tst_res(TFAIL, - "alarm(%u) returned %ld, when 0 was ", - tc->sec, TST_RET); - return; - } + TST_EXP_PASS(alarm(tc->sec), "alarm(%u)", tc->sec); - TEST(alarm(0)); - if (alarms_received == 1) { - tst_res(TFAIL, - "alarm(%u) signal was received for value %s", - tc->sec, tc->str); - return; - } + TST_EXP_VAL(alarm(0), tc->sec); - if (tc->sec != TST_RET) { + if (alarms_received == 1) tst_res(TFAIL, - "alarm(%u) returned %ld as unexpected", - tc->sec, TST_RET); - return; - } - - tst_res(TPASS, - "alarm(%u) returned %ld as expected " - "for value %s", - tc->sec, TST_RET, tc->str); + "alarm(%u) delivered SIGALRM for seconds value %s", + tc->sec, tc->str); } static void sighandler(int sig) From patchwork Thu Aug 11 13:13:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1665552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GN1bld43; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=gvRYNfCP; dkim-atps=neutral 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=) 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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3S274Y3cz9sG6 for ; Thu, 11 Aug 2022 23:14:22 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2331D3C93F2 for ; Thu, 11 Aug 2022 15:14:19 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B18C63C95D1 for ; Thu, 11 Aug 2022 15:14:07 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id CFF6A6009D9 for ; Thu, 11 Aug 2022 15:14:06 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 386C138B68 for ; Thu, 11 Aug 2022 13:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660223646; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuFXrku0bdoqoQ7xLi1c38Ub3bbq2cjioYwMfvgOtNc=; b=GN1bld43vMdQhtdZ+CWchfUz3UpoSo4+pPuq/eT4hrIto33stUQhg1Ji4YJY69xmlM+vnE OYXDQZG0Qg1PuNtvmDIhMJhYuxzmOY94nTlK9IOdiP3i/e4FjuTFcxq2JKQ8Kwv2ZFwikU w570k4CV6PwcKAAYmMZaH+X3UtJ8v34= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660223646; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuFXrku0bdoqoQ7xLi1c38Ub3bbq2cjioYwMfvgOtNc=; b=gvRYNfCPJiGmO5cyip/bvdriK6s3Ferh+ZjHfNdvkDXzpebWYkwMlkFI0DZ5dbOXddUMxD vF4mXn2JaYimvbDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 92CC813A9B for ; Thu, 11 Aug 2022 13:14:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gnFqEp0A9WKlXgAAMHmgww (envelope-from ) for ; Thu, 11 Aug 2022 13:14:05 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Thu, 11 Aug 2022 18:43:55 +0530 Message-Id: <20220811131358.18906-2-akumar@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220811131358.18906-1-akumar@suse.de> References: <20220811131358.18906-1-akumar@suse.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.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,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 2/5] alarm03: cleanup and simplify 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" - copyright udpate - description comment reword and turn into docparse format - remove duplicated headers - use TST_EXP_* macros Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/alarm/alarm03.c | 41 ++++++----------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/testcases/kernel/syscalls/alarm/alarm03.c b/testcases/kernel/syscalls/alarm/alarm03.c index c0341827e..83c9932ae 100644 --- a/testcases/kernel/syscalls/alarm/alarm03.c +++ b/testcases/kernel/syscalls/alarm/alarm03.c @@ -2,53 +2,32 @@ /* * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. * Author: Richard Logan + * Copyright (c) Linux Test Project, 2009-2022 + */ + +/*\ + * [Description] * - * Test Description: - * The process does a fork: - * 1) By the value returned by child's alarm(0), check whether child - * process cleared the previously specified alarm request or not. - * 2) By the value returned by parent's alarm(0), check whether parent - * process cleared the previously specified alarm request or not. + * Verify that alarms created by alarm() are not inherited by children + * created via fork. */ -#include -#include #include -#include - #include "tst_test.h" static void verify_alarm(void) { pid_t pid; - TEST(alarm(100)); + TST_EXP_PASS_SILENT(alarm(100)); pid = SAFE_FORK(); if (pid == 0) { - TEST(alarm(0)); - if (TST_RET != 0) { - tst_res(TFAIL, - "alarm(100), fork, alarm(0) child's " - "alarm returned %ld", TST_RET); - } else { - tst_res(TPASS, - "alarm(100), fork, alarm(0) child's " - "alarm returned %ld", TST_RET); - } + TST_EXP_PASS(alarm(0), "alarm(0) in child process"); exit(0); } - TEST(alarm(0)); - if (TST_RET != 100) { - tst_res(TFAIL, - "alarm(100), fork, alarm(0) parent's " - "alarm returned %ld", TST_RET); - } else { - tst_res(TPASS, - "alarm(100), fork, alarm(0) parent's " - "alarm returned %ld", TST_RET); - } + TST_EXP_VAL(alarm(0), 100, "alarm(0) in parent process"); } static struct tst_test test = { From patchwork Thu Aug 11 13:13:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1665553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=IUYCNrXa; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=vDYUeVus; dkim-atps=neutral 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=) 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 (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3S2K4Jn5z9sG6 for ; Thu, 11 Aug 2022 23:14:33 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0B5463C95E2 for ; Thu, 11 Aug 2022 15:14:31 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id CD60C3C9639 for ; Thu, 11 Aug 2022 15:14:10 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 626001A00CC6 for ; Thu, 11 Aug 2022 15:14:10 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D11F738B65 for ; Thu, 11 Aug 2022 13:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660223649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+6g8fp4rIfMcWutDNnK5aKqIOt4uAcboHlZhdm63c8=; b=IUYCNrXaiGf3BByAPxiaD1At841JHT8Rrn+TnJXcxHZMWJylgu6VshjhxyA1akXCazZYWZ Zf+y/Hpm0hMIUTsAII6fu4Rk0qG3QqcY/L7krkXmWo9CWSpFb0d2shwlG/VRJa/CkbiTCf gCiZft38iQ/Ki6rqglfGZsc0EwqoUFg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660223649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+6g8fp4rIfMcWutDNnK5aKqIOt4uAcboHlZhdm63c8=; b=vDYUeVus1IXIy6iZXn3ht7khhHK/lcFlWRGI8ElizQr7YOIv9tb6ju9UwpMwAMI5MialzW e7KeyDRoHoISEVDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4B53613A9B for ; Thu, 11 Aug 2022 13:14:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rJ8wA6EA9WKrXgAAMHmgww (envelope-from ) for ; Thu, 11 Aug 2022 13:14:09 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Thu, 11 Aug 2022 18:43:56 +0530 Message-Id: <20220811131358.18906-3-akumar@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220811131358.18906-1-akumar@suse.de> References: <20220811131358.18906-1-akumar@suse.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.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,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 3/5] alarm05: use TST_EXP_* macros 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" - turn comment into docparse format - make check fix: un-initialize static var - simplify test using TST_EXP_* macros Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/alarm/alarm05.c | 30 ++++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/testcases/kernel/syscalls/alarm/alarm05.c b/testcases/kernel/syscalls/alarm/alarm05.c index c60f98994..2a1258f6a 100644 --- a/testcases/kernel/syscalls/alarm/alarm05.c +++ b/testcases/kernel/syscalls/alarm/alarm05.c @@ -7,8 +7,9 @@ * Copyright (c) 2018 Cyril Hrubis */ -/* - * Test Description: +/*\ + * [Description] + * * The return value of the alarm system call should be equal to the * amount previously remaining in the alarm clock. * A SIGALRM signal should be received after the specified amount of @@ -17,34 +18,17 @@ #include "tst_test.h" -static volatile int alarms_fired = 0; +static volatile int alarms_fired; static void run(void) { - unsigned int ret; - alarms_fired = 0; - ret = alarm(10); - if (ret) - tst_res(TFAIL, "alarm() returned non-zero"); - else - tst_res(TPASS, "alarm() returned zero"); - + TST_EXP_PASS(alarm(10)); sleep(1); - - ret = alarm(1); - if (ret == 9) - tst_res(TPASS, "alarm() returned remainder correctly"); - else - tst_res(TFAIL, "alarm() returned wrong remained %u", ret); - + TST_EXP_VAL(alarm(1), 9); sleep(2); - - if (alarms_fired == 1) - tst_res(TPASS, "alarm handler fired once"); - else - tst_res(TFAIL, "alarm handler filred %u times", alarms_fired); + TST_EXP_EQ_LU(alarms_fired, 1); } static void sighandler(int sig) From patchwork Thu Aug 11 13:13:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1665554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=lYAnUFsM; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SxBXfXg/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3S2X2c32z9sG6 for ; Thu, 11 Aug 2022 23:14:44 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CE7E33C95F2 for ; Thu, 11 Aug 2022 15:14:41 +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 [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2E3123C95E8 for ; Thu, 11 Aug 2022 15:14:15 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 72DEA600875 for ; Thu, 11 Aug 2022 15:14:13 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8C25738B68 for ; Thu, 11 Aug 2022 13:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660223653; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YLmkRFINwRcaQpn2BybBiwLGq4vojHhE5Onku38ZmQk=; b=lYAnUFsMTDrWdx8A8DNkibvZX0SKmRv30PNLqPDyk0VGIaVMbjbXhWA4+wYwlfqQL9ovI1 /ABoJPcuN3DybGDfDWdgJ2hDteklYEZ6s6uUWNSzB47r+/0M5Rh0wXL+FbUp69BJ1AKngE ESVZXtC24IX76rVlarS2g8c6sxSU6ws= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660223653; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YLmkRFINwRcaQpn2BybBiwLGq4vojHhE5Onku38ZmQk=; b=SxBXfXg/u1vPLY87QFWLC0WM9LgNgk0BA/2ohLhZgEJUfwEkU6FDplXTT9cuyFJPUo/7+x 8IjqAfuigWSHYlDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ED9DD13AF7 for ; Thu, 11 Aug 2022 13:14:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1tmzKqQA9WKvXgAAMHmgww (envelope-from ) for ; Thu, 11 Aug 2022 13:14:12 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Thu, 11 Aug 2022 18:43:57 +0530 Message-Id: <20220811131358.18906-4-akumar@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220811131358.18906-1-akumar@suse.de> References: <20220811131358.18906-1-akumar@suse.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 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,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 4/5] alarm06: cleanup and simplify 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" - turn description comment into docparse and reword - remove duplicated headers - make check fix: un-initialize static var - test using TST_EXP_* macros Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/alarm/alarm06.c | 34 +++++------------------ 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/testcases/kernel/syscalls/alarm/alarm06.c b/testcases/kernel/syscalls/alarm/alarm06.c index eee9429a1..e5c0d3768 100644 --- a/testcases/kernel/syscalls/alarm/alarm06.c +++ b/testcases/kernel/syscalls/alarm/alarm06.c @@ -5,25 +5,15 @@ * Ported to LTP: Wayne Boyer */ -/* - * Check the functionality of the Alarm system call when the time input - * parameter is zero. +/*\ + * [Description] * - * Expected Result: - * The previously specified alarm request should be cancelled and the - * SIGALRM should not be received. + * Verify that any pending alarm() is canceled when seconds is zero. */ -#include -#include -#include -#include -#include -#include - #include "tst_test.h" -static volatile int alarms_received = 0; +static volatile int alarms_received; static void sigproc(int sig) { @@ -38,25 +28,15 @@ static void setup(void) static void verify_alarm(void) { - int ret; - - alarm(2); + TST_EXP_PASS_SILENT(alarm(2)); sleep(1); - ret = alarm(0); + TST_EXP_VAL(alarm(0), 1); /* Wait for signal SIGALRM */ sleep(2); - if (alarms_received) - tst_res(TFAIL, "Received %i alarms", alarms_received); - else - tst_res(TPASS, "Received 0 alarms"); - - if (ret == 1) - tst_res(TPASS, "alarm(0) returned 1"); - else - tst_res(TFAIL, "alarm(0) returned %i, expected 1", ret); + TST_EXP_EQ_LU(alarms_received, 0); } static struct tst_test test = { From patchwork Thu Aug 11 13:13:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1665556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=JjAhkZ7H; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=gbD3cjo2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3S2n1Kn7z9sGH for ; Thu, 11 Aug 2022 23:14:57 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7CA563C01CC for ; Thu, 11 Aug 2022 15:14:54 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id DE0DB3C9739 for ; Thu, 11 Aug 2022 15:14:18 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 174AD600A65 for ; Thu, 11 Aug 2022 15:14:17 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 64F245CD0A for ; Thu, 11 Aug 2022 13:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660223657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0M8gY0tQWONO46k7dGSfUGmhgB283cxXHoVKKgt/kzg=; b=JjAhkZ7HMNKYrgFr2gmAvbhcZc4hjSHn9jVInMuGfMqB/KmiaTXOA9dtnwfKxZf+FU96qx v4ThP1u0FdN5+LPDS6V5oUMDvwCzUhZCfP40zQTh3wCDRXDUh5TwyL4o63Vcy2kvYeYCkG VoESOafFETUeuGoXwjD9Jbp6WLQg5Zw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660223657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0M8gY0tQWONO46k7dGSfUGmhgB283cxXHoVKKgt/kzg=; b=gbD3cjo2U1L4qjV8vwCCvHlX4tASGCG+obOqVoIqPd1rwZQk/0GC68mzpAhD5cOd5CZt6r loOBW/EilZLicmBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CDA0B13A9B for ; Thu, 11 Aug 2022 13:14:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VaMDIqgA9WK9XgAAMHmgww (envelope-from ) for ; Thu, 11 Aug 2022 13:14:16 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Thu, 11 Aug 2022 18:43:58 +0530 Message-Id: <20220811131358.18906-5-akumar@suse.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220811131358.18906-1-akumar@suse.de> References: <20220811131358.18906-1-akumar@suse.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.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,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 5/5] alarm07: cleanup and simplify 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" - copyright update - description comment into docparse format and reword - remove duplicated headers - make check fix: un-initialize static var - use TST_EXP_* macros Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/alarm/alarm07.c | 31 +++++++++-------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/testcases/kernel/syscalls/alarm/alarm07.c b/testcases/kernel/syscalls/alarm/alarm07.c index 47c30dc76..17d81f594 100644 --- a/testcases/kernel/syscalls/alarm/alarm07.c +++ b/testcases/kernel/syscalls/alarm/alarm07.c @@ -2,45 +2,38 @@ /* * Copyright (c) International Business Machines Corp., 2001 * Author: Wayne Boyer + * Copyright (c) Linux Test Project, 2009-2022 + */ + +/*\ + * [Description] * - * Test Description: - * By the SIGALRM signal, check whether the previously specified alarm request - * was cleared in the child process or not. + * Verify that SIGALRM signal scheduled by alarm() in the parent process + * is not delivered to the child process. */ -#include #include -#include -#include - #include "tst_test.h" -static volatile int alarm_cnt = 0; +static volatile int alarm_cnt; static void verify_alarm(void) { pid_t pid; + alarm_cnt = 0; - TEST(alarm(1)); + TST_EXP_PASS_SILENT(alarm(1)); pid = SAFE_FORK(); sleep(3); if (pid == 0) { - if (alarm_cnt == 0) { - tst_res(TPASS, "alarm() request cleared in child"); - } else { - tst_res(TFAIL, "alarm() request not cleared in " - "child; alarms received:%d", alarm_cnt); - } + TST_EXP_EQ_LU(alarm_cnt, 0); exit(0); } - if (alarm_cnt != 1) - tst_res(TFAIL, "Sigalarms in parent %i, expected 1", alarm_cnt); - else - tst_res(TPASS, "Got 1 sigalarm in parent"); + TST_EXP_EQ_LU(alarm_cnt, 1); } static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)