Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6390BE7719A for ; Thu, 9 Jan 2025 14:13:53 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E142F3C2672 for ; Thu, 9 Jan 2025 15:13:51 +0100 (CET) Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (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 2697D3C2573 for ; Thu, 9 Jan 2025 15:11:19 +0100 (CET) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) 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 6AD651BDC7C7 for ; Thu, 9 Jan 2025 15:11:19 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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 F16721F453 for ; Thu, 9 Jan 2025 14:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1736431879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfz6yGeBr5Eo6GHbe+Kv4EIu+lbHal2FzNIvGIAU5sI=; b=PztyC1mlzCfY2ncCwhf9DJb4PoayktHgL2ZNCpxsSu245njI27bBb0iZx48ZTxwiuW9hs0 2SORlISs9U+ZOEe3/+JwSVk8eCrmhHGxxD6QULAn2mklNHbjpMbcnS2y7sFPB/Kci+H6id R8Sz0N/0VPJsVTjE2sZBMaNVEY19tM0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1736431879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfz6yGeBr5Eo6GHbe+Kv4EIu+lbHal2FzNIvGIAU5sI=; b=O4bstHvrdULkvctW/ebUU2NkfZkEk6AAjH4jESalUYRaCm5A3+n3UQhhbljPDMOfmW9Eyf k7nxgI6Md+oY+0AA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1736431878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfz6yGeBr5Eo6GHbe+Kv4EIu+lbHal2FzNIvGIAU5sI=; b=oUdMLlxpMtwnD5neTK+YJu8/9sPND4kc7pomcKlesIgcz83luzzTk5YP8H+gc9YyHG2Kbc fqiug59vkcqxysTeYsxAFrrCYaRVN3GmKHV1pcyIJsnV9VTna2GOHYtIdUv6hiqlBMa0HN GLAw4LO7BhEhQkK/1iupnBQPnb9hF7Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1736431878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfz6yGeBr5Eo6GHbe+Kv4EIu+lbHal2FzNIvGIAU5sI=; b=UPmoUoU4qS2V+RWPkH6/vSDUnPcb5YpXXgE8AYlAnLPLkMopsqaYtR1Y8jnHvVwB/YZTdm SxYf5BupY0bxUUBA== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DCFE013876 for ; Thu, 9 Jan 2025 14:11:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qAQQNAbZf2eVWgAAD6G6ig (envelope-from ) for ; Thu, 09 Jan 2025 14:11:18 +0000 From: Andrea Cervesato Date: Thu, 09 Jan 2025 15:11:12 +0100 MIME-Version: 1.0 Message-Id: <20250109-fix_setsid_tests-v3-9-2ce60c904019@suse.com> References: <20250109-fix_setsid_tests-v3-0-2ce60c904019@suse.com> In-Reply-To: <20250109-fix_setsid_tests-v3-0-2ce60c904019@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736431876; l=1790; i=andrea.cervesato@suse.com; s=20240812; h=from:subject:message-id; bh=SpOeoEKb/ksz7WuPBLBst7GA1uI4tSt5sgy9yZjYrGc=; b=v71ERJMoWO4BaJo/vkv1ydPH5volI0EuMali1cfEZyC00AkyVZwUSb+iNyIfT5glE+NmfbL/t kEX8Ebk9b6mC+P13Tv7M/eXv+eTeeHLmkPPsmcXD3dPFi0sOP8eOctd X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=RG/nLJ5snb1tLKGwSORQXBJ5XA4juT0WF2Pc/lq9meo= X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:mid, suse.com:email] X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 09/12] Add TST_EXP_EQ_STRN macro 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato New TST_EXP_EQ_STRN macro can be used to compare two strings, passing their length if needed. Signed-off-by: Andrea Cervesato --- include/tst_test_macros.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h index b2ca32f7710df33898092746140c57e5c6428525..dcfe5307df3e2bf2aed1e7e449f9799c65ee6d0d 100644 --- a/include/tst_test_macros.h +++ b/include/tst_test_macros.h @@ -425,4 +425,25 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt); } \ } while (0) +/** + * TST_EXP_EQ_STRN() - Compare two strings, providing length as well. + * + * @STR_A: string to compare. + * @STR_B: string to compare. + * @LEN: length of the string. + */ +#define TST_EXP_EQ_STRN(STR_A, STR_B, LEN) do { \ + TST_PASS = strncmp(STR_A, STR_B, LEN) == 0; \ + \ + if (TST_PASS) { \ + tst_res_(__FILE__, __LINE__, TPASS, \ + "%s == %s (%s)", \ + #STR_A, #STR_B, STR_B); \ + } else { \ + tst_res_(__FILE__, __LINE__, TFAIL, \ + "%s (%s) != %s (%s)", \ + #STR_A, STR_A, #STR_B, STR_B); \ + } \ +} while (0) + #endif /* TST_TEST_MACROS_H__ */ -- 2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp