From patchwork Sat Aug 27 00:28:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=pFtCjH88; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sn4D/Kks; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyHc1XRPz1yh1 for ; Sat, 27 Aug 2022 10:29:00 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EC3373CA4D8 for ; Sat, 27 Aug 2022 02:28:57 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 82A813C136F for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (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 EC3691000654 for ; Sat, 27 Aug 2022 02:28:22 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3641F1F9AC; Sat, 27 Aug 2022 00:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560101; 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=PkHOMCgteBaqkUHJLwtS9lLMQwIPe7zjThZ34GlLVjg=; b=pFtCjH88UuGgZVI98KBXwDTablD3NbxKYy0efxWzPjBOOrHy2q1BfJ9cBKoZlINMya2EuY OVYQh+p7pGccJW8A5yB/QGVcapS9YkU+Z8j9uhwbznrQEbEKFy6mlCPG4TmuDhZm+LgmwV e0D1di1OEoFaTtxMh71afwj9THcLBRg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560101; 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=PkHOMCgteBaqkUHJLwtS9lLMQwIPe7zjThZ34GlLVjg=; b=sn4D/Kks/d2bW/pVeOvdSpcDwye2zZSfsCAhXEa6My+hAOvkGt1WH3UqmOlJJoR6ZZE+RL jd/qwXfqoYJXBPBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4E363133A6; Sat, 27 Aug 2022 00:28:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MHjSESRlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:20 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:10 +0200 Message-Id: <20220827002815.19116-2-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 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_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis Reviewed-by: Li Wang --- include/tst_fs.h | 5 ++++- lib/tst_fs_type.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/tst_fs.h b/include/tst_fs.h index 8159b99eb..a6f934b0f 100644 --- a/include/tst_fs.h +++ b/include/tst_fs.h @@ -5,7 +5,7 @@ #ifndef TST_FS_H__ #define TST_FS_H__ -/* man 2 statfs or kernel-source/include/linux/magic.h */ +/* man 2 statfs or kernel-source/include/uapi/linux/magic.h */ #define TST_BTRFS_MAGIC 0x9123683E #define TST_NFS_MAGIC 0x6969 #define TST_RAMFS_MAGIC 0x858458f6 @@ -32,6 +32,9 @@ #define TST_FUSE_MAGIC 0x65735546 #define TST_VFAT_MAGIC 0x4d44 /* AKA MSDOS */ #define TST_EXFAT_MAGIC 0x2011BAB0UL +#define TST_SQUASHFS_MAGIC 0x73717368 +/* kernel-source/fs/ntfs/ntfs.h */ +#define TST_NTFS_MAGIC 0x5346544e enum { TST_BYTES = 1, diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c index 9de80224b..de4facef5 100644 --- a/lib/tst_fs_type.c +++ b/lib/tst_fs_type.c @@ -88,6 +88,12 @@ const char *tst_fs_type_name(long f_type) return "fuse"; case TST_EXFAT_MAGIC: return "exfat"; + case TST_NTFS_MAGIC: + return "ntfs"; + case TST_SQUASHFS_MAGIC: + return "squashfs"; + case TST_VFAT_MAGIC: + return "vfat"; default: return "unknown"; } From patchwork Sat Aug 27 00:28:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=L7rhwN8W; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2Qm5eLRO; dkim-atps=neutral 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyHQ3k9bz1yh1 for ; Sat, 27 Aug 2022 10:28:50 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2F0FF3CA487 for ; Sat, 27 Aug 2022 02:28:47 +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 [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 0EA163C136F for ; Sat, 27 Aug 2022 02:28:22 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 34D30680E4D for ; Sat, 27 Aug 2022 02:28:21 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 996821F9B1; Sat, 27 Aug 2022 00:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560101; 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=t33ORWoHO9j2N1bQRIzbRy9gMspzXFAgr1xlTJIkfzY=; b=L7rhwN8Wfo08Bvuws+haw0L+rBmeoaEm7HkoS//X3Kl1R47pFI7vL0bbSJXsjCI/Hy2jCK uLObDQtnWSgSmu6Kk1Y74Ls6fd0MnER/gKyvMyAFTaXxhsrO+Mms30LyA8hFf7cZY2laa3 Ev3em6wP70/6RQGAxN8sZQWoU3aTiOQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560101; 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=t33ORWoHO9j2N1bQRIzbRy9gMspzXFAgr1xlTJIkfzY=; b=2Qm5eLROvZCSYkTeuXTFXHsB/+KSZ2q/Ha4JeHETO0dGs7/Ozgb778R93kYJm+9v70ruB6 WPiz6o1FYM76JqBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 42293133A6; Sat, 27 Aug 2022 00:28:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8Np7DiVlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:21 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:11 +0200 Message-Id: <20220827002815.19116-3-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.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 autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Previously we required 256 MB for loop device size regardless used filesystem due btrfs requirements. New defaults are based on used filesystem: * Btrfs: 110 MB * SquashFS: 1 MB * others: 16 MB This helps embedded systems with lower resources. NOTE: XFS has 300 MB requirement from xfsprogs 5.19, but it was workarounded by environment variables by previous commit. Tests required to change setup: * fanotify05: .dev_min_size = 65 * preadv203: .dev_min_size = 230 * readahead02: .dev_min_size = 135 * squashfs01: .dev_fs_type = "squashfs" to be able to keep .dev_min_size = 1 Signed-off-by: Petr Vorel --- include/old/old_device.h | 6 ++-- include/tst_fs.h | 16 +++++++++ lib/tst_device.c | 36 +++++++++++++++---- lib/tst_fs_type.c | 28 +++++++++++++++ lib/tst_test.c | 7 +++- testcases/kernel/fs/squashfs/squashfs01.c | 1 + .../kernel/syscalls/fanotify/fanotify05.c | 1 + testcases/kernel/syscalls/preadv2/preadv203.c | 1 + .../kernel/syscalls/readahead/readahead02.c | 1 + testcases/lib/tst_device.c | 2 +- 10 files changed, 88 insertions(+), 11 deletions(-) diff --git a/include/old/old_device.h b/include/old/old_device.h index a6e9fea86..f67cee2b9 100644 --- a/include/old/old_device.h +++ b/include/old/old_device.h @@ -43,13 +43,13 @@ const char *tst_dev_fs_type(void); * Returns path to the device or NULL if it cannot be created. * Call tst_release_device() when you're done. */ -const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size); +const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type); -const char *tst_acquire_device__(unsigned int size); +const char *tst_acquire_device__(unsigned int size, long f_type); static inline const char *tst_acquire_device(void (cleanup_fn)(void)) { - return tst_acquire_device_(cleanup_fn, 0); + return tst_acquire_device_(cleanup_fn, 0, TST_ALL_FILESYSTEMS); } /* diff --git a/include/tst_fs.h b/include/tst_fs.h index a6f934b0f..ea2c6b527 100644 --- a/include/tst_fs.h +++ b/include/tst_fs.h @@ -5,6 +5,8 @@ #ifndef TST_FS_H__ #define TST_FS_H__ +#define TST_ALL_FILESYSTEMS 0 + /* man 2 statfs or kernel-source/include/uapi/linux/magic.h */ #define TST_BTRFS_MAGIC 0x9123683E #define TST_NFS_MAGIC 0x6969 @@ -49,6 +51,15 @@ enum { #define OVL_WORK OVL_BASE_MNTPOINT"/work" #define OVL_MNT OVL_BASE_MNTPOINT"/ovl" +/* + * Returns minimum requested for filesystem size. + * This size is enforced for all but tmpfs. + * + * @fs_type filesystem to be searched for, 0 is for the biggest size of all + * supported filesystems (used for .all_filesystems). + */ +unsigned int tst_min_fs_size(long f_type); + /* * @path: path is the pathname of any file within the mounted file system * @mult: mult should be TST_KB, TST_MB or TST_GB @@ -87,6 +98,11 @@ long tst_fs_type_(void (*cleanup)(void), const char *path); */ const char *tst_fs_type_name(long f_type); +/* + * Returns magic given filesystem name. + */ +long tst_fs_name_type(const char *fs); + /* * Try to get maximum number of hard links to a regular file inside the @dir. * diff --git a/lib/tst_device.c b/lib/tst_device.c index c34cbe6d1..bb336abe4 100644 --- a/lib/tst_device.c +++ b/lib/tst_device.c @@ -36,6 +36,7 @@ #include "lapi/syscalls.h" #include "test.h" #include "safe_macros.h" +#include "tst_fs.h" #ifndef LOOP_CTL_GET_FREE # define LOOP_CTL_GET_FREE 0x4C82 @@ -44,12 +45,28 @@ #define LOOP_CONTROL_FILE "/dev/loop-control" #define DEV_FILE "test_dev.img" -#define DEV_SIZE_MB 256u +#define DEV_SIZE_MB_DEFAULT 16u +#define DEV_SIZE_MB_BTRFS 110u +#define DEV_SIZE_MB_SQUASHFS 1u static char dev_path[1024]; static int device_acquired; static unsigned long prev_dev_sec_write; +unsigned int tst_min_fs_size(long f_type) +{ + switch (f_type) { + case 0: + return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT); + case TST_BTRFS_MAGIC: + return DEV_SIZE_MB_BTRFS; + case TST_SQUASHFS_MAGIC: + return DEV_SIZE_MB_SQUASHFS; + default: + return DEV_SIZE_MB_DEFAULT; + } +} + static const char *dev_variants[] = { "/dev/loop%i", "/dev/loop/%i", @@ -279,7 +296,7 @@ int tst_dev_sync(int fd) const char *tst_acquire_loop_device(unsigned int size, const char *filename) { - unsigned int acq_dev_size = size ? size : DEV_SIZE_MB; + unsigned int acq_dev_size = size ?: tst_min_fs_size(0); if (tst_prealloc_file(filename, 1024 * 1024, acq_dev_size)) { tst_resm(TWARN | TERRNO, "Failed to create %s", filename); @@ -295,13 +312,20 @@ const char *tst_acquire_loop_device(unsigned int size, const char *filename) return dev_path; } -const char *tst_acquire_device__(unsigned int size) +const char *tst_acquire_device__(unsigned int size, long f_type) { const char *dev; unsigned int acq_dev_size; uint64_t ltp_dev_size; + unsigned int min_size = tst_min_fs_size(f_type); + + if (size && size < min_size) { + tst_brkm(TBROK, NULL, "Request device size %u smaller than min size: %u", + size, min_size); + return NULL; + } - acq_dev_size = size ? size : DEV_SIZE_MB; + acq_dev_size = size ?: min_size; dev = getenv("LTP_DEV"); @@ -325,7 +349,7 @@ const char *tst_acquire_device__(unsigned int size) return dev; } -const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size) +const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size, long f_type) { const char *device; @@ -340,7 +364,7 @@ const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size) return NULL; } - device = tst_acquire_device__(size); + device = tst_acquire_device__(size, f_type); if (!device) { tst_brkm(TBROK, cleanup_fn, "Failed to acquire device"); diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c index de4facef5..49db2fff7 100644 --- a/lib/tst_fs_type.c +++ b/lib/tst_fs_type.c @@ -43,6 +43,34 @@ long tst_fs_type_(void (*cleanup)(void), const char *path) return sbuf.f_type; } +long tst_fs_name_type(const char *fs) +{ + if (!strcmp(fs, "btrfs")) + return TST_BTRFS_MAGIC; + else if (!strcmp(fs, "exfat")) + return TST_EXFAT_MAGIC; + else if (!strcmp(fs, "ext2")) + return TST_EXT2_OLD_MAGIC; + else if (!strcmp(fs, "ext3") || !strcmp(fs, "ext4")) + return TST_EXT234_MAGIC; + else if (!strcmp(fs, "minix")) + return TST_MINIX3_MAGIC; + else if (!strcmp(fs, "msdos")) + return TST_VFAT_MAGIC; + else if (!strcmp(fs, "ntfs")) + return TST_NTFS_MAGIC; + else if (!strcmp(fs, "squashfs")) + return TST_SQUASHFS_MAGIC; + else if (!strcmp(fs, "tmpfs")) + return TST_TMPFS_MAGIC; + else if (!strcmp(fs, "vfat")) + return TST_VFAT_MAGIC; + else if (!strcmp(fs, "xfs")) + return TST_XFS_MAGIC; + + return -1; +} + const char *tst_fs_type_name(long f_type) { switch (f_type) { diff --git a/lib/tst_test.c b/lib/tst_test.c index 657348732..bfc40554f 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -1225,7 +1225,12 @@ static void do_setup(int argc, char *argv[]) } if (tst_test->needs_device && !mntpoint_mounted) { - tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size); + long f_type = tst_fs_name_type(tst_test->dev_fs_type ?: DEFAULT_FS_TYPE); + + if (tst_test->all_filesystems) + f_type = TST_ALL_FILESYSTEMS; + + tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size, f_type); if (!tdev.dev) tst_brk(TCONF, "Failed to acquire device"); diff --git a/testcases/kernel/fs/squashfs/squashfs01.c b/testcases/kernel/fs/squashfs/squashfs01.c index 502de419d..d7f91c129 100644 --- a/testcases/kernel/fs/squashfs/squashfs01.c +++ b/testcases/kernel/fs/squashfs/squashfs01.c @@ -104,6 +104,7 @@ static struct tst_test test = { .needs_root = 1, .needs_device = 1, .dev_min_size = 1, + .dev_fs_type = "squashfs", .needs_cmds = (const char *const []) { "mksquashfs", NULL diff --git a/testcases/kernel/syscalls/fanotify/fanotify05.c b/testcases/kernel/syscalls/fanotify/fanotify05.c index 04670cb1c..a4bc5ef54 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify05.c +++ b/testcases/kernel/syscalls/fanotify/fanotify05.c @@ -215,6 +215,7 @@ static struct tst_test test = { .needs_root = 1, .mount_device = 1, .mntpoint = MOUNT_PATH, + .dev_min_size = 65, }; #else TST_TEST_TCONF("system doesn't have required fanotify support"); diff --git a/testcases/kernel/syscalls/preadv2/preadv203.c b/testcases/kernel/syscalls/preadv2/preadv203.c index 60dc4a882..8c08c86ea 100644 --- a/testcases/kernel/syscalls/preadv2/preadv203.c +++ b/testcases/kernel/syscalls/preadv2/preadv203.c @@ -280,4 +280,5 @@ static struct tst_test test = { .all_filesystems = 1, .max_runtime = 60, .needs_root = 1, + .dev_min_size = 230, }; diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c index 4fa8cfaf8..07a5172fc 100644 --- a/testcases/kernel/syscalls/readahead/readahead02.c +++ b/testcases/kernel/syscalls/readahead/readahead02.c @@ -406,6 +406,7 @@ static struct tst_test test = { }, .test = test_readahead, .tcnt = ARRAY_SIZE(tcases), + .dev_min_size = 135, .tags = (const struct tst_tag[]) { {"linux-git", "b833a3660394"}, {"linux-git", "5b910bd615ba"}, diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index d6b74a5ff..b76abf52b 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -43,7 +43,7 @@ static int acquire_device(int argc, char *argv[]) if (argc >= 4) device = tst_acquire_loop_device(size, argv[3]); else - device = tst_acquire_device__(size); + device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS); if (!device) return 1; From patchwork Sat Aug 27 00:28:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=awF2zQgM; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3zoebVQY; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyH14b2cz1yh1 for ; Sat, 27 Aug 2022 10:28:28 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B49BE3CA4AD for ; Sat, 27 Aug 2022 02:28:24 +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 [217.194.8.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 D46B93C136F for ; Sat, 27 Aug 2022 02:28:22 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 654BE100066D for ; Sat, 27 Aug 2022 02:28:22 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1F6F21F9B7; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560102; 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=gVWCU2Rj7+mx6Ah0kxja7mwadnxvNTfoaVyDD3E0bBY=; b=awF2zQgM9Jp82id1og5mnVDLYutEsDz4EaO7xz/93dGy4go+3ziIMK7qMNMF+hG1Jw/vTX IXhVP/DtkMBfcEjnruy4l9V0lE2+g8dsUdnUVOWgGOZiDA38+im3+7S7WH7LtruojUzcj9 BBR4BFs5N5oKsqr2AIz3t/0ZgWU8Fe4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560102; 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=gVWCU2Rj7+mx6Ah0kxja7mwadnxvNTfoaVyDD3E0bBY=; b=3zoebVQYSh8SgLpmll8lC1reqUuhDoFPaEGM5ulyQWJlDW8XPfd0VZWiAGF87jZZQh9VSv 1MHHFpVh3x4Y5TBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A563E133A6; Sat, 27 Aug 2022 00:28:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OINLJiVlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:21 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:12 +0200 Message-Id: <20220827002815.19116-4-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 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 autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Previously 32 MB was used, use the default size used for most of the filesystems (16 MB). Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis Reviewed-by: Li Wang --- lib/tst_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tst_test.c b/lib/tst_test.c index bfc40554f..fce73c2f9 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -1030,7 +1030,7 @@ static const char *limit_tmpfs_mount_size(const char *mnt_data, return mnt_data; if (!tst_test->dev_min_size) - tmpfs_size = 32; + tmpfs_size = tst_min_fs_size(TST_TMPFS_MAGIC); else tmpfs_size = tdev.size; From patchwork Sat Aug 27 00:28:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=PfHLWG8a; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=9BgtU/w+; dkim-atps=neutral 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyJM6f35z1yh1 for ; Sat, 27 Aug 2022 10:29:39 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CDC8E3CA4FF for ; Sat, 27 Aug 2022 02:29:36 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 712EA3CA4DB for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (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-7.smtp.seeweb.it (Postfix) with ESMTPS id 2CBA4200042 for ; Sat, 27 Aug 2022 02:28:22 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7079533723; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560102; 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=Uykqtwmkv+fLywCXyI1nNcmh4AHu6L98HBfpxVTzaP0=; b=PfHLWG8aA8uHGObo7YOtYpnbBL0QeAEiEecXXQ1wqIJTvpFLR/XcAdXzYKvbfkhiqAPGXn 4r0DplKSguS07dci4K3zto1FtnnXwGjYBTWqbFmLoUXCxDuopPuVA2nhGplYuE90CQP/17 gSGGu2wVH2LBNKSIcKaovlmQ3VtyjVw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560102; 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=Uykqtwmkv+fLywCXyI1nNcmh4AHu6L98HBfpxVTzaP0=; b=9BgtU/w+GKNCIESiC8SsCKgvAN+rlMfOMmYj9Co4ATZlxHL8yyK35koTroxrhpRUcZroYD xw+M0CfkmFxNvqBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1E91113ADC; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oLE+BiZlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:22 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:13 +0200 Message-Id: <20220827002815.19116-5-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.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_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 4/6] tst_device: Use getopts 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" size and filesystems are passed by -s and -f flags. That will help to pass used filesystem. When it, add also -h. Signed-off-by: Petr Vorel Reviewed-by: Li Wang --- testcases/lib/tst_device.c | 71 +++++++++++++++++++------------ testcases/lib/tst_test.sh | 2 +- testcases/misc/lvm/cleanup_lvm.sh | 2 +- testcases/misc/lvm/prepare_lvm.sh | 8 ++-- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index b76abf52b..b672202e2 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -18,30 +18,18 @@ static struct tst_test test = { static void print_help(void) { - fprintf(stderr, "\nUsage: tst_device acquire [size [filename]]\n"); - fprintf(stderr, " or: tst_device release /path/to/device\n\n"); + fprintf(stderr, "\nUsage:\n"); + fprintf(stderr, "tst_device [-s size [-d /path/to/device]] acquire\n"); + fprintf(stderr, "tst_device -d /path/to/device release\n"); + fprintf(stderr, "tst_device -h\n\n"); } -static int acquire_device(int argc, char *argv[]) +static int acquire_device(const char *device_path, unsigned int size) { - unsigned int size = 0; const char *device; - if (argc > 4) - return 1; - - if (argc >= 3) { - size = atoi(argv[2]); - - if (!size) { - fprintf(stderr, "ERROR: Invalid device size '%s'", - argv[2]); - return 1; - } - } - - if (argc >= 4) - device = tst_acquire_loop_device(size, argv[3]); + if (device_path) + device = tst_acquire_loop_device(size, device_path); else device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS); @@ -58,10 +46,12 @@ static int acquire_device(int argc, char *argv[]) return 0; } -static int release_device(int argc, char *argv[]) +static int release_device(const char *device_path) { - if (argc != 3) + if (!device_path) { + fprintf(stderr, "ERROR: Missing /path/to/device\n"); return 1; + } /* * tst_acquire_[loop_]device() was called in a different process. @@ -69,11 +59,15 @@ static int release_device(int argc, char *argv[]) * and do nothing. Call tst_detach_device() directly to bypass * the check. */ - return tst_detach_device(argv[2]); + return tst_detach_device(device_path); } int main(int argc, char *argv[]) { + char *device_path = NULL; + unsigned int size = 0; + int ret; + /* * Force messages to be printed from the new library i.e. tst_test.c * @@ -85,17 +79,38 @@ int main(int argc, char *argv[]) */ tst_test = &test; - if (argc < 2) + while ((ret = getopt(argc, argv, "d:hs:"))) { + if (ret < 0) + break; + + switch (ret) { + case 'd': + device_path = optarg; + break; + case 'h': + print_help(); + return 0; + case 's': + size = atoi(optarg); + if (!size) { + fprintf(stderr, "ERROR: Invalid device size '%s'", optarg); + return 1; + } + break; + } + } + + if (argc - optind < 1) goto help; - if (!strcmp(argv[1], "acquire")) { - if (acquire_device(argc, argv)) + if (!strcmp(argv[optind], "acquire")) { + if (acquire_device(device_path, size)) goto help; - } else if (!strcmp(argv[1], "release")) { - if (release_device(argc, argv)) + } else if (!strcmp(argv[optind], "release")) { + if (release_device(device_path)) goto help; } else { - fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[1]); + fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[optind]); goto help; } diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index b42e54ca1..7aea9ee5f 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -46,7 +46,7 @@ _tst_do_exit() fi if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then - if ! tst_device release "$TST_DEVICE"; then + if ! tst_device -d "$TST_DEVICE" release; then tst_res TWARN "Failed to release device '$TST_DEVICE'" fi fi diff --git a/testcases/misc/lvm/cleanup_lvm.sh b/testcases/misc/lvm/cleanup_lvm.sh index f05289f00..c876b4bbf 100755 --- a/testcases/misc/lvm/cleanup_lvm.sh +++ b/testcases/misc/lvm/cleanup_lvm.sh @@ -24,7 +24,7 @@ cleanup_lvm() ROD vgremove -y ltp_test_vg2 for devname in $DEVLIST; do - ROD tst_device release $devname + ROD tst_device -d $devname release done rm -rf $LVM_DIR/ltp diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh index d3ae4b23f..dbf1e3157 100755 --- a/testcases/misc/lvm/prepare_lvm.sh +++ b/testcases/misc/lvm/prepare_lvm.sh @@ -43,17 +43,17 @@ prepare_mounts() FSNAME1=$1 FSNAME2=$2 shift 2 - LVM_DEV1=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv1.img"` + LVM_DEV1=`tst_device -s 1040 -d "$LVM_IMGDIR/lvm_pv1.img" acquire` error_check - LVM_DEV2=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv2.img"` + LVM_DEV2=`tst_device -s 1040 -d "$LVM_IMGDIR/lvm_pv2.img" acquire` error_check # DEVSIZE=($# * 1GB / 2) + 16MB. The extra 16MB is for LVM physical # volume headers DEVSIZE=$(( $# * 512 + 16 )) - LVM_DEV3=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv3.img"` + LVM_DEV3=`tst_device -s $DEVSIZE -d "$LVM_IMGDIR/lvm_pv3.img" acquire` error_check - LVM_DEV4=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv4.img"` + LVM_DEV4=`tst_device -s $DEVSIZE -d "$LVM_IMGDIR/lvm_pv4.img" acquire` error_check ROD pvcreate $LVM_DEV1 $LVM_DEV2 $LVM_DEV3 $LVM_DEV4 ROD vgcreate ltp_test_vg1 $LVM_DEV1 $LVM_DEV2 From patchwork Sat Aug 27 00:28:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=I0NoaKub; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wTCL109p; dkim-atps=neutral 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyHt3skHz1yh1 for ; Sat, 27 Aug 2022 10:29:14 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 42E3D3CA50C for ; Sat, 27 Aug 2022 02:29:12 +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 (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D42C13C136F for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 1067A600657 for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BFF521F96A; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560102; 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=BiPrbC61jRbbbHVM4aWPbRDbZ7+fsYA0rYNJpsLJCCI=; b=I0NoaKubnuhpIAlj1KkFSRLGWorBaYGpx19TQ9kBYRVs6kN1BBrHQQqCYdKs1XcagfO8kC g7JZBi8MPqg4fghUNb4quEjNUh/htaj3dGnXPwBPsUbRNilTlYP1h4MIAZJl9MRj23boju E5I6w15ugD51nCzNeeUkEjJA3XHo+3o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560102; 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=BiPrbC61jRbbbHVM4aWPbRDbZ7+fsYA0rYNJpsLJCCI=; b=wTCL109pNoi8fX6pcTp5csJiQ/FMORUntp/dFktYdATD3xx+rWm3T87BHEi67a8agqYo09 ZBLrhzrsodO3DSDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7847F133A6; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CJsxHCZlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:22 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:14 +0200 Message-Id: <20220827002815.19116-6-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.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 autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 5/6] tst_device: Add support -f filesystem 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Useful to get smaller minimal required size. Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis Reviewed-by: Li Wang --- testcases/lib/tst_device.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index b672202e2..a161fb069 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -19,19 +19,19 @@ static struct tst_test test = { static void print_help(void) { fprintf(stderr, "\nUsage:\n"); - fprintf(stderr, "tst_device [-s size [-d /path/to/device]] acquire\n"); + fprintf(stderr, "tst_device [-f filesystem] [-s size [-d /path/to/device]] acquire\n"); fprintf(stderr, "tst_device -d /path/to/device release\n"); fprintf(stderr, "tst_device -h\n\n"); } -static int acquire_device(const char *device_path, unsigned int size) +static int acquire_device(const char *device_path, unsigned int size, long f_type) { const char *device; if (device_path) device = tst_acquire_loop_device(size, device_path); else - device = tst_acquire_device__(size, TST_ALL_FILESYSTEMS); + device = tst_acquire_device__(size, f_type); if (!device) return 1; @@ -66,6 +66,7 @@ int main(int argc, char *argv[]) { char *device_path = NULL; unsigned int size = 0; + long f_type = TST_ALL_FILESYSTEMS; int ret; /* @@ -79,7 +80,7 @@ int main(int argc, char *argv[]) */ tst_test = &test; - while ((ret = getopt(argc, argv, "d:hs:"))) { + while ((ret = getopt(argc, argv, "d:f:hs:"))) { if (ret < 0) break; @@ -87,6 +88,13 @@ int main(int argc, char *argv[]) case 'd': device_path = optarg; break; + case 'f': + f_type = tst_fs_name_type(optarg); + if (f_type == -1) { + fprintf(stderr, "ERROR: Unsupported filesystem '%s'", optarg); + return 1; + } + break; case 'h': print_help(); return 0; @@ -104,7 +112,7 @@ int main(int argc, char *argv[]) goto help; if (!strcmp(argv[optind], "acquire")) { - if (acquire_device(device_path, size)) + if (acquire_device(device_path, size, f_type)) goto help; } else if (!strcmp(argv[optind], "release")) { if (release_device(device_path)) From patchwork Sat Aug 27 00:28:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1671085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) 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=j/YZUNWH; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XAPNo2yN; dkim-atps=neutral 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDyJ53JlLz1yh1 for ; Sat, 27 Aug 2022 10:29:25 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7CCAA3CA51E for ; Sat, 27 Aug 2022 02:29:23 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D73AB3C8765 for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (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 87C136005EF for ; Sat, 27 Aug 2022 02:28:23 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 25E7A1F9B8; Sat, 27 Aug 2022 00:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661560103; 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=3VOnVivui6wWSOrPauLaMwb0xIePAqDQskwlb3gP3/M=; b=j/YZUNWHX4tEhQFsGAEUaSPs3/RfOUGt+1MLWxCHJGvJ0zhWeYBxMqM8YZzcNn5Mxh1ZBJ YUJ3jjIIpatWgh9jKLabGe23348c4X8tLkSzYoBEaPJ2GU7skgfVjcvd3PqLts9iLcz7vZ sfNP5Z/lFIsGBAuJsvvItH4+Siy8CqA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661560103; 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=3VOnVivui6wWSOrPauLaMwb0xIePAqDQskwlb3gP3/M=; b=XAPNo2yNlqebT0T18HN9J+30L+bgx5TJLjUHAvKZJwgbGf200ybuj95fwUrAIixbqT23Fz eHkm7C4taSCfGgAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C871D133A6; Sat, 27 Aug 2022 00:28:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AIaaLyZlCWNQCgAAMHmgww (envelope-from ); Sat, 27 Aug 2022 00:28:22 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Sat, 27 Aug 2022 02:28:15 +0200 Message-Id: <20220827002815.19116-7-pvorel@suse.cz> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220827002815.19116-1-pvorel@suse.cz> References: <20220827002815.19116-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.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_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device 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 , Joerg Vehlow , linux-fsdevel@vger.kernel.org, automated-testing@lists.yoctoproject.org Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This allow to get smaller minimal required size. Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis Reviewed-by: Li Wang --- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 7aea9ee5f..1eb0ce91c 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -694,7 +694,7 @@ tst_run() TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}" if [ "$TST_NEEDS_DEVICE" = 1 ]; then - TST_DEVICE=$(tst_device acquire) + TST_DEVICE=$(tst_device -f $TST_FS_TYPE acquire) if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then unset TST_DEVICE