From patchwork Thu Feb 8 01:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Gao X-Patchwork-Id: 1896393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.linux.it header.i=@lists.linux.it header.a=rsa-sha256 header.s=picard header.b=iX8rRWxP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=HZwNjeGp; dkim-atps=neutral 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 4TVfcw34pBz23gM for ; Thu, 8 Feb 2024 12:33:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1707355982; h=to : date : message-id : in-reply-to : references : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : content-type : content-transfer-encoding : sender : from; bh=FNuSltNItraQiZOLuVcJ2q7jikeUBP/UUleomjbYyQ4=; b=iX8rRWxPfrLzJFHWKetIMsdvd2Olv0QgmCzsEMizxvvp+pWEiyBWloVEMX392OrjlLrmb eXxZcmxAfDAVWprFOlCEWi4Dld5AP1jhniyfZZqlCurmtrG5jRpPSBSdsOj03oZzSvm9RnZ YiyX4TRGcUfWu/25d4VGk83BZv14yyA= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 41B313C62C5 for ; Thu, 8 Feb 2024 02:33:02 +0100 (CET) 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 (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 568733CE137 for ; Thu, 8 Feb 2024 02:32:44 +0100 (CET) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 57D5E1182E52 for ; Thu, 8 Feb 2024 02:32:44 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d0b750518bso15273961fa.0 for ; Wed, 07 Feb 2024 17:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707355963; x=1707960763; darn=lists.linux.it; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b0Q79WvzOJ7KKSRAFzoZf70tqskSSXeL6A7KS/u5PVc=; b=HZwNjeGpCHAlwiFX78KUnQQMD2vn4314Jn0mGARMRp/YSRX2Y4gvtnVEpeoIpnRWRr yPIBB7UmHZ2otRCLE1+Otlo8WmyHbNN0ccFMPV/9AIBAbdp0zOxcx1jv6qFF03hPE0jq 4xQqNV4EW5IgKnUadmeRK4gXz85uFu4QoHJeTzeKDmnx4CLmuwPyP1AN6swG/5OSBUoa QtI3XeyxNzIeZHsoJNWDJsybKFoO88T7LWPc5S9gzL3Z2lNTYOUIBlAa6K5/IVgGGay2 tiB0K+0VLflrb7J0JmML0dv4VOENmhK5kwEaLBy4ymQbCxlHi8TsECnfj6jHa0Vr9sN9 qFmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707355963; x=1707960763; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b0Q79WvzOJ7KKSRAFzoZf70tqskSSXeL6A7KS/u5PVc=; b=cMN+F/GP3Hj4ySE2rWwyRsLdaJKTjS6YsuF5nMEi7a2grMbvjrblhUFLQ4jRXXrVem 0rOFBbzQFru/cmVciKudxkakS/y0rhNLebZ0VcMHw9raJlZ6YJxTZJgwB+d8s79t9YBh 3dmdHUxkLrgzryzy9UHXv8jU2P1MizlIQhEH4VgiL+L8g/KtZf5iycxw2rrzW4KDsLd9 R4c34EXaPAQVNm6axAlAHs3YJGzwPWNEhU6zkGf4mbyHwYEHv1sot5tIEjYUJpZhUcap I0hY4GfC6RP91OP1hJ9C/26LwauaLzXLGH7t4BaKpuZmbWepdWdRN1j2xD/KhFY74HM6 WqPg== X-Gm-Message-State: AOJu0Yzwt+Cf4NzvzdfvLi2WavuQ8xbeGhTPrHTut0xYzgs0Fzs0nJoO 6ltQeHUq19JkANV1/ESCs+sVFn7bBDGmpTkTpeTVaII6CiybPvyLgX6FzPXPSfY1Obm711k1bqI = X-Google-Smtp-Source: AGHT+IE5OR6GbKSH97hbwCaMOe2GsJQgY/028yJ8ypPYM1TCdgVwNA4M3XrB4YgRxWr7qOoOEMvO8w== X-Received: by 2002:a05:651c:cf:b0:2d0:a19f:e448 with SMTP id 15-20020a05651c00cf00b002d0a19fe448mr5044318ljr.13.1707355962980; Wed, 07 Feb 2024 17:32:42 -0800 (PST) Received: from localhost ([223.72.87.18]) by smtp.gmail.com with ESMTPSA id lg6-20020a170902fb8600b001d987771271sm2116925plb.123.2024.02.07.17.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 17:32:42 -0800 (PST) To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 20:32:22 -0500 Message-Id: <20240208013224.859-2-wegao@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240208013224.859-1-wegao@suse.com> References: <20240117125227.24700-1-wegao@suse.com> <20240208013224.859-1-wegao@suse.com> MIME-Version: 1.0 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 1/3] lib: TST_EXP_{FAIL,PASS}_PTR_{NULL,VOID} 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: , X-Patchwork-Original-From: Wei Gao via ltp From: Wei Gao Reply-To: Wei Gao Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Wei Gao Reviewed-by: Petr Vorel --- include/tst_test_macros.h | 59 ++++++++++++++++++++++++++++++ lib/newlib_tests/.gitignore | 1 + lib/newlib_tests/test_macros07.c | 61 ++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 lib/newlib_tests/test_macros07.c diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h index d2e50a219..1f5b56d27 100644 --- a/include/tst_test_macros.h +++ b/include/tst_test_macros.h @@ -227,6 +227,31 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt); } \ } while (0) +#define TST_EXP_FAIL_SILENT_PTR_(SCALL, SSCALL, FAIL_PTR_VAL, \ + ERRNOS, ERRNOS_CNT, ...) \ + do { \ + TESTPTR(SCALL); \ + \ + TST_PASS = 0; \ + \ + if (TST_RET_PTR != FAIL_PTR_VAL) { \ + TST_MSG_(TFAIL, " succeeded", SSCALL, ##__VA_ARGS__); \ + break; \ + } \ + \ + if (!tst_errno_in_set(TST_ERR, ERRNOS, ERRNOS_CNT)) { \ + char tst_str_buf__[ERRNOS_CNT * 20]; \ + TST_MSGP_(TFAIL | TTERRNO, " expected %s", \ + tst_errno_names(tst_str_buf__, \ + ERRNOS, ERRNOS_CNT), \ + SSCALL, ##__VA_ARGS__); \ + break; \ + } \ + \ + TST_PASS = 1; \ + \ + } while (0) + #define TST_EXP_FAIL_ARR_(SCALL, SSCALL, EXP_ERRS, EXP_ERRS_CNT, ...) \ do { \ TST_EXP_FAIL_SILENT_(TST_RET == 0, SCALL, SSCALL, \ @@ -258,6 +283,40 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt); TST_EXP_FAIL2_ARR_(SCALL, #SCALL, EXP_ERRS, \ ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__); +#define TST_EXP_FAIL_PTR_NULL(SCALL, EXP_ERR, ...) \ + do { \ + int tst_exp_err__ = EXP_ERR; \ + TST_EXP_FAIL_SILENT_PTR_(SCALL, #SCALL, NULL, \ + &tst_exp_err__, 1, ##__VA_ARGS__); \ + if (TST_PASS) \ + TST_MSG_(TPASS | TTERRNO, " ", #SCALL, ##__VA_ARGS__); \ + } while (0) + +#define TST_EXP_FAIL_PTR_ARR_NULL(SCALL, EXP_ERRS, ...) \ + do { \ + TST_EXP_FAIL_SILENT_PTR_(SCALL, #SCALL, NULL, \ + EXP_ERRS, ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__); \ + if (TST_PASS) \ + TST_MSG_(TPASS | TTERRNO, " ", #SCALL, ##__VA_ARGS__); \ + } while (0) + +#define TST_EXP_FAIL_PTR_VOID(SCALL, EXP_ERR, ...) \ + do { \ + int tst_exp_err__ = EXP_ERR; \ + TST_EXP_FAIL_SILENT_PTR_(SCALL, #SCALL, (void *)-1, \ + &tst_exp_err__, 1, ##__VA_ARGS__); \ + if (TST_PASS) \ + TST_MSG_(TPASS | TTERRNO, " ", #SCALL, ##__VA_ARGS__); \ + } while (0) + +#define TST_EXP_FAIL_PTR_ARR_VOID(SCALL, EXP_ERRS, ...) \ + do { \ + TST_EXP_FAIL_SILENT_PTR_(SCALL, #SCALL, (void *)-1, \ + EXP_ERRS, ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__); \ + if (TST_PASS) \ + TST_MSG_(TPASS | TTERRNO, " ", #SCALL, ##__VA_ARGS__); \ + } while (0) + #define TST_EXP_FAIL2(SCALL, EXP_ERR, ...) \ do { \ int tst_exp_err__ = EXP_ERR; \ diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore index a69b29e24..4f43899e5 100644 --- a/lib/newlib_tests/.gitignore +++ b/lib/newlib_tests/.gitignore @@ -40,6 +40,7 @@ test_macros03 test_macros04 test_macros05 test_macros06 +test_macros07 tst_fuzzy_sync01 tst_fuzzy_sync02 tst_fuzzy_sync03 diff --git a/lib/newlib_tests/test_macros07.c b/lib/newlib_tests/test_macros07.c new file mode 100644 index 000000000..ac361fd8e --- /dev/null +++ b/lib/newlib_tests/test_macros07.c @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2024 Wei Gao + */ + +/* + * Test TST_EXP_FAIL_PTR_{NULL,VOID} and TST_EXP_FAIL_PTR_ARR{NULL,VOID} macro. + */ + +#include "tst_test.h" + +static char *fail_fn_null(void) +{ + errno = EINVAL; + return NULL; +} + +static char *fail_fn_void(void) +{ + errno = EINVAL; + return (void *)-1; +} + +static char *pass_fn(void) +{ + return "pass"; +} + +static void do_test(void) +{ + const int exp_errs_pass[] = {ENOTTY, EINVAL}; + const int exp_errs_fail[] = {ENOTTY, EISDIR}; + + tst_res(TINFO, "Testing TST_EXP_FAIL_PTR_NULL macro"); + TST_EXP_FAIL_PTR_NULL(fail_fn_null(), EINVAL, "fail_fn_null()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_NULL(fail_fn_null(), ENOTTY, "fail_fn_null()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_NULL(pass_fn(), ENOTTY, "pass_fn()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_ARR_NULL(fail_fn_null(), exp_errs_pass, "fail_fn_null()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_ARR_NULL(fail_fn_null(), exp_errs_fail, "fail_fn()_null"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + + tst_res(TINFO, "Testing TST_EXP_FAIL_PTR_VOID macro"); + TST_EXP_FAIL_PTR_VOID(fail_fn_void(), EINVAL, "fail_fn_void()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_VOID(fail_fn_void(), ENOTTY, "fail_fn_void()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_VOID(pass_fn(), ENOTTY, "pass_fn()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_ARR_VOID(fail_fn_void(), exp_errs_pass, "fail_fn_void()"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); + TST_EXP_FAIL_PTR_ARR_VOID(fail_fn_void(), exp_errs_fail, "fail_fn()_void"); + tst_res(TINFO, "TST_PASS = %i", TST_PASS); +} + +static struct tst_test test = { + .test_all = do_test, +}; From patchwork Thu Feb 8 01:32:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Gao X-Patchwork-Id: 1896394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.linux.it header.i=@lists.linux.it header.a=rsa-sha256 header.s=picard header.b=Tk9sF3Ii; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=SLk+TsR1; dkim-atps=neutral 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVfdN5Jqdz23gM for ; Thu, 8 Feb 2024 12:33:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1707356006; h=to : date : message-id : in-reply-to : references : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : content-type : content-transfer-encoding : sender : from; bh=XpwRD+vEY+6CZ5usHYae23qBjIrtiEDRLReYcZonULE=; b=Tk9sF3Ii3JYuWlZdLCAAUJitN9nHQ+qjK5/V0xorq2votPfMLaRGBt7xe9mU8CBGrnecl 2XM82tuU2ak5GWvOeKAbxdVAPZskCbDviHcX2ZEWNXkFpf8+ClNasIivDbKHoC3sYORX33W 1qf3xyWSzKQbmsfHYkkOzlw0s3k84oQ= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C20C93C008C for ; Thu, 8 Feb 2024 02:33:26 +0100 (CET) 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]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 31F9F3CDED4 for ; Thu, 8 Feb 2024 02:32:52 +0100 (CET) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 8FAA7207241 for ; Thu, 8 Feb 2024 02:32:51 +0100 (CET) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d066b532f0so19775081fa.1 for ; Wed, 07 Feb 2024 17:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707355970; x=1707960770; darn=lists.linux.it; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e0/mcabtedNA38OO5RRa83KGWg7O6hfFSk3n0wWGypE=; b=SLk+TsR1Tcaliy9SW/N4lWh0yr2EETT8lRWRxUzyCmOJD1IwydC127ODdUBbkXYLFj CuGoC8jijrkBW5y03cqHDE+dzZBrRsD1/sMx2FHi9hz2R0Sh+ZF5EdSJFBIx6xlUU4BX JQ+neWfR2RCHCE0Zsax9YBJNE5H6upc2uQXIQm97osIseDjpN/NU6ITtvfwg+nIE2CYu PYt+ZSOFTN3NlSSOSHD0IUpIljJ+Z5yD4Giun0t+FxXZ0Vi31ROXo1t6zcoSpwsTmFZf 3GG2myikh1urxI/bjdv8lfo+ZCEIQ1pfgEGtDUGAkH7aqoIJAEcSVhnazILvRhF/aYPZ yp9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707355970; x=1707960770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e0/mcabtedNA38OO5RRa83KGWg7O6hfFSk3n0wWGypE=; b=EM7Gc2nEoKS3adQuFmARPrpYGWuiibyVv45STR3hHuFapZRaOuLXY17qNG8zuk/sJx MyHRqHwKwyoaWVmG8RlIGjN9+tcv/lJWUVyED/L5g8EnXmK43wt8Jy9lbI6CV0n68B8k J76xjwqW6PPxymmJ/SqNCFNlXZ3mbFucFtz7S28zDWK9b1CJM6X1hwYqL62IkQdJeGP6 3ZSSnSFGNxl2zUrmbH02YZxT53YNlpUu40sOt9aecxyNh5cdosGIHn9DZoMuf5j072nu 0emfFjYSvY2TwT+yXr1zRMYuFxV8VZWeZp5aAecYx2+pQ+qoxy4nlgknBepzu42InkwG cbyQ== X-Gm-Message-State: AOJu0YxotD6zkvSOfiuTP6BilK9Jt31QkZdZ0pWurc+l81lg13tt2AGg nCjh9OGmSgo7oulkTMCAqyuvHcMejyWtpfi7lGNIGlauoB3knqYP+nBhwIrtqb0nOix0y9y/bE8 = X-Google-Smtp-Source: AGHT+IGiF47L5hK3EMuc29/mqEeYI966oWvB2hZD1LRPRgRh0PFrz6ctlbkJAWTl672Yld1RKlQAHA== X-Received: by 2002:a05:651c:c90:b0:2d0:ca46:46be with SMTP id bz16-20020a05651c0c9000b002d0ca4646bemr4042341ljb.20.1707355970708; Wed, 07 Feb 2024 17:32:50 -0800 (PST) Received: from localhost ([223.72.87.18]) by smtp.gmail.com with ESMTPSA id y29-20020a056a00181d00b006dfb8105235sm2346561pfa.112.2024.02.07.17.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 17:32:50 -0800 (PST) To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 20:32:23 -0500 Message-Id: <20240208013224.859-3-wegao@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240208013224.859-1-wegao@suse.com> References: <20240117125227.24700-1-wegao@suse.com> <20240208013224.859-1-wegao@suse.com> MIME-Version: 1.0 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 2/3] shmat02.c: Use TST_EXP_FAIL_PTR_VOID 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: , X-Patchwork-Original-From: Wei Gao via ltp From: Wei Gao Reply-To: Wei Gao Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Wei Gao Reviewed-by: Petr Vorel --- testcases/kernel/syscalls/ipc/shmat/shmat02.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat02.c b/testcases/kernel/syscalls/ipc/shmat/shmat02.c index 53cb6f542..3ad1fd08e 100644 --- a/testcases/kernel/syscalls/ipc/shmat/shmat02.c +++ b/testcases/kernel/syscalls/ipc/shmat/shmat02.c @@ -44,20 +44,7 @@ static struct test_case_t { static void verify_shmat(struct test_case_t *tc) { - void *addr; - - addr = shmat(*tc->shmid, *tc->shmaddr, 0); - if (addr != (void *)-1) { - tst_res(TFAIL, "shmat() succeeded unexpectedly"); - return; - } - - if (errno == tc->exp_err) { - tst_res(TPASS | TERRNO, "shmat() failed as expected"); - } else { - tst_res(TFAIL | TERRNO, "shmat() failed unexpectedly, expected: %s", - tst_strerrno(tc->exp_err)); - } + TST_EXP_FAIL_PTR_VOID(shmat(*tc->shmid, *tc->shmaddr, 0), tc->exp_err); } static void do_shmat(unsigned int n) From patchwork Thu Feb 8 01:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Gao X-Patchwork-Id: 1896396 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.linux.it header.i=@lists.linux.it header.a=rsa-sha256 header.s=picard header.b=pn9Ju5xC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=NGqNtsQ5; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TVfds19Vxz23gM for ; Thu, 8 Feb 2024 12:33:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1707356030; h=to : date : message-id : in-reply-to : references : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : content-type : content-transfer-encoding : sender : from; bh=MiU2TNO17A+9p7FrNO/lBtc5iT07HK7SKblopLcCOqI=; b=pn9Ju5xC0qotyYvGrCEqwgehAjir9NigVlVoU+F6saxehTfPBCK2TDqWtZujgdQnSbX7b AfkvFF3k1Q/G8AvSvgc5le0NYAboVWmk2fXw0qsGr+QiQaBofzjgKXxPmZ2n7JyqTxZW/3E lpC00fdXdfDw/Zi5DeW5GoUz5BvSSFA= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8A39E3CF592 for ; Thu, 8 Feb 2024 02:33:50 +0100 (CET) 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 (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F1B3D3CF5B7 for ; Thu, 8 Feb 2024 02:32:59 +0100 (CET) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 867C31182E53 for ; Thu, 8 Feb 2024 02:32:59 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d09d90fa11so14876591fa.3 for ; Wed, 07 Feb 2024 17:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707355978; x=1707960778; darn=lists.linux.it; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aiXU6GUk04nI1QjSP/0cFUyYTZ4h/Tq7Yg40xCrxnbY=; b=NGqNtsQ5YCspORt4i5SUfGloTnfRg/Qt2LJUnhKyK3rvgT5O3OlQVr9p8qB/8FH2Ms RzI6BatqjNgEgF2E5fgI6gecdPsdUZaTvsmRv9DFlB48cV+2yfKNENP3oR78JUZQqkAq ORdo43wL5n81viuxqmTGW1+KIMTi6/DxvP5K7NqN2LkMjdLOgFlgc/cjK9XJrdEJUF6H 36KKVYZ5Mk0M4ys87U1xTui8KqFWklJwNM/bv1SeCweVX0rmbUaXvwfTXJH2KDrqQzwn xFRKrvshyvwtR9c3XodjoB6CJY4UQiHzE+65K8ZCYTEY0FFFzgvVJlDdyCDlc/+GCoZJ 5wVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707355978; x=1707960778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aiXU6GUk04nI1QjSP/0cFUyYTZ4h/Tq7Yg40xCrxnbY=; b=K5eil2IVzYtLOnKElsmr7PPcuxLGHVvw91J2cJV0RyXtpywIxDzhFJp3EQx/kHGr3K bvy8Api25T0rBpkUCtV1E1CA9otI3scm0f8sdIzb2YVmYtiIqz6/AYNMxqo0FzaZElws 529ryMhAv9dt3hz+Jk/t/yidW4Z/PoHPDJEcIfxMYxaDYVfGTbQOodZNxmET9SiFJ2Ko Rj98uCrbZDZnri9xC0yctz+kavD8ZYP4rm6knO0VoZDhB1CbhgFu5qBN3zobBd14zHmx ZGI6gCYmFPhoupK8u53zoh9acMV3IR4jHJ7vUeDCsRcOPst40lnj70j3oP0uSCZTbZ7G jdPg== X-Gm-Message-State: AOJu0YxpYI8HxYqSbD2Ut1c6qF2CJ+s10wsU6rNVqgmdxQxxT1inKsbt S6esnbb3ibGZvtXWV0Y2EpFgfNRxMqXkgLebTJxJyuj/tpvzjU/gNDajfs/Y6hc13Pu72JzuK3E = X-Google-Smtp-Source: AGHT+IG71G7/wg4EnN/xXm55cB/MWPuG2wqBC4tCblUVzXQeV1rjI5yLABxCh9uV1Nql0PVAqvsYbw== X-Received: by 2002:a2e:b0cb:0:b0:2d0:a81e:9099 with SMTP id g11-20020a2eb0cb000000b002d0a81e9099mr4701345ljl.38.1707355978589; Wed, 07 Feb 2024 17:32:58 -0800 (PST) Received: from localhost ([223.72.87.18]) by smtp.gmail.com with ESMTPSA id je15-20020a170903264f00b001d8f3c7fb96sm2133642plb.166.2024.02.07.17.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 17:32:58 -0800 (PST) To: ltp@lists.linux.it Date: Wed, 7 Feb 2024 20:32:24 -0500 Message-Id: <20240208013224.859-4-wegao@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240208013224.859-1-wegao@suse.com> References: <20240117125227.24700-1-wegao@suse.com> <20240208013224.859-1-wegao@suse.com> MIME-Version: 1.0 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 3/3] realpath01.c: use TST_EXP_FAIL_PTR_NULL 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: , X-Patchwork-Original-From: Wei Gao via ltp From: Wei Gao Reply-To: Wei Gao Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Wei Gao Reviewed-by: Petr Vorel --- testcases/kernel/syscalls/realpath/realpath01.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/testcases/kernel/syscalls/realpath/realpath01.c b/testcases/kernel/syscalls/realpath/realpath01.c index c0381e9cb..c4c603609 100644 --- a/testcases/kernel/syscalls/realpath/realpath01.c +++ b/testcases/kernel/syscalls/realpath/realpath01.c @@ -24,16 +24,7 @@ static void setup(void) static void run(void) { - TESTPTR(realpath(".", NULL)); - - if (TST_ERR != ENOENT) { - tst_res(TFAIL | TTERRNO, "returned unexpected errno"); - } else if (TST_RET_PTR != NULL) { - tst_res(TFAIL, "syscall didn't return NULL: '%s'", - (char *)TST_RET_PTR); - } else { - tst_res(TPASS, "bug not reproduced"); - } + TST_EXP_FAIL_PTR_NULL(realpath(".", NULL), ENOENT); } static struct tst_test test = {