From patchwork Thu Aug 17 08:46:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu \\(Fujitsu\\)" X-Patchwork-Id: 1822202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RRJY76l9Pz1yfk for ; Thu, 17 Aug 2023 18:47:36 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8A1EC3CCBE4 for ; Thu, 17 Aug 2023 10:47:33 +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 7072D3CB9A0 for ; Thu, 17 Aug 2023 10:47:31 +0200 (CEST) Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 67E911A00CC9 for ; Thu, 17 Aug 2023 10:47:29 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="116491031" X-IronPort-AV: E=Sophos;i="6.01,179,1684767600"; d="scan'208";a="116491031" Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2023 17:47:26 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id C187ECA1E4 for ; Thu, 17 Aug 2023 17:47:24 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id EE369BF4AF for ; Thu, 17 Aug 2023 17:47:23 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.215.131]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 7165220074739; Thu, 17 Aug 2023 17:47:23 +0900 (JST) From: Yang Xu To: ltp@lists.linux.it Date: Thu, 17 Aug 2023 16:46:48 +0800 Message-Id: <1692262008-9126-1-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-27818.005 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-27818.005 X-TMASE-Result: 10--6.405000-10.000000 X-TMASE-MatchedRID: QAAr3LZ6Q9IxAROjHaAf26ncG1vVsfbQwTlc9CcHMZerwqxtE531VKQQ tsHSQRrXofT1xcfXENRvp+b/wK4TT1lDiuV7LjH+PKN38CLPK0H5UnqVnIHSz7s3Yh2IOCYzAu0 C/xvh/SiBwOiAXd70LIQWsdcgJn9KNyl1nd9CIt0URSScn+QSXmVV1G+Ck2l7+gtHj7OwNO38o7 Ys1NK4Y6vI7YG+kYGXoZxvxJ1NrvByucLWAAcCjEQvj8flU7Q4 X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Virus-Scanned: clamav-milter 1.0.1 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH] write02: Simplify test using TST_ 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: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Yang Xu --- testcases/kernel/syscalls/write/write02.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/testcases/kernel/syscalls/write/write02.c b/testcases/kernel/syscalls/write/write02.c index 2f630ab65..ab38dce77 100644 --- a/testcases/kernel/syscalls/write/write02.c +++ b/testcases/kernel/syscalls/write/write02.c @@ -2,27 +2,24 @@ /* * Copyright (c) 2017 Carlo Marcelo Arenas Belon * Copyright (c) 2018 Cyril Hrubis + * Copyright (c) Linux Test Project, 2003-2023 */ -/* + +/*\ + * [Description] + * * Tests for a special case NULL buffer with size 0 is expected to return 0. */ -#include #include "tst_test.h" static int fd; static void verify_write(void) { - TEST(write(fd, NULL, 0)); - - if (TST_RET != 0) { - tst_res(TFAIL | TTERRNO, - "write() should have succeeded with ret=0"); - return; - } + TST_EXP_POSITIVE(write(fd, NULL, 0)); - tst_res(TPASS, "write(fd, NULL, 0) == 0"); + TST_EXP_EXPR(TST_RET == 0, "write(fd, NULL, %ld) == %d", TST_RET, 0); } static void setup(void)