From patchwork Mon Dec 11 16:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1874591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=aK712ws8; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=b8SLnE9u; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=P9D2VedU; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=x5oAOY43; 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 4Spn433HSxz20Gs for ; Tue, 12 Dec 2023 03:18:43 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8C19A3CF808 for ; Mon, 11 Dec 2023 17:18:38 +0100 (CET) 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 B5E983CF7E8 for ; Mon, 11 Dec 2023 17:18:15 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (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 AD3251A02394 for ; Mon, 11 Dec 2023 17:18:14 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E3ECF223F5; Mon, 11 Dec 2023 16:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vv00gkRo74J9jfzwdYXpEqk1bzjq7h6c2pVFh9dc2EA=; b=aK712ws88xoUEHHLezIQGCLg5gH1qsrFW5jzpniqOK4p5VRVwVO6o4cd696kvVZNn52ttN 2eFZj0AyRFHFmPkAbhWL109Frg8nWU/XL0290QO1M5Vs+aCh8XZAJmqmmnXba1ezBeVuvS B+mTJhnh7/V9JDCeQOdajU5WGruvsD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vv00gkRo74J9jfzwdYXpEqk1bzjq7h6c2pVFh9dc2EA=; b=b8SLnE9uQma9YlK78rEzaiJzAIUx98quHT0xNJRtBuICi3FHboPC1pJF60oYgJYC6PGe+z JkL+SHxZphm0/3BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vv00gkRo74J9jfzwdYXpEqk1bzjq7h6c2pVFh9dc2EA=; b=P9D2VedUY3SCeW+DSmZceWAfGnfYZMqd8GBxI9oIXjJv5Lk7WX9S1cGyxm5lAeYJcOJVAw 0Ky1NWgCi3WyS2+vxMxKdt/eERC4A6wZtsVqdSEtM4We4YWxPUqRntcV1uGKCXh8FuEL85 A0VfWb3+0hL6GPhpMS6aUxleST0RLNw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311492; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vv00gkRo74J9jfzwdYXpEqk1bzjq7h6c2pVFh9dc2EA=; b=x5oAOY43zRhjjujmdrmpjB2lErLAO4q3MNlxtSaJri6AHIqo4AedDb5mYmVLEknbC34Uek UqNq++OswV0bpZCg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 4D8F213A6B; Mon, 11 Dec 2023 16:18:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id qLuRD0Q2d2XbCwAAn2gu4w (envelope-from ); Mon, 11 Dec 2023 16:18:12 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 11 Dec 2023 17:18:05 +0100 Message-ID: <20231211161807.526714-2-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211161807.526714-1-pvorel@suse.cz> References: <20231211161807.526714-1-pvorel@suse.cz> MIME-Version: 1.0 X-Spam-Score: 17.77 X-Spamd-Result: default: False [9.74 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(4.60)[~all]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[8]; NEURAL_HAM_SHORT(-0.20)[-0.983]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.56)[-0.557]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(1.20)[suse.cz]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:98:from] X-Spamd-Bar: +++++++++ X-Rspamd-Server: rspamd1 X-Spam-Flag: NO X-Rspamd-Queue-Id: E3ECF223F5 X-Spam-Score: 9.74 Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=P9D2VedU; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=x5oAOY43; spf=softfail (smtp-out1.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of pvorel@suse.cz) smtp.mailfrom=pvorel@suse.cz; dmarc=none X-Virus-Scanned: clamav-milter 1.0.1 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 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 v3 1/3] lib/tests: Add test for testing tst_res() flags 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: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Petr Vorel --- lib/newlib_tests/tst_res_flags.c | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/newlib_tests/tst_res_flags.c diff --git a/lib/newlib_tests/tst_res_flags.c b/lib/newlib_tests/tst_res_flags.c new file mode 100644 index 000000000..dc8f27e74 --- /dev/null +++ b/lib/newlib_tests/tst_res_flags.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Petr Vorel + */ + +/* + * Test tst_res() flags. + */ + +#include "tst_test.h" + +#define FLAG(x) .flag = x, .str = #x +static struct tcase { + int flag; + const char *str; +} tcases[] = { + {FLAG(TPASS)}, + {FLAG(TFAIL)}, + {FLAG(TBROK)}, + {FLAG(TCONF)}, + {FLAG(TWARN)}, + {FLAG(TINFO)}, +}; + +static void do_cleanup(void) +{ + tst_brk(TBROK, "TBROK message should be TWARN in cleanup"); +} + +static void do_test(unsigned int n) +{ + int flag = tcases[n].flag; + const char *str = tcases[n].str; + + tst_res(flag, "%s message", str); + + if (flag == TWARN || flag == TINFO) + tst_res(TPASS, "%s message is not a result", str); +} + +static struct tst_test test = { + .test = do_test, + .tcnt = ARRAY_SIZE(tcases), + .cleanup = do_cleanup, +}; From patchwork Mon Dec 11 16:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1874589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=f2Ye2cOi; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JwpdnbI2; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=f2Ye2cOi; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JwpdnbI2; 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 4Spn3s2cTPz20Gv for ; Tue, 12 Dec 2023 03:18:31 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A15B43CF81C for ; Mon, 11 Dec 2023 17:18:28 +0100 (CET) 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 AA2853CC42B for ; Mon, 11 Dec 2023 17:18:15 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 E44B31A02399 for ; Mon, 11 Dec 2023 17:18:14 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AE32F1FBA1; Mon, 11 Dec 2023 16:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cier/WXEvWWKzxb5YLDAzwH0n4kyse7npl7Wd4ns0jI=; b=f2Ye2cOiY6RUhyIOgUP9B3idhnPBLNViPSxtfp3amV5TewgpHop5XiRq4ee6p9hEAlSPT2 bWg6sdMRRkCXxy9lLjQ6723ndPbK6ckUljWPlrQYefAkN96Jj7aOWhfUL3fU5yfq0LN2tM l+TobEDcawxm6b3jzi/mX4h1IUsjhiI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cier/WXEvWWKzxb5YLDAzwH0n4kyse7npl7Wd4ns0jI=; b=JwpdnbI2y/85cU+rxcSFHkbe8JdjB6gRKzBjKfaCUPGgGNInIPjahJMz65+jfcJcatgDVd 5eq//f/D76BmxKCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cier/WXEvWWKzxb5YLDAzwH0n4kyse7npl7Wd4ns0jI=; b=f2Ye2cOiY6RUhyIOgUP9B3idhnPBLNViPSxtfp3amV5TewgpHop5XiRq4ee6p9hEAlSPT2 bWg6sdMRRkCXxy9lLjQ6723ndPbK6ckUljWPlrQYefAkN96Jj7aOWhfUL3fU5yfq0LN2tM l+TobEDcawxm6b3jzi/mX4h1IUsjhiI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cier/WXEvWWKzxb5YLDAzwH0n4kyse7npl7Wd4ns0jI=; b=JwpdnbI2y/85cU+rxcSFHkbe8JdjB6gRKzBjKfaCUPGgGNInIPjahJMz65+jfcJcatgDVd 5eq//f/D76BmxKCA== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 123E1138FF; Mon, 11 Dec 2023 16:18:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id GE4cAEU2d2XbCwAAn2gu4w (envelope-from ); Mon, 11 Dec 2023 16:18:13 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 11 Dec 2023 17:18:06 +0100 Message-ID: <20231211161807.526714-3-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211161807.526714-1-pvorel@suse.cz> References: <20231211161807.526714-1-pvorel@suse.cz> MIME-Version: 1.0 X-Spam-Score: 14.71 X-Spamd-Result: default: False [6.67 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(4.60)[~all:c]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[8]; NEURAL_HAM_SHORT(-0.20)[-0.983]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.62)[-0.619]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(1.20)[suse.cz]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:98:from] X-Spamd-Bar: ++++++ X-Rspamd-Server: rspamd1 X-Spam-Flag: NO X-Rspamd-Queue-Id: AE32F1FBA1 X-Spam-Score: 6.67 Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=f2Ye2cOi; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=JwpdnbI2; spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of pvorel@suse.cz) smtp.mailfrom=pvorel@suse.cz; dmarc=none X-Virus-Scanned: clamav-milter 1.0.1 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 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 v3 2/3] lib: Add support for TDEBUG tst_res() flag 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: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" To print more verbose info. By default it's off, printing enabled with -v option. Use unused value 8 (former TRETR). Assigned color is white. Signed-off-by: Petr Vorel --- doc/C-Test-API.asciidoc | 9 +++++---- include/tst_ansi_color.h | 3 +++ include/tst_common.h | 2 +- include/tst_res_flags.h | 1 + include/tst_test.h | 5 +++-- lib/newlib_tests/tst_res_flags.c | 6 ++++-- lib/tst_ansi_color.c | 3 +++ lib/tst_res.c | 9 ++++++--- lib/tst_test.c | 12 ++++++++++++ 9 files changed, 38 insertions(+), 12 deletions(-) diff --git a/doc/C-Test-API.asciidoc b/doc/C-Test-API.asciidoc index dab811564..19dcc37b7 100644 --- a/doc/C-Test-API.asciidoc +++ b/doc/C-Test-API.asciidoc @@ -224,10 +224,11 @@ void tst_res(int ttype, char *arg_fmt, ...); Printf-like function to report test result, it's mostly used with ttype: |============================== -| 'TPASS' | Test has passed. -| 'TFAIL' | Test has failed. -| 'TINFO' | General message. -| 'TWARN' | Something went wrong but we decided to continue. Mostly used in cleanup functions. +| 'TPASS' | Test has passed. +| 'TFAIL' | Test has failed. +| 'TINFO' | General message. +| 'TDEBUG' | Debug message (C API only, printed with '-v'). +| 'TWARN' | Something went wrong but we decided to continue. Mostly used in cleanup functions. |============================== The 'ttype' can be combined bitwise with 'TERRNO' or 'TTERRNO' to print diff --git a/include/tst_ansi_color.h b/include/tst_ansi_color.h index 770bf46d9..376d4ad63 100644 --- a/include/tst_ansi_color.h +++ b/include/tst_ansi_color.h @@ -4,14 +4,17 @@ #ifndef TST_ANSI_COLOR_H__ #define TST_ANSI_COLOR_H__ + /* * NOTE: these colors should match colors defined in tst_flag2color() in * testcases/lib/tst_ansi_color.sh */ + #define ANSI_COLOR_BLUE "\033[1;34m" #define ANSI_COLOR_GREEN "\033[1;32m" #define ANSI_COLOR_MAGENTA "\033[1;35m" #define ANSI_COLOR_RED "\033[1;31m" +#define ANSI_COLOR_WHITE "\033[1;37m" #define ANSI_COLOR_YELLOW "\033[1;33m" #define ANSI_COLOR_RESET "\033[0m" diff --git a/include/tst_common.h b/include/tst_common.h index 520cca72c..b14bbae04 100644 --- a/include/tst_common.h +++ b/include/tst_common.h @@ -80,7 +80,7 @@ #define TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition) \ TST_BUILD_BUG_ON(condition) -#define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \ +#define TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(condition) \ TST_BUILD_BUG_ON(condition) /* stringification */ diff --git a/include/tst_res_flags.h b/include/tst_res_flags.h index 8eda2f8b8..872352144 100644 --- a/include/tst_res_flags.h +++ b/include/tst_res_flags.h @@ -11,6 +11,7 @@ #define TFAIL 1 /* Test failed flag */ #define TBROK 2 /* Test broken flag */ #define TWARN 4 /* Test warning flag */ +#define TDEBUG 8 /* Test debug information flag */ #define TINFO 16 /* Test information flag */ #define TCONF 32 /* Test not appropriate for configuration flag */ #define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK) diff --git a/include/tst_test.h b/include/tst_test.h index 75c2109b9..0c3171e5b 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -54,8 +54,9 @@ void tst_res_(const char *file, const int lineno, int ttype, #define tst_res(ttype, arg_fmt, ...) \ ({ \ - TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(!((TTYPE_RESULT(ttype) ?: TCONF) & \ - (TCONF | TFAIL | TINFO | TPASS | TWARN))); \ + TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\ + !((TTYPE_RESULT(ttype) ?: TCONF) & \ + (TCONF | TDEBUG | TFAIL | TINFO | TPASS | TWARN))); \ tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\ }) diff --git a/lib/newlib_tests/tst_res_flags.c b/lib/newlib_tests/tst_res_flags.c index dc8f27e74..318d0d9eb 100644 --- a/lib/newlib_tests/tst_res_flags.c +++ b/lib/newlib_tests/tst_res_flags.c @@ -13,6 +13,7 @@ static struct tcase { int flag; const char *str; + const char *note; } tcases[] = { {FLAG(TPASS)}, {FLAG(TFAIL)}, @@ -20,6 +21,7 @@ static struct tcase { {FLAG(TCONF)}, {FLAG(TWARN)}, {FLAG(TINFO)}, + {FLAG(TDEBUG), " (printed only with -v)"}, }; static void do_cleanup(void) @@ -32,9 +34,9 @@ static void do_test(unsigned int n) int flag = tcases[n].flag; const char *str = tcases[n].str; - tst_res(flag, "%s message", str); + tst_res(flag, "%s message%s", str, tcases[n].note ?: ""); - if (flag == TWARN || flag == TINFO) + if (flag == TWARN || flag == TINFO || flag == TDEBUG) tst_res(TPASS, "%s message is not a result", str); } diff --git a/lib/tst_ansi_color.c b/lib/tst_ansi_color.c index 1c29268f2..98041c0af 100644 --- a/lib/tst_ansi_color.c +++ b/lib/tst_ansi_color.c @@ -31,6 +31,9 @@ char* tst_ttype2color(int ttype) case TINFO: return ANSI_COLOR_BLUE; break; + case TDEBUG: + return ANSI_COLOR_WHITE; + break; default: return ""; } diff --git a/lib/tst_res.c b/lib/tst_res.c index e0896eb05..5125001f7 100644 --- a/lib/tst_res.c +++ b/lib/tst_res.c @@ -157,6 +157,7 @@ const char *strttype(int ttype) PAIR(TCONF) PAIR(TWARN) PAIR(TINFO) + PAIR(TDEBUG) }; PAIR_LOOKUP(ttype_pairs, TTYPE_RESULT(ttype)); @@ -174,8 +175,10 @@ static void tst_res__(const char *file, const int lineno, int ttype, int len = 0; int ttype_result = TTYPE_RESULT(ttype); - if (file && (ttype_result != TPASS && ttype_result != TINFO)) + if (file && (ttype_result != TPASS && ttype_result != TINFO && + ttype_result != TDEBUG)) len = sprintf(tmesg, "%s:%d: ", file, lineno); + EXPAND_VAR_ARGS(tmesg + len, arg_fmt, USERMESG - len); /* @@ -193,7 +196,7 @@ static void tst_res__(const char *file, const int lineno, int ttype, * Set the test case number and print the results, depending on the * display type. */ - if (ttype_result == TWARN || ttype_result == TINFO) { + if (ttype_result == TWARN || ttype_result == TINFO || ttype_result == TDEBUG) { tst_print(TCID, 0, ttype, tmesg); } else { if (tst_count < 0) @@ -411,7 +414,7 @@ void tst_exit(void) tst_old_flush(); - T_exitval &= ~TINFO; + T_exitval &= ~(TINFO | TDEBUG); if (T_exitval == TCONF && passed_cnt) T_exitval &= ~TCONF; diff --git a/lib/tst_test.c b/lib/tst_test.c index c2f8f503f..f5c87ed9e 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -60,6 +60,7 @@ static pid_t main_pid, lib_pid; static int mntpoint_mounted; static int ovl_mounted; static struct timespec tst_start_time; /* valid only for test pid */ +static int tdebug; struct results { int passed; @@ -224,6 +225,9 @@ static void print_result(const char *file, const int lineno, int ttype, case TINFO: res = "TINFO"; break; + case TDEBUG: + res = "TDEBUG"; + break; default: tst_brk(TBROK, "Invalid ttype value %i", ttype); abort(); @@ -352,6 +356,9 @@ void tst_res_(const char *file, const int lineno, int ttype, { va_list va; + if (ttype == TDEBUG && !tdebug) + return; + va_start(va, fmt); tst_vres_(file, lineno, ttype, fmt, va); va_end(va); @@ -511,6 +518,7 @@ static struct option { {"h", "-h Prints this help"}, {"i:", "-i n Execute test n times"}, {"I:", "-I x Execute test for n seconds"}, + {"v", "-v Prints debug information"}, {"V", "-V Prints LTP version"}, {"C:", "-C ARG Run child process with ARG arguments (used internally)"}, }; @@ -692,6 +700,10 @@ static void parse_opts(int argc, char *argv[]) else duration = SAFE_STRTOF(optarg, 0.1, HUGE_VALF); break; + case 'v': + tdebug = 1; + tst_res(TINFO, "Run with -v, printing debug info"); + break; case 'V': fprintf(stderr, "LTP version: " LTP_VERSION "\n"); exit(0); From patchwork Mon Dec 11 16:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1874592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=CouItezK; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Yo8x6OeI; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=CouItezK; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Yo8x6OeI; 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 4Spn4C0JnYz20Gs for ; Tue, 12 Dec 2023 03:18:51 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 445D13CF836 for ; Mon, 11 Dec 2023 17:18:48 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1E4153CBDE7 for ; Mon, 11 Dec 2023 17:18:15 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (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 3F4521000DD7 for ; Mon, 11 Dec 2023 17:18:15 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 93CA0223F8; Mon, 11 Dec 2023 16:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ovBEU95IEmyOR2SUS5nwZ9IGiaTMOyIjJnGfo0JolAU=; b=CouItezKSn0Rz/FpGpGuv5P5yz1O4CFAATiy9Sv7sbL+apyWpTRvWZWxv2pHCjRbHUxlfk FSpQP0PvwpWD7g7LbzE6zGGCL0VaDzVAaLQLqfvsUPyGnENTAm2BlwyxhZb78DbP3dn7gq vpoFjHoTTyD5NK5x1BP25h4UhULkOOM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ovBEU95IEmyOR2SUS5nwZ9IGiaTMOyIjJnGfo0JolAU=; b=Yo8x6OeI6Jv7zvciQBzLuFs0jHq2jh/thgq9/voKqVx1JqSP3rNrxk8pZLqUtuUxEurFkL x/2vbi6godZv6xBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1702311494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ovBEU95IEmyOR2SUS5nwZ9IGiaTMOyIjJnGfo0JolAU=; b=CouItezKSn0Rz/FpGpGuv5P5yz1O4CFAATiy9Sv7sbL+apyWpTRvWZWxv2pHCjRbHUxlfk FSpQP0PvwpWD7g7LbzE6zGGCL0VaDzVAaLQLqfvsUPyGnENTAm2BlwyxhZb78DbP3dn7gq vpoFjHoTTyD5NK5x1BP25h4UhULkOOM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1702311494; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ovBEU95IEmyOR2SUS5nwZ9IGiaTMOyIjJnGfo0JolAU=; b=Yo8x6OeI6Jv7zvciQBzLuFs0jHq2jh/thgq9/voKqVx1JqSP3rNrxk8pZLqUtuUxEurFkL x/2vbi6godZv6xBw== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id C90FE13A6B; Mon, 11 Dec 2023 16:18:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id AGdDLUU2d2XbCwAAn2gu4w (envelope-from ); Mon, 11 Dec 2023 16:18:13 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Mon, 11 Dec 2023 17:18:07 +0100 Message-ID: <20231211161807.526714-4-pvorel@suse.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211161807.526714-1-pvorel@suse.cz> References: <20231211161807.526714-1-pvorel@suse.cz> MIME-Version: 1.0 X-Spam-Score: 3.70 Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 3.70 X-Spamd-Result: default: False [3.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[18.64%] X-Spam-Flag: NO X-Virus-Scanned: clamav-milter 1.0.1 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 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 Subject: [LTP] [PATCH v3 3/3] fsx-linux: Reduce log output with TDEBUG 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: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Log output is very verbose thus silent with changing most verbose TINFO messages to TDEBUG. Given how many times the test tries it's a significant time spent for printing output. This change also helps to run on slower SUT without need to set LTP_TIMEOUT_MUL environment variable. Signed-off-by: Petr Vorel Acked-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- testcases/kernel/fs/fsx-linux/fsx-linux.c | 33 ++++++++--------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/testcases/kernel/fs/fsx-linux/fsx-linux.c b/testcases/kernel/fs/fsx-linux/fsx-linux.c index 23e608189..658fc99c3 100644 --- a/testcases/kernel/fs/fsx-linux/fsx-linux.c +++ b/testcases/kernel/fs/fsx-linux/fsx-linux.c @@ -98,8 +98,7 @@ static void update_file_size(struct file_pos_t const *pos) { if (pos->offset + pos->size > file_size) { file_size = pos->offset + pos->size; - - tst_res(TINFO, "File size changed: %llu", file_size); + tst_res(TDEBUG, "File size changed: %llu", file_size); } } @@ -114,8 +113,7 @@ static int memory_compare( for (long long i = 0; i < size; i++) { diff = a[i] - b[i]; if (diff) { - tst_res(TINFO, - "File memory differs at offset=%llu ('%c' != '%c')", + tst_res(TDEBUG, "File memory differs at offset=%llu ('%c' != '%c')", offset + i, a[i], b[i]); break; } @@ -135,10 +133,8 @@ static int op_read(void) op_file_position(file_size, op_read_align, &pos); - tst_res(TINFO, - "Reading at offset=%llu, size=%llu", - pos.offset, - pos.size); + tst_res(TDEBUG, "Reading at offset=%llu, size=%llu", + pos.offset, pos.size); memset(temp_buff, 0, file_max_size); @@ -176,10 +172,8 @@ static int op_write(void) temp_buff[i] = data; } - tst_res(TINFO, - "Writing at offset=%llu, size=%llu", - pos.offset, - pos.size); + tst_res(TDEBUG, "Writing at offset=%llu, size=%llu", + pos.offset, pos.size); SAFE_LSEEK(file_desc, (off_t)pos.offset, SEEK_SET); SAFE_WRITE(SAFE_WRITE_ALL, file_desc, temp_buff, pos.size); @@ -194,10 +188,9 @@ static int op_truncate(void) struct file_pos_t pos; op_file_position(file_max_size, op_trunc_align, &pos); - file_size = pos.offset + pos.size; - tst_res(TINFO, "Truncating to %llu", file_size); + tst_res(TDEBUG, "Truncating to %llu", file_size); SAFE_FTRUNCATE(file_desc, file_size); memset(file_buff + file_size, 0, file_max_size - file_size); @@ -218,10 +211,8 @@ static int op_map_read(void) op_file_position(file_size, op_read_align, &pos); op_align_pages(&pos); - tst_res(TINFO, - "Map reading at offset=%llu, size=%llu", - pos.offset, - pos.size); + tst_res(TDEBUG, "Map reading at offset=%llu, size=%llu", + pos.offset, pos.size); addr = SAFE_MMAP( 0, pos.size, @@ -261,10 +252,8 @@ static int op_map_write(void) if (file_size < pos.offset + pos.size) SAFE_FTRUNCATE(file_desc, pos.offset + pos.size); - tst_res(TINFO, - "Map writing at offset=%llu, size=%llu", - pos.offset, - pos.size); + tst_res(TDEBUG, "Map writing at offset=%llu, size=%llu", + pos.offset, pos.size); for (long long i = 0; i < pos.size; i++) file_buff[pos.offset + i] = random() % 10 + 'l';