From patchwork Fri Sep 9 14:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676085 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=cj+D4RbP; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=KLsRRW6W; 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 4MPJ6061w0z1yhP for ; Sat, 10 Sep 2022 00:19:36 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6C7AC3CAA15 for ; Fri, 9 Sep 2022 16:19:33 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BCB393CAA10 for ; Fri, 9 Sep 2022 16:18:47 +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 DEC1D200FEE for ; Fri, 9 Sep 2022 16:18:46 +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 5566221F3F; Fri, 9 Sep 2022 14:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733125; 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=VhzZHOFaji3bmpn4xAcyi2YRAYB8ORCaXrvafyfj9xo=; b=cj+D4RbPdcRUCxbC1W2sGbr9Cyb34DUEMnen2fK+FGufpRDCy/tnqjhk0vjr9Ykm8L+GF1 IydOkJth2/3c0tW+3doV3//SaE5ls4OVz0V0O5xUdVY4Ff7F3imGOTdBeTOlJpiuDYZTG9 vXHjyZSFCWVJqiqXJ8LaZEGWqbwOSV8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733125; 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=VhzZHOFaji3bmpn4xAcyi2YRAYB8ORCaXrvafyfj9xo=; b=KLsRRW6WDjnfYJvUWikUi4gYtDWOrgL29005y4yuYl+QKL1Z98EeGWGEtyUqn/0h47JoUf bQp1xjuLxXqApLDg== 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 C41AB13A93; Fri, 9 Sep 2022 14:18:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iLy1LURLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:44 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:31 +0200 Message-Id: <20220909141840.18327-2-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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 v5 01/10] shell: Print mount command in tst_mount() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Reviewed-by: Li Wang Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- The same as in v4 testcases/lib/tst_test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index f884a278d..7c97b69fe 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -293,9 +293,11 @@ tst_mount() mnt_opt="-t $TST_FS_TYPE" mnt_err=" $TST_FS_TYPE type" fi + local cmd="mount $mnt_opt $TST_DEVICE $TST_MNTPOINT $TST_MNT_PARAMS" ROD_SILENT mkdir -p $TST_MNTPOINT - mount $mnt_opt $TST_DEVICE $TST_MNTPOINT $TST_MNT_PARAMS + tst_res TINFO "Mounting device: $cmd" + $cmd local ret=$? if [ $ret -eq 32 ]; then From patchwork Fri Sep 9 14:18:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676082 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=qSO0Fwri; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=D5kJwWfL; 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 4MPJ5L66cZz1yhP for ; Sat, 10 Sep 2022 00:19:02 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 97E693CAA15 for ; Fri, 9 Sep 2022 16:19:00 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9A1E83CA9C9 for ; Fri, 9 Sep 2022 16:18:47 +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-2.smtp.seeweb.it (Postfix) with ESMTPS id DEF066018AD for ; Fri, 9 Sep 2022 16:18:46 +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 233F01F8E8; Fri, 9 Sep 2022 14:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733126; 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=HNQgUBRWsqtV3vQXwuFg2/KhGXIoZ7hKLl4tSVGILvU=; b=qSO0Fwrivv4HWoxv0YLh5XjxFCGDZ4K33zWLGPMsnnazzllSVFtZfCg0ylfhG96yWp/J27 7wRSMhsF+U7SOjQ2Oy3ap5aRSRwBnx60FPKyP83TUM5HjTaRyyuKpAVFZ/WrYqc1LdsEqM avFABHm5CRAo3LKjvOTTSobR7vubZWw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733126; 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=HNQgUBRWsqtV3vQXwuFg2/KhGXIoZ7hKLl4tSVGILvU=; b=D5kJwWfL+MhWVnt+cuqQKfT6um3t8FQuEe64hcgJZDbSjbFDNee93KGBLPeY2nI4mrIPNx hYLrWnqHEU7mkkDA== 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 7049413A93; Fri, 9 Sep 2022 14:18:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mOZ9F0VLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:45 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:32 +0200 Message-Id: <20220909141840.18327-3-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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_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-2.smtp.seeweb.it Subject: [LTP] [PATCH v5 02/10] shell API/tests: Require root for format/mount tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" i.e. for TST_{FORMAT,MOUNT}_DEVICE=1. Although the warning is quite obvious: tst_device.c:101: TINFO: Not allowed to open /dev/loop-control. Are you root?: EACCES (13) tst_device.c:140: TINFO: No free devices found TBROK: Failed to acquire device It's safer to expect root to get valid result. Reviewed-by: Li Wang Signed-off-by: Petr Vorel --- The same as in v4 lib/newlib_tests/shell/tst_format_device.sh | 1 + lib/newlib_tests/shell/tst_mount_device.sh | 1 + lib/newlib_tests/shell/tst_mount_device_tmpfs.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/newlib_tests/shell/tst_format_device.sh b/lib/newlib_tests/shell/tst_format_device.sh index 73a919086..dbe4ea9e7 100755 --- a/lib/newlib_tests/shell/tst_format_device.sh +++ b/lib/newlib_tests/shell/tst_format_device.sh @@ -3,6 +3,7 @@ # Copyright (c) 2022 Petr Vorel TST_FORMAT_DEVICE=1 +TST_NEEDS_ROOT=1 TST_TESTFUNC=test TST_CNT=2 TST_DEV_FS_OPTS="-b 1024" diff --git a/lib/newlib_tests/shell/tst_mount_device.sh b/lib/newlib_tests/shell/tst_mount_device.sh index 561f878d2..70f80f84a 100755 --- a/lib/newlib_tests/shell/tst_mount_device.sh +++ b/lib/newlib_tests/shell/tst_mount_device.sh @@ -3,6 +3,7 @@ # Copyright (c) 2022 Petr Vorel TST_MOUNT_DEVICE=1 +TST_NEEDS_ROOT=1 TST_FS_TYPE=ext4 TST_TESTFUNC=test TST_CNT=3 diff --git a/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh b/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh index 36a78bc85..ed2ba8c50 100755 --- a/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh +++ b/lib/newlib_tests/shell/tst_mount_device_tmpfs.sh @@ -3,6 +3,7 @@ # Copyright (c) 2022 Petr Vorel TST_MOUNT_DEVICE=1 +TST_NEEDS_ROOT=1 TST_FS_TYPE=tmpfs TST_TESTFUNC=test From patchwork Fri Sep 9 14:18:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676083 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=PdGwUcEK; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=/YjyQsM/; 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 4MPJ5d11Hqz1yhP for ; Sat, 10 Sep 2022 00:19:16 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5E4CF3CAA09 for ; Fri, 9 Sep 2022 16:19:10 +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 [IPv6:2001:4b78:1:20::6]) (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 A38943CA9DB for ; Fri, 9 Sep 2022 16:18:47 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 2D3BA1400E15 for ; Fri, 9 Sep 2022 16:18:47 +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 D2B4021F3D; Fri, 9 Sep 2022 14:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733126; 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=V0pDL19Oe5bCwg0vwLI3n9f0/UkgLmpVRH2HZBz+9fk=; b=PdGwUcEKI/TUOIrgfwnz4bZ8YRW2LDJa1ea9htXxEsHadRDmu9vE1Lg+Umkp/RuP7yImfX lRu696WXoZaEx+fpS/iTxvG5kujSaKqqJZwmnKf/ceNeHlRmJxVjedbBADMYONKr43p1ez J1kXvX76Jww98KyRau3bxYszfjvIaMw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733126; 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=V0pDL19Oe5bCwg0vwLI3n9f0/UkgLmpVRH2HZBz+9fk=; b=/YjyQsM/CizpbGhBCnBW6Msg+R9MEEPOH8ZanGw6v0jYylFO9oiykmUYVEtTZouHFSm9rv jd0pB7ValooMQ1AA== 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 30C8813A93; Fri, 9 Sep 2022 14:18:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sJmBB0ZLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:46 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:33 +0200 Message-Id: <20220909141840.18327-4-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.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-6.smtp.seeweb.it Subject: [LTP] [PATCH v5 03/10] tst_supported_fs: Print TCONF if no filesystem supported X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Although this is unlikely, it can happen. This means 32 (TCONF) instead of 0 exit code when searching for all filesystems and 32 instead of 1 when searching for a particular filesystem. Signed-off-by: Petr Vorel --- New in v5 NOTE: Although this will later leads to duplicating message (see below) it's IMHO better because LVM scripts and zram01.sh use this helper directly. Tests added in later commits which demonstrates TCONF: # ./tst_skip_filesystems_skip.sh tst_supported_fs_types.c:90: TINFO: Kernel supports ext4 tst_supported_fs_types.c:52: TINFO: mkfs.ext4 does exist tst_supported_fs.c:88: TCONF: ext4 is skipped or not supported tst_skip_filesystems_skip 1 TCONF: ext4 is not supported Summary: passed 0 failed 0 broken 0 skipped 1 warnings 0 # ./tst_all_filesystems_skip.sh tst_device.c:89: TINFO: Found free device 0 '/dev/loop0' tst_supported_fs_types.c:173: TINFO: Skipping ext2 as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping ext3 as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping ext4 as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping xfs as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping btrfs as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping vfat as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping exfat as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping ntfs as requested by the test tst_supported_fs_types.c:173: TINFO: Skipping tmpfs as requested by the test tst_supported_fs.c:96: TCONF: There are no supported filesystems or all skipped tst_all_filesystems_skip 1 TCONF: There are no supported filesystems or all skipped Summary: passed 0 failed 0 broken 0 skipped 1 warnings 0 testcases/lib/tst_supported_fs.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c index 43eac194f..6e544070c 100644 --- a/testcases/lib/tst_supported_fs.c +++ b/testcases/lib/tst_supported_fs.c @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) { const char *skiplist[] = {"tmpfs", NULL}; const char *const *filesystems; - int i; + int i, ret; if (argc > 2) { fprintf(stderr, "Can't specify multiple fs_type\n"); @@ -37,10 +37,20 @@ int main(int argc, char *argv[]) return 0; } - if (argv[1]) - return !tst_fs_is_supported(argv[1]); + if (argv[1]) { + ret = tst_fs_is_supported(argv[1]); + + if (ret == TST_FS_UNSUPPORTED) + tst_brk(TCONF, "%s is not supported", argv[optind]); + + return !ret; + } filesystems = tst_get_supported_fs_types(skiplist); + + if (!filesystems[0]) + tst_brk(TCONF, "There are no supported filesystems"); + for (i = 0; filesystems[i]; i++) printf("%s\n", filesystems[i]); From patchwork Fri Sep 9 14:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676086 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=rFvPu3c4; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Hljjn4J9; 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 4MPJ693pfmz1yp6 for ; Sat, 10 Sep 2022 00:19:45 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 75D8A3CA9FF for ; Fri, 9 Sep 2022 16:19:43 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 466373CAA67 for ; Fri, 9 Sep 2022 16:18:48 +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-2.smtp.seeweb.it (Postfix) with ESMTPS id 53EDE601AFD for ; Fri, 9 Sep 2022 16:18:48 +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 CEC7F21F3E; Fri, 9 Sep 2022 14:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733127; 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=AEiEwmW5jdz8lY+uMq32UyRl6LPLBbY5ZIK8+IgPuao=; b=rFvPu3c41o88Jensz/IseMJS1aSe3eqBWognIIm1kajW3B4u2s4RmMyId6K2/t/rilHu2f Akd5IsRdLF4Is+e0i1fTz7l5ggLZjkXSE3LoqqXoIm/be/Q5oqPYaZffbVHbldzMaz4jrG 1c122Pq11qw3+tLjZg5aGUNlh7W5S7E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733127; 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=AEiEwmW5jdz8lY+uMq32UyRl6LPLBbY5ZIK8+IgPuao=; b=Hljjn4J9MZsh8PcUJtYJwl09b8fczPfSTP/sdf0T9Dhdtk4B34rSHK89hsXjr/zEVy4poc sL/NTNvlfFzoVHCQ== 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 EFD3B13A93; Fri, 9 Sep 2022 14:18:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wLNyN0ZLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:46 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:34 +0200 Message-Id: <20220909141840.18327-5-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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_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-2.smtp.seeweb.it Subject: [LTP] [PATCH v5 04/10] tst_supported_fs: Implement skip list X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" as it will be needed for $ALL_FILESYSTEMS shell implementation in the next commit. Pass tmpfs to LVM scripts (as it was required there). Acked-by: Richard Palethorpe Reviewed-by: Li Wang Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- changes v4->v5: * testcases/lib/tst_supported_fs.c: put parsing code to separate function parse_skiplist() (Cyril) testcases/lib/tst_supported_fs.c | 65 ++++++++++++++++++---- testcases/misc/lvm/generate_lvm_runfile.sh | 2 +- testcases/misc/lvm/prepare_lvm.sh | 2 +- 3 files changed, 56 insertions(+), 13 deletions(-) diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c index 6e544070c..1c259e62a 100644 --- a/testcases/lib/tst_supported_fs.c +++ b/testcases/lib/tst_supported_fs.c @@ -5,40 +5,83 @@ */ #include +#include #include +#define SKIP_DELIMITER ',' + #define TST_NO_DEFAULT_MAIN #include "tst_test.h" #include "tst_fs.h" static void usage(void) { - fprintf(stderr, "Usage: tst_supported_fs [fs_type]\n"); + fprintf(stderr, "Usage: tst_supported_fs [-s skip_list] [fs_type]\n"); fprintf(stderr, " If fs_type is supported, return 0\n"); fprintf(stderr, " If fs_type isn't supported, return 1\n"); fprintf(stderr, " If fs_type isn't specified, print the list of supported filesystems\n"); fprintf(stderr, " fs_type - a specified filesystem type\n"); + fprintf(stderr, " skip_list - filesystems to skip, delimiter: '%c'\n", + SKIP_DELIMITER); +} + +static char **parse_skiplist(char *fs) +{ + char **skiplist = NULL; + int i, cnt = 1; + + for (i = 0; fs[i]; i++) { + if (optarg[i] == SKIP_DELIMITER) + cnt++; + } + + skiplist = malloc(++cnt * sizeof(char *)); + if (!skiplist) { + fprintf(stderr, "malloc() failed\n"); + return NULL; + } + + for (i = 0; i < cnt; i++) + skiplist[i] = strtok_r(fs, TST_TO_STR(SKIP_DELIMITER), &fs); + + return skiplist; } int main(int argc, char *argv[]) { - const char *skiplist[] = {"tmpfs", NULL}; const char *const *filesystems; int i, ret; + char **skiplist = NULL; - if (argc > 2) { - fprintf(stderr, "Can't specify multiple fs_type\n"); - usage(); - return 2; + while ((ret = getopt(argc, argv, "hs:"))) { + if (ret < 0) + break; + + switch (ret) { + case '?': + usage(); + return 1; + + case 'h': + usage(); + return 0; + + case 's': + skiplist = parse_skiplist(optarg); + if (!skiplist) + return 1; + break; + } } - if (argv[1] && !strcmp(argv[1], "-h")) { + if (argc - optind > 1) { + fprintf(stderr, "Can't specify multiple fs_type\n"); usage(); - return 0; + return 2; } - if (argv[1]) { - ret = tst_fs_is_supported(argv[1]); + if (optind < argc) { + ret = tst_fs_is_supported(argv[optind]); if (ret == TST_FS_UNSUPPORTED) tst_brk(TCONF, "%s is not supported", argv[optind]); @@ -46,7 +89,7 @@ int main(int argc, char *argv[]) return !ret; } - filesystems = tst_get_supported_fs_types(skiplist); + filesystems = tst_get_supported_fs_types((const char * const*)skiplist); if (!filesystems[0]) tst_brk(TCONF, "There are no supported filesystems"); diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh index 477aed116..7f7e149d9 100755 --- a/testcases/misc/lvm/generate_lvm_runfile.sh +++ b/testcases/misc/lvm/generate_lvm_runfile.sh @@ -17,7 +17,7 @@ generate_runfile() trap '[ $? -eq 0 ] || tst_brk TBROK "Cannot create LVM runfile"' EXIT INFILE="$LTPROOT/testcases/data/lvm/runfile.tpl" OUTFILE="$LTPROOT/runtest/lvm.local" - FS_LIST=`tst_supported_fs` + FS_LIST=$(tst_supported_fs -s tmpfs) echo -n "" >"$OUTFILE" for fsname in $FS_LIST; do diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh index d3ae4b23f..29f386df8 100755 --- a/testcases/misc/lvm/prepare_lvm.sh +++ b/testcases/misc/lvm/prepare_lvm.sh @@ -70,7 +70,7 @@ prepare_mounts() prepare_lvm() { - FS_LIST=`tst_supported_fs | sort -u` + FS_LIST=$(tst_supported_fs -s tmpfs | sort -u) ROD mkdir -p "$LVM_TMPDIR" ROD mkdir -p "$LVM_IMGDIR" chmod 777 "$LVM_TMPDIR" From patchwork Fri Sep 9 14:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676084 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=ZsGyKK80; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=fhv6jCJp; 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 4MPJ5q03Bcz1yhP for ; Sat, 10 Sep 2022 00:19:26 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6EA4C3CAA01 for ; Fri, 9 Sep 2022 16:19:22 +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 887F43CAA10 for ; Fri, 9 Sep 2022 16:18:49 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 CEC1810011AB for ; Fri, 9 Sep 2022 16:18:48 +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 85C3D21F40; Fri, 9 Sep 2022 14:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733128; 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=bZmNBbFDpzxBA2+wTMBlKOnODyawYHapRMhmU0Si1eA=; b=ZsGyKK80JH1Tz4rYV2h8BeRxZVLA6McnGghYYIGTpbn0A+Ck6pi7qKaKL89cOz5d727HyT RPMK2HYgh4sOmpR+FftTJNGlbRf1o5uQdPe2auJiCOVJA6uohW8DyFFsyAO3arQD+iegI6 tYDM1oTV+ymw+HDMdMhPUcNzGESaPpw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733128; 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=bZmNBbFDpzxBA2+wTMBlKOnODyawYHapRMhmU0Si1eA=; b=fhv6jCJpUjJg2FIVTJrTmIz1o+MEaz178B79v58p4XSpDNlm0sCjyX1EYixTMjPH/yxYIO E4bIFheEtC6q4XCQ== 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 D725A13A93; Fri, 9 Sep 2022 14:18:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0PN9MUdLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:47 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:35 +0200 Message-Id: <20220909141840.18327-6-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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 v5 05/10] tst_supported_fs: Support skip list when query single fs X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" And use this feature in zram01.sh Acked-by: Richard Palethorpe Reviewed-by: Li Wang Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- changes v4->v5: * tst_fs_is_supported_skiplist() returns TST_FS_UNSUPPORTED, errors handled in testcases/lib/tst_supported_fs.c (Cyril) * testcases/lib/tst_supported_fs.c: put parsing code to separate function parse_skiplist() (Cyril) * testcases/lib/tst_supported_fs.c: Print usage on getopts error (Cyril) * zram01.sh: use -f tmpfs in tst_supported_fs call include/tst_fs.h | 10 ++++++++++ lib/tst_supported_fs_types.c | 16 ++++++++++++++++ testcases/kernel/device-drivers/zram/zram01.sh | 3 +-- testcases/lib/tst_supported_fs.c | 7 ++++--- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/include/tst_fs.h b/include/tst_fs.h index cc6d9b547..e399aef54 100644 --- a/include/tst_fs.h +++ b/include/tst_fs.h @@ -183,6 +183,16 @@ enum tst_fs_impl { */ enum tst_fs_impl tst_fs_is_supported(const char *fs_type); +/* + * Check filesystem support (@see tst_fs_is_supported()), but consider also + * filesystems to skip. + * + * @fs_type A filesystem name to check the support for. + * @skiplist A NULL terminated array of filesystems to skip. + */ +enum tst_fs_impl tst_fs_is_supported_skiplist(const char *fs_type, const char + *const *skiplist); + /* * Returns NULL-terminated array of kernel-supported filesystems. * diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c index 9726d193a..cde162555 100644 --- a/lib/tst_supported_fs_types.c +++ b/lib/tst_supported_fs_types.c @@ -134,6 +134,22 @@ enum tst_fs_impl tst_fs_is_supported(const char *fs_type) return TST_FS_UNSUPPORTED; } +enum tst_fs_impl tst_fs_is_supported_skiplist(const char *fs_type, const char + *const *skiplist) +{ + int ret; + + ret = tst_fs_is_supported(fs_type); + + if (!ret) + return ret; + + if (tst_fs_in_skiplist(fs_type, skiplist)) + return TST_FS_UNSUPPORTED; + + return ret; +} + const char **tst_get_supported_fs_types(const char *const *skiplist) { unsigned int i, j = 0; diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh index ad01291bf..8b92b699f 100755 --- a/testcases/kernel/device-drivers/zram/zram01.sh +++ b/testcases/kernel/device-drivers/zram/zram01.sh @@ -38,8 +38,7 @@ initialize_vars() local fs limit size stream=-1 dev_num=0 - for fs in $(tst_supported_fs); do - [ "$fs" = "tmpfs" ] && continue + for fs in $(tst_supported_fs -s tmpfs); do size="26214400" limit="25M" if [ "$fs" = "btrfs" ]; then diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c index 1c259e62a..032b9d10b 100644 --- a/testcases/lib/tst_supported_fs.c +++ b/testcases/lib/tst_supported_fs.c @@ -81,10 +81,11 @@ int main(int argc, char *argv[]) } if (optind < argc) { - ret = tst_fs_is_supported(argv[optind]); + ret = tst_fs_is_supported_skiplist(argv[optind], + (const char * const*)skiplist); if (ret == TST_FS_UNSUPPORTED) - tst_brk(TCONF, "%s is not supported", argv[optind]); + tst_brk(TCONF, "%s is skipped or not supported", argv[optind]); return !ret; } @@ -92,7 +93,7 @@ int main(int argc, char *argv[]) filesystems = tst_get_supported_fs_types((const char * const*)skiplist); if (!filesystems[0]) - tst_brk(TCONF, "There are no supported filesystems"); + tst_brk(TCONF, "There are no supported filesystems or all skipped"); for (i = 0; filesystems[i]; i++) printf("%s\n", filesystems[i]); From patchwork Fri Sep 9 14:18:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676087 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=1tbL+Zvm; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=gcZJkm5d; 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 4MPJ6P0TjDz1yhP for ; Sat, 10 Sep 2022 00:19:56 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 315503CA9C9 for ; Fri, 9 Sep 2022 16:19:54 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 888C03CAA6B for ; Fri, 9 Sep 2022 16:18:50 +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-7.smtp.seeweb.it (Postfix) with ESMTPS id D25AC201004 for ; Fri, 9 Sep 2022 16:18:49 +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 5718D1F8E8; Fri, 9 Sep 2022 14:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733129; 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=M4TnlEpRVMNUnphyGIbMyX7M2Y8GDRxmSXRjozKw8ZE=; b=1tbL+ZvmSbqlESBzdTatSo0/7C6kJcRz3mydETjg7RfGF7f2wIgaMliTJj8Yd28D85j6dE 1Ng9S4SmO74oTwrzcH6ntW8oPRn3bzOAGvQwB5gaMrPIdGN/r9zEDEfWLc+1b2zWa2aoHL q+zAqqPfjlRYdRqnddygQU+LCUHKgnM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733129; 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=M4TnlEpRVMNUnphyGIbMyX7M2Y8GDRxmSXRjozKw8ZE=; b=gcZJkm5dIENr0vb6X8gNaOT9U5+CntwZanfq/gSrhaENTzpr4K8Qxo427qr3pCKv+2XzA9 6/LtFuXpMAwz+MDw== 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 998FA13A93; Fri, 9 Sep 2022 14:18:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oOLwIkhLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:48 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:36 +0200 Message-Id: <20220909141840.18327-7-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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_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-7.smtp.seeweb.it Subject: [LTP] [PATCH v5 06/10] shell: Add $TST_SKIP_FILESYSTEMS + tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" C API struct tst_test skip_filesystems member equivalent. Now only running on single filesystem (will be improved in the next commit) Acked-by: Richard Palethorpe Reviewed-by: Li Wang Signed-off-by: Petr Vorel --- changes v4->v5: * add fuse to lib/newlib_tests/shell/tst_skip_filesystems.sh doc/shell-test-api.txt | 2 ++ .../shell/tst_skip_filesystems.sh | 35 +++++++++++++++++++ .../shell/tst_skip_filesystems_skip.sh | 17 +++++++++ lib/tst_supported_fs_types.c | 1 + testcases/lib/tst_test.sh | 6 ++++ 5 files changed, 61 insertions(+) create mode 100755 lib/newlib_tests/shell/tst_skip_filesystems.sh create mode 100755 lib/newlib_tests/shell/tst_skip_filesystems_skip.sh diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt index 65444541e..18ed144a9 100644 --- a/doc/shell-test-api.txt +++ b/doc/shell-test-api.txt @@ -229,6 +229,8 @@ simply by setting right '$TST_FOO'. | 'TST_NEEDS_KCONFIGS' | Checks kernel kconfigs support for the test (see below). | 'TST_NEEDS_KCONFIGS_IFS' | Used for splitting '$TST_NEEDS_KCONFIGS' variable, default value is comma, it only supports single character. +| 'TST_SKIP_FILESYSTEMS' | Comma separated list of filesystems on which test will be skipped + (tst_test.skip_filesystems equivalent). | 'TST_TIMEOUT' | Maximum timeout set for the test in sec. Must be int >= 1, or -1 (special value to disable timeout), default is 300. Variable is meant be set in tests, not by user. diff --git a/lib/newlib_tests/shell/tst_skip_filesystems.sh b/lib/newlib_tests/shell/tst_skip_filesystems.sh new file mode 100755 index 000000000..675d0ee5f --- /dev/null +++ b/lib/newlib_tests/shell/tst_skip_filesystems.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel + +TST_MOUNT_DEVICE=1 +TST_NEEDS_ROOT=1 +TST_FS_TYPE=ext4 +TST_TESTFUNC=test +TST_SKIP_FILESYSTEMS="btrfs,exfat,ext2,ext3,fuse,ntfs,vfat,tmpfs,xfs" +TST_CNT=3 + +test1() +{ + EXPECT_PASS "cd $TST_MNTPOINT" +} + +test2() +{ + EXPECT_PASS "grep '$TST_MNTPOINT $TST_FS_TYPE' /proc/mounts" +} + +test3() +{ + local fs fs_skip + + fs=$(grep "$TST_MNTPOINT $TST_FS_TYPE" /proc/mounts | cut -d ' ' -f3) + EXPECT_PASS "[ '$fs' = '$TST_FS_TYPE' ]" + + for fs_skip in $TST_SKIP_FILESYSTEMS; do + EXPECT_FAIL "[ $fs = $fs_skip ]" + done +} + +. tst_test.sh +tst_run diff --git a/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh b/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh new file mode 100755 index 000000000..6748d021d --- /dev/null +++ b/lib/newlib_tests/shell/tst_skip_filesystems_skip.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel + +TST_MOUNT_DEVICE=1 +TST_NEEDS_ROOT=1 +TST_FS_TYPE=ext4 +TST_TESTFUNC=test +TST_SKIP_FILESYSTEMS="ext4" + +test() +{ + tst_res TFAIL "test should be skipped with TCONF" +} + +. tst_test.sh +tst_run diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c index cde162555..41d9bcd27 100644 --- a/lib/tst_supported_fs_types.c +++ b/lib/tst_supported_fs_types.c @@ -14,6 +14,7 @@ #include "tst_test.h" #include "tst_fs.h" +/* NOTE: new filesystem should be also added to tst_skip_filesystems.sh */ static const char *const fs_type_whitelist[] = { "ext2", "ext3", diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 7c97b69fe..2937bd80c 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -626,6 +626,7 @@ tst_run() local _tst_max local _tst_name local _tst_pattern='[='\''"} \t\/:`$\;].*' + local ret if [ -n "$TST_TEST_PATH" ]; then for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed "s/.*TST_//; s/$_tst_pattern//"); do @@ -644,6 +645,7 @@ tst_run() CHECKPOINT_WAIT|CHECKPOINT_WAKE);; CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);; DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);; + SKIP_FILESYSTEMS);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";; esac done @@ -675,6 +677,10 @@ tst_run() tst_brk TCONF "test requires kernel $TST_MIN_KVER+" fi + tst_supported_fs -s "$TST_SKIP_FILESYSTEMS" $TST_FS_TYPE + ret=$? + [ $ret -ne 0 ] && return $ret + _tst_setup_timer [ "$TST_MOUNT_DEVICE" = 1 ] && TST_FORMAT_DEVICE=1 From patchwork Fri Sep 9 14:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676088 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=OOrpJJ0q; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SfNYNNy1; 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 4MPJ6Y6DT1z1yp6 for ; Sat, 10 Sep 2022 00:20:05 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6212F3CAA2E for ; Fri, 9 Sep 2022 16:20:03 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id CD15F3CAA0E for ; Fri, 9 Sep 2022 16:18:51 +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-2.smtp.seeweb.it (Postfix) with ESMTPS id 3BD5E6019B2 for ; Fri, 9 Sep 2022 16:18:51 +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 ABFD51F913; Fri, 9 Sep 2022 14:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733130; 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=h4U8RPbmepC6zWJaGqaLLHmtY8bzYHT28T96+HDAcl4=; b=OOrpJJ0qD+lzM4uu1GiDNldvbB5J3x/LvQNSXNsnXovT7DwpIiq+P0qwmTT9m8EEKldrja rlGT3rQsHGguYPcKLymYHy9se5bdhwsOuZ4eN5fXrLxifmXrwM3c3ywI20RXT3A6G8XHeO NmcTrIX9geH8Y7CqtRjHIO1qpyVRoas= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733130; 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=h4U8RPbmepC6zWJaGqaLLHmtY8bzYHT28T96+HDAcl4=; b=SfNYNNy1sXriiJY+SCDwqQT+8sTs0Q15jUubQJZV0Ul3xCuppcyYcSspiU/LjTvOuD7nZl l8t5wzapjSg9zIAg== 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 8222113A93; Fri, 9 Sep 2022 14:18:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YI4UG0lLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:49 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:37 +0200 Message-Id: <20220909141840.18327-8-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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_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-2.smtp.seeweb.it Subject: [LTP] [PATCH v5 07/10] tst_test.sh: Introduce TST_FS_TYPE_FUSE X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Useful if tests need to grep on mount output (there is fuseblk instead of expected filesystem). Reviewed-by: Li Wang Signed-off-by: Petr Vorel --- doc/shell-test-api.txt | 2 ++ testcases/lib/tst_test.sh | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt index 18ed144a9..e16080061 100644 --- a/doc/shell-test-api.txt +++ b/doc/shell-test-api.txt @@ -210,6 +210,8 @@ simply by setting right '$TST_FOO'. | 'TST_DEVICE' | Block device name for 'tst_mount' and 'tst_mkfs', see https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]. | 'TST_FS_TYPE' | Override the default filesystem to be used. +| 'TST_FS_TYPE_FUSE' | 1 if mounted 'TST_FS_TYPE' filesystem on + 'TST_DEVICE' device is FUSE. | 'TST_MNTPOINT' | Holds path to mountpoint used in 'tst_mount', see https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]. | 'TST_MNT_PARAMS' | Extra mount params for 'tst_mount', see diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 2937bd80c..78dbfc1ce 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -307,6 +307,18 @@ tst_mount() if [ $ret -ne 0 ]; then tst_brk TBROK "Failed to mount device${mnt_err}: mount exit = $ret" fi + + mnt_real="$(grep -E "$TST_MNTPOINT ($TST_FS_TYPE|fuseblk)" /proc/mounts | awk 'NR==1{print $3}')" + case $mnt_real in + '') tst_brk TBROK 'Failed to found filesystem type in /proc/mounts';; + 'fuseblk') TST_FS_TYPE_FUSE=1;; + *) + if [ "$mnt_real" != "$TST_FS_TYPE" ]; then + tst_brk TBROK "$mnt_real: unsupported type in /proc/mounts" + fi + TST_FS_TYPE_FUSE= + ;; + esac } tst_umount() @@ -636,7 +648,7 @@ tst_run() OPTS|USAGE|PARSE_ARGS|POS_ARGS);; NEEDS_ROOT|NEEDS_TMPDIR|TMPDIR|NEEDS_DEVICE|DEVICE);; NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);; - NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);; + NEEDS_DRIVERS|FS_TYPE|FS_TYPE_FUSE|MNTPOINT|MNT_PARAMS);; NEEDS_KCONFIGS|NEEDS_KCONFIGS_IFS);; IPV6|IPV6_FLAG|IPVER|TEST_DATA|TEST_DATA_IFS);; RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);; From patchwork Fri Sep 9 14:18:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676090 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=GzBLQ6Yq; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MWSoubDN; 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 4MPJ726N6Wz1yhR for ; Sat, 10 Sep 2022 00:20:30 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0C7D13CAA09 for ; Fri, 9 Sep 2022 16:20:27 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 7A4923CAA66 for ; Fri, 9 Sep 2022 16:18:54 +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-3.smtp.seeweb.it (Postfix) with ESMTPS id 012291A0145B for ; Fri, 9 Sep 2022 16:18:52 +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 31B1221F3D; Fri, 9 Sep 2022 14:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733132; 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=EM22nyPSQwdP0ULPy3V122GNB4FtE6z3Ue7qZCN/V+Y=; b=GzBLQ6Yqma10VGps7miAq6Kv1KXneHzasuLpjxdxEL8EKdaIXHQ2dWlIVKdtGkRbnXvj1S tt/VVi1G8DVr2SylrtdZUyuJPInv4b5DjmGHLeV0riXkA/VhR+VvvgXE1RLNQ00WhguZ8J H+HtRIl1KF1jwMejjrOxgh4SgIEH82Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733132; 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=EM22nyPSQwdP0ULPy3V122GNB4FtE6z3Ue7qZCN/V+Y=; b=MWSoubDNQ0aV1i7DHEMvygzf8bd1ZtIqi/a09+o9WRA8um2DZ5oZqe3dJzv0tCRDsAXBYu ULkPkIsSQt4my5Cg== 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 DEDFB13A93; Fri, 9 Sep 2022 14:18:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aASdLUpLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:50 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:38 +0200 Message-Id: <20220909141840.18327-9-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_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-3.smtp.seeweb.it Subject: [LTP] [PATCH v5 08/10] tst_test.sh: Add $TST_ALL_FILESYSTEMS X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" $TST_ALL_FILESYSTEMS is shell API equivalent of .all_filesystems from C API. Improve also $TST_SKIP_FILESYSTEMS to behave like .skip_filesystems. Reviewed-by: Li Wang Acked-by: Richard Palethorpe Signed-off-by: Petr Vorel --- changes v4->v5: * tst_test.sh: fix quiting test when no filesystem supported doc/shell-test-api.txt | 9 ++- testcases/lib/tst_test.sh | 139 +++++++++++++++++++++++++------------- 2 files changed, 101 insertions(+), 47 deletions(-) diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt index e16080061..c92d7f4b4 100644 --- a/doc/shell-test-api.txt +++ b/doc/shell-test-api.txt @@ -199,6 +199,10 @@ simply by setting right '$TST_FOO'. [options="header"] |============================================================================= | Variable name | Action done +| 'TST_ALL_FILESYSTEMS' | Testing on all available filesystems + ('tst_test.all_filesystems' equivalent). + When 'TST_SKIP_FILESYSTEMS' any listed filesystem is not + included in the resulting list of supported filesystems. | 'TST_DEV_EXTRA_OPTS' | Pass extra 'mkfs' options _after_ device name, to 'tst_mkfs', use with 'TST_FORMAT_DEVICE=1'. | 'TST_DEV_FS_OPTS' | Pass 'mkfs' options _before_ the device name, @@ -209,7 +213,10 @@ simply by setting right '$TST_FOO'. Implies 'TST_NEEDS_DEVICE=1' (no need to set it). | 'TST_DEVICE' | Block device name for 'tst_mount' and 'tst_mkfs', see https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]. -| 'TST_FS_TYPE' | Override the default filesystem to be used. +| 'TST_FS_TYPE' | Override the default filesystem to be used. Also + contains currently used filesystem during looping + filesystems in 'TST_ALL_FILESYSTEMS=1' + ('tst_device->fs_type' equivalent). | 'TST_FS_TYPE_FUSE' | 1 if mounted 'TST_FS_TYPE' filesystem on 'TST_DEVICE' device is FUSE. | 'TST_MNTPOINT' | Holds path to mountpoint used in 'tst_mount', see diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 78dbfc1ce..de4599625 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -17,10 +17,6 @@ export TST_ITERATIONS=1 export TST_TMPDIR_RHOST=0 export TST_LIB_LOADED=1 -if [ -z "$TST_FS_TYPE" ]; then - export TST_FS_TYPE="${LTP_DEV_FS_TYPE:-ext2}" -fi - . tst_ansi_color.sh . tst_security.sh @@ -33,17 +29,7 @@ _tst_do_exit() local ret=0 TST_DO_EXIT=1 - if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then - if command -v $TST_CLEANUP >/dev/null 2>/dev/null; then - $TST_CLEANUP - else - tst_res TWARN "TST_CLEANUP=$TST_CLEANUP declared, but function not defined (or cmd not found)" - fi - fi - - if [ "$TST_MOUNT_FLAG" = 1 ]; then - tst_umount - fi + [ "$TST_MOUNT_FLAG" = 1 ] && tst_umount if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then if ! tst_device release "$TST_DEVICE"; then @@ -287,7 +273,7 @@ TST_CHECKPOINT_WAKE_AND_WAIT() tst_mount() { - local mnt_opt mnt_err + local mnt_opt mnt_err mnt_real if [ -n "$TST_FS_TYPE" ]; then mnt_opt="-t $TST_FS_TYPE" @@ -490,6 +476,7 @@ LTPROOT Prefix for installed LTP (default: /opt/ltp) LTP_COLORIZE_OUTPUT Force colorized output behaviour (y/1 always, n/0: never) LTP_DEV Path to the block device to be used (for .needs_device) LTP_DEV_FS_TYPE Filesystem used for testing (default: ext2) +LTP_SINGLE_FS_TYPE Testing only - specifies filesystem instead all supported (for TST_ALL_FILESYSTEMS=1) LTP_TIMEOUT_MUL Timeout multiplier (must be a number >=1, ceiled to int) TMPDIR Base directory for template directory (for .needs_tmpdir, default: /tmp) EOF @@ -631,10 +618,44 @@ _tst_init_checkpoints() export LTP_IPC_PATH } +_prepare_device() +{ + if [ "$TST_FORMAT_DEVICE" = 1 ]; then + tst_device clear "$TST_DEVICE" + tst_mkfs $TST_FS_TYPE $TST_DEV_FS_OPTS $TST_DEVICE $TST_DEV_EXTRA_OPTS + fi + + if [ "$TST_MOUNT_DEVICE" = 1 ]; then + tst_mount + TST_MOUNT_FLAG=1 + fi +} + +_tst_run_tcases_per_fs() +{ + local fs + local filesystems + + filesystems="$(tst_supported_fs -s "$TST_SKIP_FILESYSTEMS")" + if [ $? -ne 0 ]; then + tst_brk TCONF "There are no supported filesystems or all skipped" + fi + + for fs in $filesystems; do + tst_res TINFO "=== Testing on $fs ===" + TST_FS_TYPE="$fs" + if [ "$TST_FS_TYPE" != "$TST_FS_TYPE_FUSE" ]; then + tst_res TINFO "filesystem type in /proc/mounts: '$TST_FS_TYPE_FUSE'" + fi + _tst_run_iterations + done +} + tst_run() { local _tst_i local _tst_data + local _tst_fs local _tst_max local _tst_name local _tst_pattern='[='\''"} \t\/:`$\;].*' @@ -643,7 +664,7 @@ tst_run() if [ -n "$TST_TEST_PATH" ]; then for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed "s/.*TST_//; s/$_tst_pattern//"); do case "$_tst_i" in - DISABLE_APPARMOR|DISABLE_SELINUX);; + ALL_FILESYSTEMS|DISABLE_APPARMOR|DISABLE_SELINUX);; SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);; OPTS|USAGE|PARSE_ARGS|POS_ARGS);; NEEDS_ROOT|NEEDS_TMPDIR|TMPDIR|NEEDS_DEVICE|DEVICE);; @@ -689,16 +710,33 @@ tst_run() tst_brk TCONF "test requires kernel $TST_MIN_KVER+" fi - tst_supported_fs -s "$TST_SKIP_FILESYSTEMS" $TST_FS_TYPE - ret=$? - [ $ret -ne 0 ] && return $ret - - _tst_setup_timer + [ -n "$TST_NEEDS_MODULE" ] && tst_require_module "$TST_NEEDS_MODULE" + [ "$TST_ALL_FILESYSTEMS" = 1 ] && TST_MOUNT_DEVICE=1 [ "$TST_MOUNT_DEVICE" = 1 ] && TST_FORMAT_DEVICE=1 [ "$TST_FORMAT_DEVICE" = 1 ] && TST_NEEDS_DEVICE=1 [ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1 + if [ "$TST_ALL_FILESYSTEMS" != 1 ]; then + if ! tst_supported_fs -s "$TST_SKIP_FILESYSTEMS" $TST_FS_TYPE > /dev/null; then + tst_brk TCONF "$TST_FS_TYPE is not supported" + fi + fi + + if [ "$TST_NEEDS_DEVICE" = 1 ]; then + TST_DEVICE=$(tst_device acquire) + + if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then + unset TST_DEVICE + tst_brk TBROK "Failed to acquire device" + fi + TST_DEVICE_FLAG=1 + + if [ -z "$TST_FS_TYPE" ]; then + export TST_FS_TYPE="${LTP_DEV_FS_TYPE:-ext2}" + fi + fi + if [ "$TST_NEEDS_TMPDIR" = 1 ]; then if [ -z "$TMPDIR" ]; then export TMPDIR="/tmp" @@ -709,35 +747,32 @@ tst_run() chmod 777 "$TST_TMPDIR" TST_STARTWD=$(pwd) - cd "$TST_TMPDIR" fi - TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}" - if [ "$TST_NEEDS_DEVICE" = 1 ]; then - - TST_DEVICE=$(tst_device acquire) + [ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints - if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then - unset TST_DEVICE - tst_brk TBROK "Failed to acquire device" - fi + TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}" - TST_DEVICE_FLAG=1 + if [ "$TST_ALL_FILESYSTEMS" = 1 ]; then + _tst_run_tcases_per_fs + else + _tst_run_iterations fi - [ -n "$TST_NEEDS_MODULE" ] && tst_require_module "$TST_NEEDS_MODULE" + _tst_do_exit +} - if [ "$TST_FORMAT_DEVICE" = 1 ]; then - tst_mkfs $TST_FS_TYPE $TST_DEV_FS_OPTS $TST_DEVICE $TST_DEV_EXTRA_OPTS - fi +_tst_run_iterations() +{ + local _tst_i=$TST_ITERATIONS + local _tst_j - if [ "$TST_MOUNT_DEVICE" = 1 ]; then - tst_mount - TST_MOUNT_FLAG=1 - fi + [ "$TST_NEEDS_TMPDIR" = 1 ] && cd "$TST_TMPDIR" - [ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints + _prepare_device + + _tst_setup_timer if [ -n "$TST_SETUP" ]; then if command -v $TST_SETUP >/dev/null 2>/dev/null; then @@ -749,20 +784,32 @@ tst_run() fi #TODO check that test reports some results for each test function call - while [ $TST_ITERATIONS -gt 0 ]; do + while [ $_tst_i -gt 0 ]; do if [ -n "$TST_TEST_DATA" ]; then tst_require_cmds cut tr wc _tst_max=$(( $(echo $TST_TEST_DATA | tr -cd "$TST_TEST_DATA_IFS" | wc -c) +1)) - for _tst_i in $(seq $_tst_max); do - _tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_i)" + for _tst_j in $(seq $_tst_max); do + _tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_j)" _tst_run_tests "$_tst_data" done else _tst_run_tests fi - TST_ITERATIONS=$((TST_ITERATIONS-1)) + _tst_i=$((_tst_i-1)) done - _tst_do_exit + + if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then + if command -v $TST_CLEANUP >/dev/null 2>/dev/null; then + $TST_CLEANUP + else + tst_res TWARN "TST_CLEANUP=$TST_CLEANUP declared, but function not defined (or cmd not found)" + fi + fi + + if [ "$TST_MOUNT_FLAG" = 1 ]; then + tst_umount + TST_MOUNT_FLAG= + fi } _tst_run_tests() From patchwork Fri Sep 9 14:18:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676089 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=Nl5aiNUX; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ndVNmDco; 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 4MPJ6r0yhgz1yhR for ; Sat, 10 Sep 2022 00:20:19 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6E85F3CAA94 for ; Fri, 9 Sep 2022 16:20:16 +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 [IPv6:2001:4b78:1:20::6]) (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 6E7C63CAA15 for ; Fri, 9 Sep 2022 16:18:54 +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-6.smtp.seeweb.it (Postfix) with ESMTPS id C86521400994 for ; Fri, 9 Sep 2022 16:18:53 +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 3A39B1F8BA; Fri, 9 Sep 2022 14:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733133; 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=dkwSYAoqX3GkqDJxSsCQPSw9q5eycxn9+APy307Pc0c=; b=Nl5aiNUXxqFqRXSPKAnBVIc5FNBfJ1Pae9riMijNrJpZrPnsZqvHoQqj2H7p4F9cuz0ZCy 8VdoppXmAc4oq4BvCrPH17oZswXcV2T6mbouxFT0WAsKwwr5CNjUw0eIZmc9DFaxYH5IRu RThl7Peo7xEAdpdr8GDFepnb2Cv0WdE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733133; 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=dkwSYAoqX3GkqDJxSsCQPSw9q5eycxn9+APy307Pc0c=; b=ndVNmDcoy9gu7yh+zNQp+u3EtcMxs/IoTNUpECjMaQJ4Yl1e4YVPnspgdqi0Ec9zbWDekf e6E2rncY8mtyhNCA== 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 4AEC413A93; Fri, 9 Sep 2022 14:18:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SHT8CkxLG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:52 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:39 +0200 Message-Id: <20220909141840.18327-10-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.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-6.smtp.seeweb.it Subject: [LTP] [PATCH v5 09/10] shell: Add tests for TST_ALL_FILESYSTEMS=1 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Unfortunately GitHub Actions don't have loop devices, thus cannot be run in CI: tst_format_device 1 TINFO: timeout per run is 0h 5m 0s /__w/ltp/ltp/lib/tst_device.c:139: TINFO: No free devices found Reviewed-by: Cyril Hrubis Reviewed-by: Li Wang Acked-by: Richard Palethorpe Signed-off-by: Petr Vorel --- changes v4->v5: * new test lib/newlib_tests/shell/tst_all_filesystems_skip.sh lib/newlib_tests/shell/tst_all_filesystems.sh | 27 +++++++++++++++++++ .../shell/tst_all_filesystems_skip.sh | 16 +++++++++++ lib/tst_supported_fs_types.c | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 lib/newlib_tests/shell/tst_all_filesystems.sh create mode 100755 lib/newlib_tests/shell/tst_all_filesystems_skip.sh diff --git a/lib/newlib_tests/shell/tst_all_filesystems.sh b/lib/newlib_tests/shell/tst_all_filesystems.sh new file mode 100755 index 000000000..0ee1ab240 --- /dev/null +++ b/lib/newlib_tests/shell/tst_all_filesystems.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel + +TST_ALL_FILESYSTEMS=1 +TST_NEEDS_ROOT=1 +TST_TESTFUNC=test +TST_CNT=2 + +test1() +{ + tst_res TPASS "device using filesystem" +} + +test2() +{ + local pattern="$TST_FS_TYPE" + + if [ "$TST_FS_TYPE_FUSE" = 1 ]; then + pattern="fuseblk" + fi + + EXPECT_PASS "grep -E '$TST_MNTPOINT ($pattern)' /proc/mounts" +} + +. tst_test.sh +tst_run diff --git a/lib/newlib_tests/shell/tst_all_filesystems_skip.sh b/lib/newlib_tests/shell/tst_all_filesystems_skip.sh new file mode 100755 index 000000000..c2e0ba9ff --- /dev/null +++ b/lib/newlib_tests/shell/tst_all_filesystems_skip.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel + +TST_ALL_FILESYSTEMS=1 +TST_NEEDS_ROOT=1 +TST_TESTFUNC=test +TST_SKIP_FILESYSTEMS="btrfs,exfat,ext2,ext3,ext4,fuse,ntfs,vfat,tmpfs,xfs" + +test1() +{ + tst_res TFAIL "test should be skipped with TCONF" +} + +. tst_test.sh +tst_run diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c index 41d9bcd27..35ec82071 100644 --- a/lib/tst_supported_fs_types.c +++ b/lib/tst_supported_fs_types.c @@ -14,7 +14,7 @@ #include "tst_test.h" #include "tst_fs.h" -/* NOTE: new filesystem should be also added to tst_skip_filesystems.sh */ +/* NOTE: new filesystem should be also added to tst_*skip*.sh */ static const char *const fs_type_whitelist[] = { "ext2", "ext3", From patchwork Fri Sep 9 14:18:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1676091 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=Z6fw5kzN; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zJdl+rCa; 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 4MPJ7D1Fl7z1yj1 for ; Sat, 10 Sep 2022 00:20:40 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 299473CAA13 for ; Fri, 9 Sep 2022 16:20:38 +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 B2B013CAA89 for ; Fri, 9 Sep 2022 16:18:55 +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 5EEAF100119F for ; Fri, 9 Sep 2022 16:18:54 +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 08AB21F943; Fri, 9 Sep 2022 14:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662733134; 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=XUyjrMghggyvhcASm6/GN83YNPeS5wEjrIL6nGsTYyk=; b=Z6fw5kzNKXOUs05IifZV1fJgjOc0arEjlNudEAgWA5I9MIAVsGXOWywnGtFs4jUtvMQNEq g8LObkw8QVBkqG3yZFmS5EceHCFq6P8wbmnNCGPyP4xZe3go/OdF0wPZM6DX7LI44IBp4B MljLrRnBkCsAu5fuZnHa9tACOEJHzao= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662733134; 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=XUyjrMghggyvhcASm6/GN83YNPeS5wEjrIL6nGsTYyk=; b=zJdl+rCaW74oP/tavc3A95CUibvXjhKRd3LdFy21z4VLoHgwntOdQQiHDng1tJ3xpDZOrm IgOUmsuQi2aUSjCQ== 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 5CA5113A93; Fri, 9 Sep 2022 14:18:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EFaPFE1LG2NmWAAAMHmgww (envelope-from ); Fri, 09 Sep 2022 14:18:53 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 9 Sep 2022 16:18:40 +0200 Message-Id: <20220909141840.18327-11-pvorel@suse.cz> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909141840.18327-1-pvorel@suse.cz> References: <20220909141840.18327-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 v5 10/10] df01.sh: Convert to TST_ALL_FILESYSTEMS=1 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Reviewed-by: Li Wang Signed-off-by: Petr Vorel --- The same as in v4 runtest/commands | 8 +------- runtest/smoketest | 2 +- testcases/commands/df/df01.sh | 32 +++++++++----------------------- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/runtest/commands b/runtest/commands index 8cfad0449..5ec2c3b69 100644 --- a/runtest/commands +++ b/runtest/commands @@ -14,13 +14,7 @@ ln01_sh ln_tests.sh mkdir01_sh mkdir_tests.sh mv01_sh mv_tests.sh du01_sh du01.sh -df01_ext2_sh df01.sh -f ext2 -df01_ext3_sh df01.sh -f ext3 -df01_ext4_sh df01.sh -f ext4 -df01_xfs_sh df01.sh -f xfs -df01_vfat_sh df01.sh -f vfat -df01_exfat_sh df01.sh -f exfat -df01_ntfs_sh df01.sh -f ntfs +df01_sh df01.sh mkfs01_sh mkfs01.sh mkfs01_ext2_sh mkfs01.sh -f ext2 mkfs01_ext3_sh mkfs01.sh -f ext3 diff --git a/runtest/smoketest b/runtest/smoketest index 485f211fb..83eebfe7b 100644 --- a/runtest/smoketest +++ b/runtest/smoketest @@ -12,7 +12,7 @@ stat04 symlink01 -T stat04 utime01A symlink01 -T utime01 rename01A symlink01 -T rename01 splice02 splice02 -s 20 -df01_ext4_sh df01.sh -f ext4 +df01_sh df01.sh shell_test01 echo "SUCCESS" | shell_pipe01.sh ping602 ping02.sh -6 macsec02 macsec02.sh diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh index 1e86d1c40..ddfa9d9a7 100755 --- a/testcases/commands/df/df01.sh +++ b/testcases/commands/df/df01.sh @@ -6,35 +6,19 @@ # # Test df command with some basic options. +TST_ALL_FILESYSTEMS=1 TST_CNT=12 TST_SETUP=setup TST_TESTFUNC=test -TST_OPTS="f:" -TST_USAGE=usage -TST_PARSE_ARGS=parse_args TST_NEEDS_ROOT=1 -TST_MOUNT_DEVICE=1 - -usage() -{ - cat << EOF -usage: $0 [-f ] - -OPTIONS --f Specify the type of filesystem to be built. If not - specified, the default filesystem type (currently ext2) - is used. -EOF -} - -parse_args() -{ - TST_FS_TYPE="$2" -} setup() { - DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk 'NR==1{print $5}') + DF_FS_TYPE="$TST_FS_TYPE" + + if [ "$TST_FS_TYPE_FUSE" = 1 ]; then + DF_FS_TYPE="fuseblk" + fi } df_test() @@ -180,7 +164,9 @@ test11() test12() { - local cmd="df -x $DF_FS_TYPE -P" + local fs="$DF_FS_TYPE" + + local cmd="df -x $fs -P" df_verify $cmd if [ $? -ne 0 ]; then