From patchwork Tue Jul 2 14:12:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1955397 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.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=MFa45ff0; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NwGA6vLJ; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GuNKtWEQ; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=qP6gp6Zl; 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 4WD4ds6Sp5z1xpc for ; Wed, 3 Jul 2024 00:13:53 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4B6D53D3EF5 for ; Tue, 2 Jul 2024 16:13:51 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (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 265693D0F6E for ; Tue, 2 Jul 2024 16:13:17 +0200 (CEST) Authentication-Results: in-5.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) 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-5.smtp.seeweb.it (Postfix) with ESMTPS id 5A0CD600D23 for ; Tue, 2 Jul 2024 16:13:16 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id E12C621B35; Tue, 2 Jul 2024 14:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxGIOTjfgranbi7OPz+BNSoi416zFnO1MmmSbqLAyuo=; b=MFa45ff0tTRUrPdO1xXalkQeWFQMTebKlH3Dc/E456kFXHz/B0iQklQMMwpZZkCIJlZamO rgisgXcZfGeXejkYN897tRkEhAgkh+iqa/U1gDm3CuhA6D57qJF+Ps+DDHnMayDRTyMp0X 00EjYY/jo/3kKKZZzyl6DA4vjtTgEz0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxGIOTjfgranbi7OPz+BNSoi416zFnO1MmmSbqLAyuo=; b=NwGA6vLJ36scMKThu6mZp915gEZbxbdx8Atd0C6Lo1yojj2SRmuCWpZZq2hYch+Ox5DXSJ +ivUclZNpn3XerBA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GuNKtWEQ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=qP6gp6Zl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxGIOTjfgranbi7OPz+BNSoi416zFnO1MmmSbqLAyuo=; b=GuNKtWEQ0sDrMtSypO6q5y2gU/2Fj64gjYNgr6UdNjobixk2IzGlyctE+IBUaTkhUNBMzh u9cr2aU1GYaY5lHnM9Go5O4CXdqVqk18XnMitFHRjnOSp42kBetmsbUYZDRFgmLqDGyKWZ 5j9TWI+ilSyHr3WnIL8JxspbXWrNrnQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxGIOTjfgranbi7OPz+BNSoi416zFnO1MmmSbqLAyuo=; b=qP6gp6Zl0UOs55YZmo6yqbodpG+W7OfJ+ImfwhdQ4vNVE2sr/gty3Q2UQOfNCPgXepPRbE MjmW67ySiBSwD0CQ== 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 8E14513A9A; Tue, 2 Jul 2024 14:13:14 +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 wKRhG/oKhGbpDgAAD6G6ig (envelope-from ); Tue, 02 Jul 2024 14:13:14 +0000 From: Andrea Cervesato Date: Tue, 02 Jul 2024 16:12:47 +0200 MIME-Version: 1.0 Message-Id: <20240702-stat04-v1-1-e27d9953210d@suse.com> References: <20240702-stat04-v1-0-e27d9953210d@suse.com> In-Reply-To: <20240702-stat04-v1-0-e27d9953210d@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5111; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=ifalrRp01ciiUbE3cFDBK+rcFVgB1kxSQPxX9REuQ4Y=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmhArvLWRE442iOsSOuBZMZzQSY3YD28rf56OLG K5kzA2WKcCJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZoQK7wAKCRDLzBqyILPm RsdSC/9rbAUoz8DhdLSE4amzEgbqU7Mgczl0jEbS7kfBWKnRcCaLh6MDHYuzeHontlb5qCVfZcg P3tlUk3T0Bla6dgQmc8UrzsafCDEZesdsovNB/qXRp7GESl8GXeGKAn5e0LE0SMe+EhpEagi8/0 jNvE0LBxuIqEgBDzI4bQ/rYSTMKMnniOVyRsKjvExbjJ9twZzTKFwvRqiAVvehC7/iBMWr9f4Nh 9rXYDY69ZUjIkSSbjRxenM7sYyslA8G7ho/UjkowAdYBsj5wRWGmDqg5Pts85VB4xonsr41Av9T WjzVnAbadcXKKLhMvbZ9DmY5F33jsBzF5kaSvj1c0dScQmmnxAjTqSZB57IxTUwhiCABwqz7Pna 61Y96CkbLg6caT9aOhoQxmc/znSNjTyVADFgdmeAOFwuWvYohIJ/znLRxJjgapxyd761RVpmG0O pGFDuSjw3wBFFUpkZ5CWbPOBqj7XDFZ3W7pxhB1+efaut9H+EIsUj+a8h5HoxgmZhRyZA= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E12C621B35 X-Spam-Score: -4.51 X-Spam-Level: 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 1/5] Add stat04 test 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" From: Andrea Cervesato This test has been extracted from symlink01 test and it checks that stat() executed on file provide the same information of symlink linking to it. Signed-off-by: Andrea Cervesato Reviewed-by: Li Wang --- runtest/smoketest | 4 +- runtest/syscalls | 4 +- testcases/kernel/syscalls/stat/.gitignore | 2 + testcases/kernel/syscalls/stat/stat04.c | 121 ++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+), 4 deletions(-) diff --git a/runtest/smoketest b/runtest/smoketest index f6f14fd2b..5608417f9 100644 --- a/runtest/smoketest +++ b/runtest/smoketest @@ -8,8 +8,8 @@ time01 time01 wait02 wait02 write01 write01 symlink01 symlink01 -stat04 symlink01 -T stat04 -utime07 utime07 +stat04 stat04 +utime01A symlink01 -T utime01 rename01A symlink01 -T rename01 splice02 splice02 -s 20 df01_sh df01.sh diff --git a/runtest/syscalls b/runtest/syscalls index 44a577db3..3e7a5ca1b 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1535,8 +1535,8 @@ stat02 stat02 stat02_64 stat02_64 stat03 stat03 stat03_64 stat03_64 -stat04 symlink01 -T stat04 -stat04_64 symlink01 -T stat04_64 +stat04 stat04 +stat04_64 stat04_64 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/stat/.gitignore b/testcases/kernel/syscalls/stat/.gitignore index fa0a4ce9f..0a62dc6ee 100644 --- a/testcases/kernel/syscalls/stat/.gitignore +++ b/testcases/kernel/syscalls/stat/.gitignore @@ -4,3 +4,5 @@ /stat02_64 /stat03 /stat03_64 +/stat04 +/stat04_64 diff --git a/testcases/kernel/syscalls/stat/stat04.c b/testcases/kernel/syscalls/stat/stat04.c new file mode 100644 index 000000000..ee635dbd9 --- /dev/null +++ b/testcases/kernel/syscalls/stat/stat04.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: David Fenner, Jon Hendrickson + * Copyright (C) 2024 Andrea Cervesato + */ + +/*\ + * [Description] + * + * This test checks that stat() executed on file provide the same information + * of symlink linking to it. + */ + +#include +#include "tst_test.h" + +#define FILENAME "file.txt" +#define MNTPOINT "mntpoint" +#define SYMBNAME MNTPOINT"/file_symlink" + +static struct stat *file_stat; +static struct stat *symb_stat; +static char *tmpdir; + +static void run(void) +{ + TST_EXP_EQ_LI(file_stat->st_dev, symb_stat->st_dev); + TST_EXP_EQ_LI(file_stat->st_mode, symb_stat->st_mode); + TST_EXP_EQ_LI(file_stat->st_nlink, symb_stat->st_nlink); + TST_EXP_EQ_LI(file_stat->st_uid, symb_stat->st_uid); + TST_EXP_EQ_LI(file_stat->st_gid, symb_stat->st_gid); + TST_EXP_EQ_LI(file_stat->st_size, symb_stat->st_size); + TST_EXP_EQ_LI(file_stat->st_atime, symb_stat->st_atime); + TST_EXP_EQ_LI(file_stat->st_mtime, symb_stat->st_mtime); + TST_EXP_EQ_LI(file_stat->st_ctime, symb_stat->st_ctime); +} + +static void setup(void) +{ + char opt_bsize[32]; + char symb_path[PATH_MAX]; + char file_path[PATH_MAX]; + const char *const fs_opts[] = {opt_bsize, NULL}; + struct stat sb; + int pagesize; + int fd; + + tmpdir = tst_get_tmpdir(); + + if (strlen(tmpdir) >= (PATH_MAX - strlen(FILENAME))) { + tst_brk(TCONF, "Temporary folder name is too long. " + "Can't create file"); + } + + if (strlen(tmpdir) >= (PATH_MAX - strlen(SYMBNAME))) { + tst_brk(TCONF, "Temporary folder name is too long. " + "Can't create symbolic link"); + } + + /* change st_blksize / st_dev */ + SAFE_STAT(".", &sb); + pagesize = sb.st_blksize == 4096 ? 1024 : 4096; + + snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize); + SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL); + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0); + + SAFE_TOUCH(FILENAME, 0777, NULL); + + /* change st_nlink */ + SAFE_LINK(FILENAME, "linked_file"); + + /* change st_uid and st_gid */ + SAFE_CHOWN(FILENAME, 1000, 1000); + + /* change st_size */ + fd = SAFE_OPEN(FILENAME, O_WRONLY, 0777); + tst_fill_fd(fd, 'a', TST_KB, 500); + SAFE_CLOSE(fd); + + /* change st_atime / st_mtime / st_ctime */ + sleep(1); + + memset(file_path, 0, PATH_MAX); + snprintf(file_path, PATH_MAX, "%s/%s", tmpdir, FILENAME); + + memset(symb_path, 0, PATH_MAX); + snprintf(symb_path, PATH_MAX, "%s/%s", tmpdir, SYMBNAME); + + SAFE_SYMLINK(file_path, symb_path); + + SAFE_STAT(file_path, file_stat); + SAFE_STAT(symb_path, symb_stat); +} + +static void cleanup(void) +{ + free(tmpdir); + + SAFE_UNLINK(SYMBNAME); + + if (tst_is_mounted(MNTPOINT)) + SAFE_UMOUNT(MNTPOINT); +} + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_tmpdir = 1, + .needs_device = 1, + .mntpoint = MNTPOINT, + .dev_fs_type = "ext2", + .bufs = (struct tst_buffers []) { + {&file_stat, .size = sizeof(struct stat)}, + {&symb_stat, .size = sizeof(struct stat)}, + {} + } +}; From patchwork Tue Jul 2 14:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1955395 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.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iDDBGjAo; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xsK0A0yO; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iDDBGjAo; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xsK0A0yO; 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 4WD4dY3xtSz1xpc for ; Wed, 3 Jul 2024 00:13:37 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5A1633D3EDB for ; Tue, 2 Jul 2024 16:13:35 +0200 (CEST) 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 BC7093D0F6E for ; Tue, 2 Jul 2024 16:13:16 +0200 (CEST) Authentication-Results: in-4.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-4.smtp.seeweb.it (Postfix) with ESMTPS id C7C391000B25 for ; Tue, 2 Jul 2024 16:13:15 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 4ED761FBA9; Tue, 2 Jul 2024 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWn4lYeNETVXNkW8z37Fw+Uaqo1ndnBSbd86bJquFxg=; b=iDDBGjAoeBIHv+NMTL7Nkg35tlg6x9y+I1ICiKc7pmlA6rfJhchjH0gMPlM8pAkxpHa4jL QrHG0FpAePgjNkI9mNVdeKLG/vTk6E/R5ZtOpaGV3OLWxmkGN0W2AwFHR1hRQeX4MxuT5x WXPLnTBqdwpQsRa6a696ZgG3bibHURA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWn4lYeNETVXNkW8z37Fw+Uaqo1ndnBSbd86bJquFxg=; b=xsK0A0yOv09sNTG8WIT4xDYGAvswnrZEMgDsuJL7UaG42reyzPgcObu7J+iZygK2aZfPHC Grk6XIR5MtDFqUAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=iDDBGjAo; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=xsK0A0yO DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWn4lYeNETVXNkW8z37Fw+Uaqo1ndnBSbd86bJquFxg=; b=iDDBGjAoeBIHv+NMTL7Nkg35tlg6x9y+I1ICiKc7pmlA6rfJhchjH0gMPlM8pAkxpHa4jL QrHG0FpAePgjNkI9mNVdeKLG/vTk6E/R5ZtOpaGV3OLWxmkGN0W2AwFHR1hRQeX4MxuT5x WXPLnTBqdwpQsRa6a696ZgG3bibHURA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pWn4lYeNETVXNkW8z37Fw+Uaqo1ndnBSbd86bJquFxg=; b=xsK0A0yOv09sNTG8WIT4xDYGAvswnrZEMgDsuJL7UaG42reyzPgcObu7J+iZygK2aZfPHC Grk6XIR5MtDFqUAA== 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 0623D13AAD; Tue, 2 Jul 2024 14:13:14 +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 kDscO/oKhGbpDgAAD6G6ig (envelope-from ); Tue, 02 Jul 2024 14:13:14 +0000 From: Andrea Cervesato Date: Tue, 02 Jul 2024 16:12:48 +0200 MIME-Version: 1.0 Message-Id: <20240702-stat04-v1-2-e27d9953210d@suse.com> References: <20240702-stat04-v1-0-e27d9953210d@suse.com> In-Reply-To: <20240702-stat04-v1-0-e27d9953210d@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2061; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=ItyrmYYpGLKmEy5DEusWRssMc9Zyn59MJMhuxag0AQI=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmhArvnGOlfUvvTWxUCiRImD8GQC3LeqDJM7Moq H/rP4aCZtiJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZoQK7wAKCRDLzBqyILPm Rn6qC/9F+MDwq+GSVJ43mslEuK76aBgEf0oPajUAFrW3bdJN4Z/1aLjEfZF5baT6ZpnxaZhOPMI jcBK+Tqjk4C8cVzX2dVVQ8wVuprQQRbEy+u40krvEjsjXptewY9wdBxmaTjkYXxB4xe1j27E1OF /urVdFd5Y3owG4zQAmvWazALsCm81VtQWM1Y7g4wLPDK3Sz+Jd+3B1uoPzLx4KZ+sh1USlY+Onl PE4z3p4WbT//yaGGMzPZSRF9MNwucGOpoHEI1utXfcpZaoFG/BDx6dqjZapENstj99d/+/v2Gkr 52+EYgHGcSbKYPrmkKhwoKNd+DhT6sKrRJ3EO3ImvJru30zDxwNu3PoxUQBlVwFTbhFERj8GSR6 dO4+0iG9s9r8WQvwPaUYsP5Q5JOMV0x2ZgrTRSY769aZMDTDu2619DCzRrMIAgBQ2FY9nUSkLaD rF+Yw/1sMo1MVAxqMfMQnIDAg5i8tMtsX6+wp3okXwc8zxqdQj/FeCeCfct7mZzv3z0g4= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Rspamd-Queue-Id: 4ED761FBA9 X-Spam-Score: -4.51 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:email]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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 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 2/5] Fix TST_EXP_EXTR() stringification 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" From: Andrea Cervesato Follow the TST_* macros standards when it comes to stringification of the expressions. Signed-off-by: Andrea Cervesato Reviewed-by: Li Wang Signed-off-by: Cyril Hrubis --- include/tst_test_macros.h | 5 +++-- testcases/kernel/syscalls/fork/fork04.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h index 22b39fb14..7a443c803 100644 --- a/include/tst_test_macros.h +++ b/include/tst_test_macros.h @@ -340,8 +340,9 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt); &tst_exp_err__, 1, ##__VA_ARGS__); \ } while (0) -#define TST_EXP_EXPR(EXPR, FMT, ...) \ - tst_res_(__FILE__, __LINE__, (EXPR) ? TPASS : TFAIL, "Expect: " FMT, ##__VA_ARGS__); +#define TST_EXP_EXPR(EXPR, ...) \ + tst_res_(__FILE__, __LINE__, (EXPR) ? TPASS : TFAIL, "Expect: " \ + TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, #EXPR), __VA_ARGS__)); #define TST_EXP_EQ_(VAL_A, SVAL_A, VAL_B, SVAL_B, TYPE, PFS) do {\ TYPE tst_tmp_a__ = VAL_A; \ diff --git a/testcases/kernel/syscalls/fork/fork04.c b/testcases/kernel/syscalls/fork/fork04.c index b0c6bebe0..413cd5eb4 100644 --- a/testcases/kernel/syscalls/fork/fork04.c +++ b/testcases/kernel/syscalls/fork/fork04.c @@ -29,7 +29,7 @@ static void run_child(void) TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0, "%s environ variable has been inherited by the child", - ENV_KEY) + ENV_KEY); tst_res(TINFO, "Unset %s environ variable inside child", ENV_KEY); @@ -72,7 +72,7 @@ static void run(void) } else { TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0, "%s environ variable is still present inside parent", - ENV_KEY) + ENV_KEY); } TST_CHECKPOINT_WAKE_AND_WAIT(0); @@ -85,7 +85,7 @@ static void run(void) else { TST_EXP_EXPR(strcmp(ENV_VAL0, val) == 0, "%s environ variable didn't change inside parent", - ENV_KEY) + ENV_KEY); } } From patchwork Tue Jul 2 14:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1955400 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.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=2CkduLsC; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=kwzFKkCg; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=2CkduLsC; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=kwzFKkCg; 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 4WD4fB2JtJz1xpc for ; Wed, 3 Jul 2024 00:14:10 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1B9C83D3EDB for ; Tue, 2 Jul 2024 16:14:08 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::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 picard.linux.it (Postfix) with ESMTPS id 2ED1C3D3E8E for ; Tue, 2 Jul 2024 16:13:16 +0200 (CEST) Authentication-Results: in-2.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-2.smtp.seeweb.it (Postfix) with ESMTPS id 4D9AC603104 for ; Tue, 2 Jul 2024 16:13:16 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 CEBE11FBAB; Tue, 2 Jul 2024 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxHeuRnXxYXdX9elvItdIKMayPnVv9z3LPX0rPJ4ATM=; b=2CkduLsC6Wrv4mWFRQfIFpBySHZM2idYpWtLdQAC128Z/iX9mzjHoV8/PEJmfXavTHYDzx +3by2tHCF7mBsh7AsSn9KPywsKegbb2ABK8GgncW1INkbeZkYKHIpD85hiZyKIZkcSVl88 ygauhioSSQ3DDN1WdSklVD/vOb3vy6A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxHeuRnXxYXdX9elvItdIKMayPnVv9z3LPX0rPJ4ATM=; b=kwzFKkCg0KoYm0VOh5n0I1d19t9wZD3TYF83kgGR7HK2R9tDHF+aEr/9lwpGjspu7TsE7D 2hu8Ib+MqoL+M3DQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=2CkduLsC; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=kwzFKkCg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxHeuRnXxYXdX9elvItdIKMayPnVv9z3LPX0rPJ4ATM=; b=2CkduLsC6Wrv4mWFRQfIFpBySHZM2idYpWtLdQAC128Z/iX9mzjHoV8/PEJmfXavTHYDzx +3by2tHCF7mBsh7AsSn9KPywsKegbb2ABK8GgncW1INkbeZkYKHIpD85hiZyKIZkcSVl88 ygauhioSSQ3DDN1WdSklVD/vOb3vy6A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxHeuRnXxYXdX9elvItdIKMayPnVv9z3LPX0rPJ4ATM=; b=kwzFKkCg0KoYm0VOh5n0I1d19t9wZD3TYF83kgGR7HK2R9tDHF+aEr/9lwpGjspu7TsE7D 2hu8Ib+MqoL+M3DQ== 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 7B13413A9A; Tue, 2 Jul 2024 14:13:15 +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 iAHwF/sKhGbpDgAAD6G6ig (envelope-from ); Tue, 02 Jul 2024 14:13:15 +0000 From: Andrea Cervesato Date: Tue, 02 Jul 2024 16:12:49 +0200 MIME-Version: 1.0 Message-Id: <20240702-stat04-v1-3-e27d9953210d@suse.com> References: <20240702-stat04-v1-0-e27d9953210d@suse.com> In-Reply-To: <20240702-stat04-v1-0-e27d9953210d@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4459; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=IYESwu8285GU9Up+TRl+58mpTq/3sTxgNiHpD46JPWU=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmhArveX8rUFu5x7Csz59HL5LPmT4o0Drd8Gs8T WnamPlL1EaJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZoQK7wAKCRDLzBqyILPm RgLmDACbcNbooRMqArcMFFADbU+hHyuEX3NQd5SGHpgJWM24Ag6Uo57/e061dpUw4eVfkVbznkc LarS4uBelqduKfyUR5Y08dxAdiBQI3WBKyrQbEvP+G431vHsFcvbDV7GM/tC3pWssPc5J+TR1wP rkf+hNSy0hLqN8n60/BLFgZn/J+wheFXjKOQQ6YpzKopkkWv4OcGi3U2TN9MuLBtfIncdu7tDzj n+zYfTrDVMdYq+XgR+49LIVzSR6vS0om5en/FbC0brMMVY5H9T7K9sSSB9tnuoubLMcZrISMnBh roy67ZS9LTj5vL2eKrbc0MO8mjbQMaTwaYllaub/4o3jhVn4DyzQIs3d3tVaH/T/d71MLu0yszM bahNyrq9KXmt3GPNyZ+fAubbgwrTYcAGOQ4JRz5YqyjIVqiolz6oyFBZA0osJt/Q/eaKIz4MOeq Lz/yFQiVk0b5rOOR47QWb2OdtU9Z95mGp0L2IAjhIlFjAs7i1+vuzcGubRWOYXL0WTNZ0= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: CEBE11FBAB X-Spam-Score: -4.51 X-Spam-Level: X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 3/5] Add lstat03 test 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" From: Andrea Cervesato This test has been extracted from symlink01 test and it checks that lstat() provides the right information, according with device, access time, block size, ownership, etc. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 4 +- testcases/kernel/syscalls/lstat/.gitignore | 2 + testcases/kernel/syscalls/lstat/lstat03.c | 102 +++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 2 deletions(-) diff --git a/runtest/syscalls b/runtest/syscalls index 3e7a5ca1b..d78b6822b 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -725,12 +725,12 @@ lseek02 lseek02 lseek07 lseek07 lseek11 lseek11 -lstat01A symlink01 -T lstat01 -lstat01A_64 symlink01 -T lstat01_64 lstat01 lstat01 lstat01_64 lstat01_64 lstat02 lstat02 lstat02_64 lstat02_64 +lstat03 lstat03 +lstat03_64 lstat03_64 mallinfo02 mallinfo02 diff --git a/testcases/kernel/syscalls/lstat/.gitignore b/testcases/kernel/syscalls/lstat/.gitignore index a497a445f..72cba871f 100644 --- a/testcases/kernel/syscalls/lstat/.gitignore +++ b/testcases/kernel/syscalls/lstat/.gitignore @@ -2,3 +2,5 @@ /lstat01_64 /lstat02 /lstat02_64 +/lstat03 +/lstat03_64 diff --git a/testcases/kernel/syscalls/lstat/lstat03.c b/testcases/kernel/syscalls/lstat/lstat03.c new file mode 100644 index 000000000..b52ba0c35 --- /dev/null +++ b/testcases/kernel/syscalls/lstat/lstat03.c @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: David Fenner, Jon Hendrickson + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com + */ + +/*\ + * [Description] + * + * This test verifies that lstat() provides correct information according + * with device, access time, block size, ownership, etc. + * The implementation provides a set of tests which are specific for each one + * of the `struct stat` used to read file and symlink information. + */ + +#include "tst_test.h" + +#define FILENAME "file.txt" +#define MNTPOINT "mntpoint" +#define SYMBNAME MNTPOINT"/file_symlink" + +static struct stat *file_stat; +static struct stat *symb_stat; + +static void run(void) +{ + TST_EXP_EXPR(file_stat->st_dev != symb_stat->st_dev); + TST_EXP_EXPR(file_stat->st_mode != symb_stat->st_mode); + TST_EXP_EXPR(file_stat->st_nlink != symb_stat->st_nlink); + TST_EXP_EXPR(file_stat->st_ino != symb_stat->st_ino); + TST_EXP_EXPR(file_stat->st_uid != symb_stat->st_uid); + TST_EXP_EXPR(file_stat->st_gid != symb_stat->st_gid); + TST_EXP_EXPR(file_stat->st_size != symb_stat->st_size); + TST_EXP_EXPR(file_stat->st_blocks != symb_stat->st_blocks); + TST_EXP_EXPR(file_stat->st_blksize != symb_stat->st_blksize); + TST_EXP_EXPR(file_stat->st_atime != symb_stat->st_atime); + TST_EXP_EXPR(file_stat->st_mtime != symb_stat->st_mtime); + TST_EXP_EXPR(file_stat->st_ctime != symb_stat->st_ctime); +} + +static void setup(void) +{ + char opt_bsize[32]; + const char *const fs_opts[] = {opt_bsize, NULL}; + struct stat sb; + int pagesize; + int fd; + + /* change st_blksize / st_dev */ + SAFE_STAT(".", &sb); + pagesize = sb.st_blksize == 4096 ? 1024 : 4096; + + snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", pagesize); + SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL); + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0); + + SAFE_TOUCH(FILENAME, 0777, NULL); + + /* change st_nlink */ + SAFE_LINK(FILENAME, "linked_file"); + + /* change st_uid and st_gid */ + SAFE_CHOWN(FILENAME, 1000, 1000); + + /* change st_size */ + fd = SAFE_OPEN(FILENAME, O_WRONLY, 0777); + tst_fill_fd(fd, 'a', TST_KB, 500); + SAFE_CLOSE(fd); + + /* change st_atime / st_mtime / st_ctime */ + sleep(1); + + SAFE_SYMLINK(FILENAME, SYMBNAME); + + SAFE_LSTAT(FILENAME, file_stat); + SAFE_LSTAT(SYMBNAME, symb_stat); +} + +static void cleanup(void) +{ + SAFE_UNLINK(SYMBNAME); + + if (tst_is_mounted(MNTPOINT)) + SAFE_UMOUNT(MNTPOINT); +} + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_tmpdir = 1, + .needs_device = 1, + .mntpoint = MNTPOINT, + .dev_fs_type = "ext2", + .bufs = (struct tst_buffers []) { + {&file_stat, .size = sizeof(struct stat)}, + {&symb_stat, .size = sizeof(struct stat)}, + {} + } +}; From patchwork Tue Jul 2 14:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1955402 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.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=mnFt4PkS; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JytmDN34; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=mnFt4PkS; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JytmDN34; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD4fd2Sjhz1xpc for ; Wed, 3 Jul 2024 00:14:33 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0B3273D3EEA for ; Tue, 2 Jul 2024 16:14:31 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (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 54F113D3ED1 for ; Tue, 2 Jul 2024 16:13:18 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:2; 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 [IPv6:2a07:de40:b251:101:10:150:64:2]) (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-6.smtp.seeweb.it (Postfix) with ESMTPS id 7C6C214052C2 for ; Tue, 2 Jul 2024 16:13:17 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 5453C1FBA9; Tue, 2 Jul 2024 14:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qf0UZ/oKdGle3PH/WZFyojPk3pSw9fWSPzOkesx1mA0=; b=mnFt4PkSBZFl4p/8PKAT0Oh+mXivnUx5h9o/MQhS8vlvKvj6FyUQQFWen0AeGbXUVfciDf EC/xHj3RbKlLUskuD+o2AV5plQvykPfCIUcDnOokfepM0K0mIXM/Ckyo5OlNK9LsaG5imi cal6bjB0L+QcvqQYpbekdS0JjdAyh4E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qf0UZ/oKdGle3PH/WZFyojPk3pSw9fWSPzOkesx1mA0=; b=JytmDN348r8bkDe05jbxumPjc3hIKURT5uZ2sdud/++fFbnzLEzO/E1QfUaEwC4CZbamO4 sUQ/UehFVa4V7nDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mnFt4PkS; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=JytmDN34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qf0UZ/oKdGle3PH/WZFyojPk3pSw9fWSPzOkesx1mA0=; b=mnFt4PkSBZFl4p/8PKAT0Oh+mXivnUx5h9o/MQhS8vlvKvj6FyUQQFWen0AeGbXUVfciDf EC/xHj3RbKlLUskuD+o2AV5plQvykPfCIUcDnOokfepM0K0mIXM/Ckyo5OlNK9LsaG5imi cal6bjB0L+QcvqQYpbekdS0JjdAyh4E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qf0UZ/oKdGle3PH/WZFyojPk3pSw9fWSPzOkesx1mA0=; b=JytmDN348r8bkDe05jbxumPjc3hIKURT5uZ2sdud/++fFbnzLEzO/E1QfUaEwC4CZbamO4 sUQ/UehFVa4V7nDg== 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 0442713A9A; Tue, 2 Jul 2024 14:13:15 +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 2A5+NvsKhGbpDgAAD6G6ig (envelope-from ); Tue, 02 Jul 2024 14:13:15 +0000 From: Andrea Cervesato Date: Tue, 02 Jul 2024 16:12:50 +0200 MIME-Version: 1.0 Message-Id: <20240702-stat04-v1-4-e27d9953210d@suse.com> References: <20240702-stat04-v1-0-e27d9953210d@suse.com> In-Reply-To: <20240702-stat04-v1-0-e27d9953210d@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2320; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=ZIRVdVUqC/U8rWHVdvAgGyn1OSHu8N2jIDVYXtbljI0=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmhArvdZgVXJ0gL4nE/V9zz6W5KAaRiubU+7qhh cmdZm5bRk6JAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZoQK7wAKCRDLzBqyILPm RluoDACLoyxLG4h0/PsMlTT0jPrOwcN2Rpc7JlNw508U4p33MFPReYGvLq6s6DJRyikNhVzj2Xg cPJt34a2IDOve6Xh70b/GLRVgVegClCBt1gKwGHPZsbMSDSelbGmVkJUKxMsSIvrKifWcKE1nuI WTFhZaJMxRdMwfZLEvlIgY2Tf7+AucN2uKy1CiMgdMhZDPt7KuFhgNVnM54dn4WjPOLO5VbSpjI pvZbwvxPZcdi/XJhjubrD87w4sXVj7ezseA+XKfp1w/AaseV0jmIfVDk24KoWGge0zNOJ6eElMz OsreFhyLfOHSdCF7bYCbAXkvtSgPdk4dy1DcJomyFBgUW270qaFJ6g2l0Xaam2v0zt8zqAP+tV3 YXFzVy5NDBxGd2LDoHI0Ej2KUXUVr/piMiTW2nYMIJan4+khgBclbowU42niMagXrK/8umbd/5g qjaIbNS4zFoD8QMwJTp5CE56rPQSLmXDyaoc64S4DmGpTpyK+lp91Gdx/5L1pEizZiBIk= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Rspamd-Queue-Id: 5453C1FBA9 X-Spam-Score: -4.51 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 4/5] Add chmod08 test 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" From: Andrea Cervesato This test has been extracted from symlink01 and it verifies that chmod() is working correctly on symlink() generated files. Signed-off-by: Andrea Cervesato Reviewed-by: Li Wang --- runtest/syscalls | 1 + testcases/kernel/syscalls/chmod/.gitignore | 1 + testcases/kernel/syscalls/chmod/chmod08.c | 45 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index d78b6822b..928e75f9b 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -72,6 +72,7 @@ chmod03 chmod03 chmod05 chmod05 chmod06 chmod06 chmod07 chmod07 +chmod08 chmod08 chown01 chown01 chown01_16 chown01_16 diff --git a/testcases/kernel/syscalls/chmod/.gitignore b/testcases/kernel/syscalls/chmod/.gitignore index 27ddfce16..f295f4dcb 100644 --- a/testcases/kernel/syscalls/chmod/.gitignore +++ b/testcases/kernel/syscalls/chmod/.gitignore @@ -3,3 +3,4 @@ /chmod05 /chmod06 /chmod07 +/chmod08 diff --git a/testcases/kernel/syscalls/chmod/chmod08.c b/testcases/kernel/syscalls/chmod/chmod08.c new file mode 100644 index 000000000..7ef396348 --- /dev/null +++ b/testcases/kernel/syscalls/chmod/chmod08.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: David Fenner + * Copilot: Jon Hendrickson + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com + */ + +/*\ + * [Description] + * + * This test verifies that chmod() is working correctly on symlink() + * generated files. + */ + +#include "tst_test.h" + +#define PERMS 01777 +#define TESTFILE "myobject" + +static void run(void) +{ + char *symname = "my_symlink0"; + struct stat oldsym_stat; + struct stat newsym_stat; + + SAFE_TOUCH(TESTFILE, 0644, NULL); + SAFE_SYMLINK(TESTFILE, symname); + SAFE_STAT(symname, &oldsym_stat); + + TST_EXP_PASS(chmod(symname, PERMS)); + SAFE_STAT(symname, &newsym_stat); + + TST_EXP_EQ_LI(newsym_stat.st_mode & PERMS, PERMS); + TST_EXP_EXPR(oldsym_stat.st_mode != newsym_stat.st_mode, + "file mode has changed"); + + SAFE_UNLINK(symname); + SAFE_UNLINK(TESTFILE); +} + +static struct tst_test test = { + .test_all = run, + .needs_tmpdir = 1, +}; From patchwork Tue Jul 2 14:12:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1955408 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.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xhFEJ2PB; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=x5eV/pqt; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xhFEJ2PB; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=x5eV/pqt; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD4fv6bl6z1xpc for ; Wed, 3 Jul 2024 00:14:47 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B9D6B3D3EF2 for ; Tue, 2 Jul 2024 16:14:45 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (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 DA3413D3ED5 for ; Tue, 2 Jul 2024 16:13:19 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) 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-6.smtp.seeweb.it (Postfix) with ESMTPS id 2B37D14052CB for ; Tue, 2 Jul 2024 16:13:18 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id D17F121B2E; Tue, 2 Jul 2024 14:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vMDzcoYDaZeU5RZ4E0ow0csLAaSB7Ye0+E90p+9uqE=; b=xhFEJ2PB55SwnMRtNnfA5KWHDlBLkZuJ7UHaABeQ1lnO3TCyru7VYMD5pOpFCxUkT78w7G Iq0C4RlNIDtBJi+TrUGSasvAWoglK/wTWFimRrdSctMBRjwfhFGWrV2/7nWTl0Q1GFGGNP /2hy+jEylxFoMSKG7ymsS1gIUS17/l0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vMDzcoYDaZeU5RZ4E0ow0csLAaSB7Ye0+E90p+9uqE=; b=x5eV/pqtg1DvurT4HWxuxvxp4kqMDzn7aJlMJVx8UODUpRbuZiYwgVvty172HVcFRYehxy qqm+edNEHLN8QmAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xhFEJ2PB; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="x5eV/pqt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vMDzcoYDaZeU5RZ4E0ow0csLAaSB7Ye0+E90p+9uqE=; b=xhFEJ2PB55SwnMRtNnfA5KWHDlBLkZuJ7UHaABeQ1lnO3TCyru7VYMD5pOpFCxUkT78w7G Iq0C4RlNIDtBJi+TrUGSasvAWoglK/wTWFimRrdSctMBRjwfhFGWrV2/7nWTl0Q1GFGGNP /2hy+jEylxFoMSKG7ymsS1gIUS17/l0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719929596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vMDzcoYDaZeU5RZ4E0ow0csLAaSB7Ye0+E90p+9uqE=; b=x5eV/pqtg1DvurT4HWxuxvxp4kqMDzn7aJlMJVx8UODUpRbuZiYwgVvty172HVcFRYehxy qqm+edNEHLN8QmAw== 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 80F4313A9A; Tue, 2 Jul 2024 14:13:16 +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 OKNqGfwKhGbpDgAAD6G6ig (envelope-from ); Tue, 02 Jul 2024 14:13:16 +0000 From: Andrea Cervesato Date: Tue, 02 Jul 2024 16:12:51 +0200 MIME-Version: 1.0 Message-Id: <20240702-stat04-v1-5-e27d9953210d@suse.com> References: <20240702-stat04-v1-0-e27d9953210d@suse.com> In-Reply-To: <20240702-stat04-v1-0-e27d9953210d@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3489; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=Arb6LDcOBG1QCRVzf8bKRlgS4kRTDfYhS6Knm48QJ20=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmhArvBFsuFqjfasHuEWLi6vbX0nNVJJGDgoHvg 13tbX0Pg1GJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZoQK7wAKCRDLzBqyILPm RkyXC/9r/zyHqqYzkB87WwEJ2CHG8AsT4fCbgZ+XoBODKuQE/ZFDxrYBZ8QC5FZ0elppjo/gANS TrsOwF476g37hPSH2sGeeICVFvHyCnKhBmBF+PFSqL6oLXphepz1NYY1zG5gu9RaB+QeEvlUFSJ kS5qM3UTLm05HycEJe2niC1DsHqPH1ejZD1ZrKXQ1a/3JER5vwRHkFTy7vRHByI8OYHHpRlu8al KHWj9enMiPgoGKLq360Pc0qZu6rXftglT58vwhCfRxalxTGHk0PqgpFxZTMEqHMd0HEtDrCAKXs vOBzQYTZaXUWPv+mQYc+urAv0okcetKmv+TZI8XaWLoOLw6e4ezWbLbq8GkecjTWbJvBkbFN+cD 4A3x/E2mMSoX7mVOQ5f49VU+/au7SBYscfE1CTg89ZfNM0gCk2g88dn18X0kZpaBWdbS0aucsiV xs2inBFyOLFm4GstEGAcOQb0lsHudYb1v7+1YMYKq6klR0FvjbIQVm1NUKbjyUpTLcU/U= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: D17F121B2E X-Spam-Score: -4.51 X-Spam-Level: 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 shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 5/5] Add open15 test 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" From: Andrea Cervesato This test has been extracted from symlink01 and it verifies that open() is working correctly on symlink() generated files. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 2 +- testcases/kernel/syscalls/open/.gitignore | 1 + testcases/kernel/syscalls/open/open15.c | 86 +++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/runtest/syscalls b/runtest/syscalls index 928e75f9b..47efac158 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -923,7 +923,6 @@ nice04 nice04 nice05 nice05 open01 open01 -open01A symlink01 -T open01 open02 open02 open03 open03 open04 open04 @@ -936,6 +935,7 @@ open11 open11 open12 open12 open13 open13 open14 open14 +open15 open15 openat01 openat01 openat02 openat02 diff --git a/testcases/kernel/syscalls/open/.gitignore b/testcases/kernel/syscalls/open/.gitignore index 001d874d6..af5997572 100644 --- a/testcases/kernel/syscalls/open/.gitignore +++ b/testcases/kernel/syscalls/open/.gitignore @@ -12,3 +12,4 @@ /open12_child /open13 /open14 +/open15 diff --git a/testcases/kernel/syscalls/open/open15.c b/testcases/kernel/syscalls/open/open15.c new file mode 100644 index 000000000..cbe2d62a4 --- /dev/null +++ b/testcases/kernel/syscalls/open/open15.c @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: David Fenner + * Copilot: Jon Hendrickson + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com + */ + +/*\ + * [Description] + * + * This test verifies that open() is working correctly on symlink() + * generated files. + */ + +#include "tst_test.h" + +#define FILENAME "myfile.txt" +#define BIG_STRING "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" + +static void test_open_symlink(void) +{ + int fd; + int str_size; + char buff[128]; + char *symname = "my_symlink0"; + + str_size = strlen(BIG_STRING); + + SAFE_SYMLINK(FILENAME, symname); + + fd = SAFE_OPEN(symname, O_CREAT | O_RDWR, 0777); + SAFE_WRITE(SAFE_WRITE_ALL, fd, BIG_STRING, str_size); + SAFE_LSEEK(fd, 0, 0); + SAFE_READ(1, fd, buff, str_size); + SAFE_CLOSE(fd); + + TST_EXP_EXPR(!strncmp(buff, BIG_STRING, str_size), + "symlink generated file can be opened to write data"); + + SAFE_UNLINK(symname); + SAFE_UNLINK(FILENAME); +} + +static void test_open_compare(void) +{ + int fd_file, fd_symlink; + int str_size; + char buff_file[128]; + char buff_symlink[128]; + char *symname = "my_symlink1"; + + str_size = strlen(BIG_STRING); + + fd_file = SAFE_OPEN(FILENAME, O_CREAT | O_RDWR, 0777); + SAFE_WRITE(SAFE_WRITE_ALL, fd_file, BIG_STRING, str_size); + + SAFE_SYMLINK(FILENAME, symname); + + SAFE_LSEEK(fd_file, 0, 0); + SAFE_READ(1, fd_file, buff_file, str_size); + + fd_symlink = SAFE_OPEN(symname, O_RDWR, 0777); + SAFE_LSEEK(fd_symlink, 0, 0); + SAFE_READ(1, fd_symlink, buff_symlink, str_size); + + TST_EXP_EXPR(!strncmp(buff_file, buff_symlink, str_size), + "file data is the equivalent to symlink generated file data"); + + SAFE_CLOSE(fd_file); + SAFE_CLOSE(fd_symlink); + + SAFE_UNLINK(symname); + SAFE_UNLINK(FILENAME); +} + +static void run(void) +{ + test_open_symlink(); + test_open_compare(); +} + +static struct tst_test test = { + .test_all = run, + .needs_tmpdir = 1, +};