From patchwork Fri Jul 15 07:12:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinesh Kumar X-Patchwork-Id: 1656771 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=KvTd9lm9; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NNuogf3R; 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 4LkjGx14Hhz9ryY for ; Fri, 15 Jul 2022 17:12:25 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 81ABB3CAA8C for ; Fri, 15 Jul 2022 09:12:22 +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) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1B5B83CA9C0 for ; Fri, 15 Jul 2022 09:12:20 +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 2B2981A00250 for ; Fri, 15 Jul 2022 09:12:19 +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 21D7633F52 for ; Fri, 15 Jul 2022 07:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657869139; 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=PTENhFhG5zkRHlfdPMkWeyuDTO+sg8lWyBKW+DDKotI=; b=KvTd9lm9DLgb4LEd3824BmiGdx5EImPJxoh9AGYLJb5WFQyfCCAtAttBj+50PbF4mY2ZI+ did/Q5SP7699U3LjyNINmPJtr8O7l/OXXpfLlzqgids5/MpkBJvW/nAEd3x6F2JOykbfso XWdHZym5ePXzJdsVDngXiBPpZZHSNDU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657869139; 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=PTENhFhG5zkRHlfdPMkWeyuDTO+sg8lWyBKW+DDKotI=; b=NNuogf3RiIzEm3DUFYle3mLm3y+fQjHuekzvp2w+zHAOwaafG1FKDJRpmHbXERFvf0FXI6 TVyZm34PiFsTt7Cw== 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 9545413B28 for ; Fri, 15 Jul 2022 07:12:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zJurFFIT0WI4BQAAMHmgww (envelope-from ) for ; Fri, 15 Jul 2022 07:12:18 +0000 From: Avinesh Kumar To: ltp@lists.linux.it Date: Fri, 15 Jul 2022 12:42:16 +0530 Message-Id: <20220715071216.15404-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-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 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] unlink08: use TST_EXP_FAIL() and turn comment into docparse, reword 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" Signed-off-by: Avinesh Kumar --- testcases/kernel/syscalls/unlink/unlink08.c | 35 +++++++-------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c index f3ce46ad8..d16607540 100644 --- a/testcases/kernel/syscalls/unlink/unlink08.c +++ b/testcases/kernel/syscalls/unlink/unlink08.c @@ -3,15 +3,14 @@ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. */ -/* - * Description: - * The testcase checks the various errnos of the unlink(2). - * 1) unlink() returns EACCES when deleting file in unwritable directory - * as an unprivileged user. - * 2) unlink() returns EACCES when deleting file in "unsearchable directory - * as an unprivileged user. - * 3) unlink() returns EISDIR when deleting directory for root - * 4) unlink() returns EISDIR when deleting directory for regular user +/*\ + * [Description] + * + * Verify that unlink(2) fails with + * - EACCES when no write access to the directory containing pathname. + * - EACCES when one of the directories in pathname did not allow search. + * - EISDIR when deleting directory as root user. + * - EISDIR when deleting directory as non-root user. */ #include @@ -36,21 +35,9 @@ static struct test_case_t { static void verify_unlink(struct test_case_t *tc) { - TEST(unlink(tc->name)); - if (TST_RET != -1) { - tst_res(TFAIL, "unlink(<%s>) succeeded unexpectedly", - tc->desc); - return; - } - - if (TST_ERR == tc->exp_errno) { - tst_res(TPASS | TTERRNO, "unlink(<%s>) failed as expected", - tc->desc); - } else { - tst_res(TFAIL | TTERRNO, - "unlink(<%s>) failed, expected errno: %s", - tc->desc, tst_strerrno(tc->exp_errno)); - } + TST_EXP_FAIL(unlink(tc->name), + tc->exp_errno, + "%s", tc->desc); } static void do_unlink(unsigned int n)