From patchwork Thu Jun 9 21:42: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: 12876007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B9EBCCA473 for ; Thu, 9 Jun 2022 21:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233619AbiFIVmk (ORCPT ); Thu, 9 Jun 2022 17:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05F266213 for ; Thu, 9 Jun 2022 14:42:32 -0700 (PDT) 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 8467122080; Thu, 9 Jun 2022 21:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810951; 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=2hlxC/7qz3rkqiEMmnuUy2kFg97wCcOEWXRVX3/7MpQ=; b=Eg2pN7mNipAkGNH0v/qDyuXDMQOMvsYudPDSko5jEUk9tVSteKTLCvRabHsOvzBSLTrPDm rzT4b3sI5d0kCvq/WV0vMs9eAgoE9VQnoG+NffBmKNx7HTa2s4F26zaLdWCefNKrn60nD4 0Y80FoQs0Hr53QaBUKwq4qOjWZdf9ao= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810951; 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=2hlxC/7qz3rkqiEMmnuUy2kFg97wCcOEWXRVX3/7MpQ=; b=gmuKW6KYu2nWa3tAocxR1p7YelLXNHY1koQsJRjTapuWdUk9yrWe673V+03dnhnK5MDH4B egAscXyUgfV1CdBg== 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 F210813A8C; Thu, 9 Jun 2022 21:42:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4CZSOEZpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:30 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org, Cyril Hrubis Subject: [PATCH v2 1/9] tst_test.sh: Add $TST_MOUNT_DEVICE Date: Thu, 9 Jun 2022 23:42:15 +0200 Message-Id: <20220609214223.4608-2-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Reviewed-by: Cyril Hrubis Signed-off-by: Petr Vorel --- doc/shell-test-api.txt | 2 ++ testcases/lib/tst_test.sh | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt index df5ebbdf0..65444541e 100644 --- a/doc/shell-test-api.txt +++ b/doc/shell-test-api.txt @@ -214,6 +214,8 @@ simply by setting right '$TST_FOO'. 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 https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#formatting-device-with-a-filesystem[Formatting device with a filesystem]. +| 'TST_MOUNT_DEVICE' | Mount device, see + https://github.com/linux-test-project/ltp/wiki/Shell-Test-API#mounting-and-unmounting-filesystems[Mounting and unmounting filesystems]. | 'TST_NEEDS_ROOT' | Exit the test with 'TCONF' unless executed under root. Alternatively the 'tst_require_root' command can be used. | 'TST_NEEDS_TMPDIR' | Create test temporary directory and cd into it. diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index c6e0752f3..740115385 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -41,6 +41,10 @@ _tst_do_exit() fi fi + if [ "$TST_MOUNT_FLAG" = 1 ]; then + tst_umount + fi + if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then if ! tst_device release "$TST_DEVICE"; then tst_res TWARN "Failed to release device '$TST_DEVICE'" @@ -632,7 +636,7 @@ tst_run() NET_SKIP_VARIABLE_INIT|NEEDS_CHECKPOINTS);; CHECKPOINT_WAIT|CHECKPOINT_WAKE);; CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);; - DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE);; + DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";; esac done @@ -666,6 +670,7 @@ tst_run() _tst_setup_timer + [ "$TST_MOUNT_DEVICE" = 1 ] && TST_FORMAT_DEVICE=1 [ "$TST_FORMAT_DEVICE" = 1 ] && TST_NEEDS_DEVICE=1 [ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1 @@ -702,6 +707,11 @@ tst_run() 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 + [ -n "$TST_NEEDS_CHECKPOINTS" ] && _tst_init_checkpoints if [ -n "$TST_SETUP" ]; then From patchwork Thu Jun 9 21:42:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A686BC433EF for ; Thu, 9 Jun 2022 21:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbiFIVmj (ORCPT ); Thu, 9 Jun 2022 17:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233619AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F9F663DE for ; Thu, 9 Jun 2022 14:42:33 -0700 (PDT) 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 32E5A1FEAC; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810952; 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=6HrRVZFTBvoOPs9/0Zi/jcFYEykhb5yK/tjBbBcJcPk=; b=xcPukXRpHO7MLo8W7PQU30ZvNtcPgk6y5CgRWB5X747ZaeTaTl68F4t9rGoii06N/tHEz2 2rz7nOlpFIz6yfTFXWqwBjZAzn6MPO7i5rmXd1Bhc/hk4pP1VlNB2WRma9aNBvYXfWBBXi bo8P4PT+0GJ9nIYKlT1QMWOXnBwqcjY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810952; 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=6HrRVZFTBvoOPs9/0Zi/jcFYEykhb5yK/tjBbBcJcPk=; b=RjREvChVpKmQ1kHl/DLH+n1pGaxTuyaLj+nvPVKikeyWDEkqmzLDt9HdBCTn46o70abbpE cBz87A1YJSx+RaAQ== 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 9405C13A8C; Thu, 9 Jun 2022 21:42:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cNU+IUdpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:31 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org, Cyril Hrubis Subject: [PATCH v2 2/9] df01.sh: Use TST_MOUNT_DEVICE=1 Date: Thu, 9 Jun 2022 23:42:16 +0200 Message-Id: <20220609214223.4608-3-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Reviewed-by: Cyril Hrubis Signed-off-by: Petr Vorel --- testcases/commands/df/df01.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh index f74032c96..976e205bf 100755 --- a/testcases/commands/df/df01.sh +++ b/testcases/commands/df/df01.sh @@ -1,19 +1,19 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2015 Fujitsu Ltd. +# Copyright (c) 2018-2022 Petr Vorel # Author: Zhang Jin # # Test df command with some basic options. TST_CNT=12 TST_SETUP=setup -TST_CLEANUP=tst_umount TST_TESTFUNC=test TST_OPTS="f:" TST_USAGE=usage TST_PARSE_ARGS=parse_args TST_NEEDS_ROOT=1 -TST_FORMAT_DEVICE=1 +TST_MOUNT_DEVICE=1 usage() { @@ -34,7 +34,6 @@ parse_args() setup() { - tst_mount DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk 'NR==1{print $5}') } From patchwork Thu Jun 9 21:42:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3038CCA47F for ; Thu, 9 Jun 2022 21:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiFIVmk (ORCPT ); Thu, 9 Jun 2022 17:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236561AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C206B66AEE for ; Thu, 9 Jun 2022 14:42:33 -0700 (PDT) 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 6F11222090; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810952; 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=K+4tIzneSRbXDM3XWl74zqNPPnbr/cbhyDXTom6R6N0=; b=PpoWsU0EZiOXdsvjzNaAyJo3Jd+xt+eqFNyhKXsPIXPHxgUiPJanWO/413ibxGWs/GGpZk EWCQvv+PYo9qALto9V/Wh3Lgt0xmOWTzxZu/l0ch2rEib22b59OMKtoHQ31evoLsACmuaa suwyRx9zgmKeX+uwBhtIegv1+p29SSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810952; 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=K+4tIzneSRbXDM3XWl74zqNPPnbr/cbhyDXTom6R6N0=; b=3SX7rRT5VMOHkTxEegGUO59CLRfnqshwRCUYrH1WAAkKcjVHXxJkY/LjHqa9Qv1RSKlxKP a0o+wcRhxuqkTdCg== 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 3F5D513A8C; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IF9BDUhpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:32 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org Subject: [PATCH v2 3/9] tst_test.sh: allow ' in pattern for allowed variables Date: Thu, 9 Jun 2022 23:42:17 +0200 Message-Id: <20220609214223.4608-4-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org to allow using '... $TST_FOO' i.e. without filtering ' EXPECT_PASS "grep '$TST_MNTPOINT $TST_FS_TYPE' /proc/mounts" would produce warning: tst_mount_device 1 TWARN: Reserved variable TST_FS_TYPE' used! because sed filters it as: FS_TYPE' Will be needed for next commit. Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- 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 740115385..f9ff9bcb4 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -621,7 +621,7 @@ tst_run() local _tst_name if [ -n "$TST_TEST_PATH" ]; then - for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do + for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[='\''"} \t\/:`].*//'); do case "$_tst_i" in DISABLE_APPARMOR|DISABLE_SELINUX);; SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);; From patchwork Thu Jun 9 21:42:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50D56CCA47E for ; Thu, 9 Jun 2022 21:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbiFIVml (ORCPT ); Thu, 9 Jun 2022 17:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240947AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE0266AFF for ; Thu, 9 Jun 2022 14:42:34 -0700 (PDT) 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 AE4AA22092; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810952; 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=+SpySMpIkDvxeJ1RUXK/TNx+Rm+cOYvSZrYO0PARRl0=; b=pQTDjTrIX27/MwZ9OWhJhZ7k55vRIUGPICZVMN4gpAWvY/KSMsfh3LdUS/qvGO5C4y2NGb 7sCUe4qeXHhpEZ6YCFDkdmHgSc13KFfaW38PH2+6TLcY1784TFOABLWazBE96VVJoZywnV 9qe0YvWiSfQtBMDhcmHu6QXhUqkXJhg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810952; 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=+SpySMpIkDvxeJ1RUXK/TNx+Rm+cOYvSZrYO0PARRl0=; b=dqy4H3ml6Ot7SpMynXj+lah4b/8mLfVS2KbIDCLY050Cc0rDaUpieA86DOXvaWgsSHl+rA 6ZNRIBL6v55vECCw== 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 7942313A8C; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +NOkG0hpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:32 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org, Cyril Hrubis Subject: [PATCH v2 4/9] shell: Add test for TST_MOUNT_DEVICE=1 Date: Thu, 9 Jun 2022 23:42:18 +0200 Message-Id: <20220609214223.4608-5-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 Signed-off-by: Petr Vorel --- lib/newlib_tests/shell/tst_mount_device.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 lib/newlib_tests/shell/tst_mount_device.sh diff --git a/lib/newlib_tests/shell/tst_mount_device.sh b/lib/newlib_tests/shell/tst_mount_device.sh new file mode 100755 index 000000000..c8f185626 --- /dev/null +++ b/lib/newlib_tests/shell/tst_mount_device.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Petr Vorel + +TST_MOUNT_DEVICE=1 +TST_FS_TYPE=ext4 +TST_TESTFUNC=test +TST_CNT=2 + +test1() +{ + EXPECT_PASS "cd $TST_MNTPOINT" +} + +test2() +{ + EXPECT_PASS "grep '$TST_MNTPOINT $TST_FS_TYPE' /proc/mounts" +} + +. tst_test.sh +tst_run From patchwork Thu Jun 9 21:42:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876010 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08479C433EF for ; Thu, 9 Jun 2022 21:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236561AbiFIVmm (ORCPT ); Thu, 9 Jun 2022 17:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241840AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712EE66C8C for ; Thu, 9 Jun 2022 14:42:34 -0700 (PDT) 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 E964822093; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810952; 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=RZ0Hq0qm8ipf5wo4yqdMM0malZSmthJnC8vJcwZJ4SE=; b=0mUdtwNTFU4FNTwhpOKcB0rLQAKxG/d/k0BnzmQQ8q/J3QSOPx/4fZNaq14H95XwjYA/Dc xnfHViYcnL8khybUtIZCuZuRmN/PdwdoYUChHQG0/shLEzlHdNWxozpUGkUOEBLmSUwOfc w9mNh02MgmfXWCiFK+dII2kZOmGL5VQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810952; 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=RZ0Hq0qm8ipf5wo4yqdMM0malZSmthJnC8vJcwZJ4SE=; b=KjeDzG4ggOzqqJ0h0bZ+nb5DRP2sGXJPRNYam0GRgydSnvmMZ4ZwbgaOJSJl2TVF7G/PoR C8sKB+ao3XxSN4Cg== 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 B8DF813A8C; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2DMoK0hpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:32 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org Subject: [PATCH v2 5/9] tst_test.sh: Add $TST_ALL_FILESYSTEMS Date: Thu, 9 Jun 2022 23:42:19 +0200 Message-Id: <20220609214223.4608-6-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Petr Vorel --- doc/shell-test-api.txt | 1 + testcases/lib/tst_test.sh | 106 ++++++++++++++++++++++++-------------- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/doc/shell-test-api.txt b/doc/shell-test-api.txt index 65444541e..93073be13 100644 --- a/doc/shell-test-api.txt +++ b/doc/shell-test-api.txt @@ -199,6 +199,7 @@ 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). | '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, diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index f9ff9bcb4..d96ce3448 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -28,23 +28,12 @@ fi trap "tst_brk TBROK 'test interrupted'" INT trap "unset _tst_setup_timer_pid; tst_brk TBROK 'test terminated'" TERM +# FIXME: debug called more times => check things moved out of it _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 - if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then if ! tst_device release "$TST_DEVICE"; then tst_res TWARN "Failed to release device '$TST_DEVICE'" @@ -61,8 +50,6 @@ _tst_do_exit() rm $LTP_IPC_PATH fi - _tst_cleanup_timer - if [ $TST_FAIL -gt 0 ]; then ret=$((ret|1)) fi @@ -613,17 +600,41 @@ _tst_init_checkpoints() export LTP_IPC_PATH } +_prepare_device() +{ + if [ "$TST_FORMAT_DEVICE" = 1 ]; then + tst_clear_device $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() +{ + for _tst_fs in $(tst_supported_fs); do + tst_res TINFO "Testing on $_tst_fs" + TST_FS_TYPE="$_tst_fs" + _prepare_device + _tst_run_iterations + done +} + tst_run() { local _tst_i local _tst_data + local _tst_fs local _tst_max local _tst_name if [ -n "$TST_TEST_PATH" ]; then for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[='\''"} \t\/:`].*//'); 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);; @@ -668,12 +679,23 @@ tst_run() tst_brk TCONF "test requires kernel $TST_MIN_KVER+" fi - _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_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 + fi + if [ "$TST_NEEDS_TMPDIR" = 1 ]; then if [ -z "$TMPDIR" ]; then export TMPDIR="/tmp" @@ -684,35 +706,30 @@ 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}" + [ -z "$TST_ALL_FILESYSTEMS" ] && _prepare_device - TST_DEVICE_FLAG=1 + if [ -n "$TST_ALL_FILESYSTEMS" ]; 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 - 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 + _tst_setup_timer if [ -n "$TST_SETUP" ]; then if command -v $TST_SETUP >/dev/null 2>/dev/null; then @@ -724,7 +741,7 @@ 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)) @@ -735,9 +752,22 @@ tst_run() 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 + fi + + _tst_cleanup_timer } _tst_run_tests() From patchwork Thu Jun 9 21:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13278C43334 for ; Thu, 9 Jun 2022 21:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240947AbiFIVmp (ORCPT ); Thu, 9 Jun 2022 17:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243378AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E0BE66CA7 for ; Thu, 9 Jun 2022 14:42:34 -0700 (PDT) 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 34F721FEAF; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810953; 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=lg3+kMHDoOC5AiOpaP8JlSQdjMtlWF34C+hOQNw/yTs=; b=mYYNKIv2knFYiXBNRNxk/3Y/td20GA8Osla77NcsBTUI25bQP9waUC3K3aR3f9OmkFLwK8 L30a/2q/cFsWIEgNLVzEckDDkOblyzzyrq3w1hCTJcV9oLlp2Dl6mVFWTDisxCnaE38fOb h8yNlEcqxf//N4tG/SMC9PPGcGxqJl0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810953; 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=lg3+kMHDoOC5AiOpaP8JlSQdjMtlWF34C+hOQNw/yTs=; b=PI66gB9W78PVwxe5X98odS0u6dC5sODVMk5ymzaaxTtaXXTTLv/1QRq19RtdOj3ozoWLIA 7uLZieJEZMWZL2AQ== 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 F3D2F13A8C; Thu, 9 Jun 2022 21:42:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SBDDOUhpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:32 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org Subject: [PATCH v2 6/9] tst_device: Remove unnecessary braces Date: Thu, 9 Jun 2022 23:42:20 +0200 Message-Id: <20220609214223.4608-7-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org to keep checkpatch.pl happy. Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- testcases/lib/tst_device.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index 2a3ab1222..d6b74a5ff 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -40,11 +40,10 @@ static int acquire_device(int argc, char *argv[]) } } - if (argc >= 4) { + if (argc >= 4) device = tst_acquire_loop_device(size, argv[3]); - } else { + else device = tst_acquire_device__(size); - } if (!device) return 1; From patchwork Thu Jun 9 21:42:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADDF2CCA473 for ; Thu, 9 Jun 2022 21:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239775AbiFIVmn (ORCPT ); Thu, 9 Jun 2022 17:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239526AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5360E66CAA for ; Thu, 9 Jun 2022 14:42:35 -0700 (PDT) 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 D4B4A22091; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810953; 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=1hrv4TBYgQiiDQzAMJuRcEJYK6Fsk+bBkGixpkqTdrg=; b=beFHBqPDfNmv747aSXkHCkv1rumqF8ZzGLOCggc1TQP6YWlWzjVR2mB/uTf04fMC7CWR6u l8LItaUc3nLgfWJS4V9igdNN3ktjW1O38YDftqJjikN3Icj5ELdwyjpsAJzEtkYsS/+dqI NJM+UhMOaMN7Ipl54WmI7rqIQfdt3c4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810953; 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=1hrv4TBYgQiiDQzAMJuRcEJYK6Fsk+bBkGixpkqTdrg=; b=sdF0lNGtPoLZUjeDpeuleInQvcctbpC9vXZmgVbZ+yCiyZYwz+UowM4ly0ZcU1o/xnn0ti A+SUpuIL+jS9CEBg== 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 3CD0E13A8C; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aAa2DUlpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:33 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , Steve Dickson , linux-nfs@vger.kernel.org, Chuck Lever , "J . Bruce Fields" , Trond Myklebust , Alexey Kodanev Subject: [PATCH v2 7/9] tst_device: Add clear command Date: Thu, 9 Jun 2022 23:42:21 +0200 Message-Id: <20220609214223.4608-8-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org clearing block device will be needed for TST_ALL_FILESYSTEMS implementation in shell API. Now we clear device during acquire, but we will reuse this device for each tested filesystem, thus we need a separate command for it. Signed-off-by: Petr Vorel Reviewed-by: Cyril Hrubis --- testcases/lib/tst_device.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c index d6b74a5ff..45f77a38b 100644 --- a/testcases/lib/tst_device.c +++ b/testcases/lib/tst_device.c @@ -18,8 +18,10 @@ 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 acquire [size [filename]]\n"); + fprintf(stderr, "tst_device release /path/to/device\n"); + fprintf(stderr, "tst_device clear /path/to/device\n\n"); } static int acquire_device(int argc, char *argv[]) @@ -72,6 +74,17 @@ static int release_device(int argc, char *argv[]) return tst_detach_device(argv[2]); } +static int clear_device(int argc, char *argv[]) +{ + if (argc != 3) + return 1; + + if (tst_clear_device(argv[2])) + return 1; + + return 0; +} + int main(int argc, char *argv[]) { /* @@ -94,6 +107,9 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[1], "release")) { if (release_device(argc, argv)) goto help; + } else if (!strcmp(argv[1], "clear")) { + if (clear_device(argc, argv)) + goto help; } else { fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[1]); goto help; From patchwork Thu Jun 9 21:42:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC87C43334 for ; Thu, 9 Jun 2022 21:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234022AbiFIVml (ORCPT ); Thu, 9 Jun 2022 17:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239775AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8643C66CB1 for ; Thu, 9 Jun 2022 14:42:35 -0700 (PDT) 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 26BC61FEC9; Thu, 9 Jun 2022 21:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810954; 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=iRYXycbQVHb8+YRDCK3WyfDOxADDfcwyvcEPl1e9rpM=; b=2J8rrVyUu77q0YnOYu6IeZ9sqXYr8Ir8fBejjzVWAQWSGamlyqvN+7+MTPiqa6jkKTyOtB nXCuS1gs2NU1c2FAK0U2nxHXa857SdSoQUdPCcRDDGBoynxJn3SC/S7/2mXtm0bE78Eud3 R6QBdEA7pBm/kYhu58F3pQoASH1UzF8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810954; 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=iRYXycbQVHb8+YRDCK3WyfDOxADDfcwyvcEPl1e9rpM=; b=lefvLvPxfH7CyZh7D012fa0YLaE9oIKx5z5uRdrJtVtBMtQqGuTqvWbxzuPBSPYARlm7Kf Ve9aGYBSpgj1lpBg== 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 E3F9313A8C; Thu, 9 Jun 2022 21:42:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wC+UNUlpomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:33 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org, Cyril Hrubis Subject: [PATCH v2 8/9] shell: Add test for TST_ALL_FILESYSTEMS=1 Date: Thu, 9 Jun 2022 23:42:22 +0200 Message-Id: <20220609214223.4608-9-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 Signed-off-by: Petr Vorel --- lib/newlib_tests/shell/tst_all_filesystems.sh | 27 +++++++++++++++++++ testcases/lib/tst_test.sh | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 lib/newlib_tests/shell/tst_all_filesystems.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..8509a7481 --- /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_TESTFUNC=test +TST_CNT=2 + +test1() +{ + tst_res TPASS "device using filesystem" +} + +test2() +{ + local pattern + + + if [ "$TST_FS_TYPE" = "exfat" -o "$TST_FS_TYPE" = "ntfs" ]; then + pattern="|fuseblk" + fi + + EXPECT_PASS "grep -E '$TST_MNTPOINT ($TST_FS_TYPE${pattern})' /proc/mounts" +} + +. tst_test.sh +tst_run diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index d96ce3448..27f698dab 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -603,7 +603,7 @@ _tst_init_checkpoints() _prepare_device() { if [ "$TST_FORMAT_DEVICE" = 1 ]; then - tst_clear_device $TST_DEVICE + tst_device clear "$TST_DEVICE" tst_mkfs $TST_FS_TYPE $TST_DEV_FS_OPTS $TST_DEVICE $TST_DEV_EXTRA_OPTS fi From patchwork Thu Jun 9 21:42:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 12876012 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB26CCA47E for ; Thu, 9 Jun 2022 21:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239526AbiFIVmo (ORCPT ); Thu, 9 Jun 2022 17:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241999AbiFIVmi (ORCPT ); Thu, 9 Jun 2022 17:42:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABFB866CB4 for ; Thu, 9 Jun 2022 14:42:35 -0700 (PDT) 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 637611FED0; Thu, 9 Jun 2022 21:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654810954; 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=Ou4b2uw8GMytBNI/2irjvNV6al/t73iXIzF0aCsPw20=; b=NrOk083Ob306Q3MP0igsyFn1Mdt/0NVYb/u4y57zfPxWmxE3u62Bi8fZZWtSZAMG2SgbTs qx5d09EHT+mUgFJUTm+zCjftTOhGC3gU579g29HEKKa/zaSiWliFKPSiLGhSiA3ibpgu10 wRb2+7/bakPxspfJBPEm/hWqFaT5ltI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654810954; 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=Ou4b2uw8GMytBNI/2irjvNV6al/t73iXIzF0aCsPw20=; b=/EB0/mR9ViRUIPPZCIIPQYZ699U9gG5a5N37tdSBDoedGIkQaV8Hbc/X5l6uDz++pEyLEE QEOUS0vWIM4J8BAw== 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 2F3AB13A8C; Thu, 9 Jun 2022 21:42:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kDvLCUppomIQDgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 21:42:34 +0000 From: Petr Vorel To: ltp@lists.linux.it Cc: Petr Vorel , linux-nfs@vger.kernel.org Subject: [RFC][PATCH v2 9/9] nfs: Use TST_ALL_FILESYSTEMS=1 Date: Thu, 9 Jun 2022 23:42:23 +0200 Message-Id: <20220609214223.4608-10-pvorel@suse.cz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220609214223.4608-1-pvorel@suse.cz> References: <20220609214223.4608-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Petr Vorel --- Hi NFS developers, your comments are welcome. This is an effort how to support NFS tests on all filesystems available on SUT. Using $TST_MNTPOINT means test run in loop, each time different filesystem is used. It's implemented via formatted loop device (the same way as in LTP C API). Code is also at: https://github.com/pevik/ltp/tree/shell/all_filesystems.v2 But this requires restarting NFS server (otherwise legacy testcases/lib/daemonlib.sh would have to be used), which is IMHO not optimal. Without that (or only run 'systemctl reload nfs-server' or exportfs -r on remote side) it cannot be umounted after testing - debugging with fuser, code at: https://github.com/pevik/ltp/commit/3656d035d43445a107154ef397ef1db2fad2c4f0 The problem is that loop device is still referenced by nfs server and thus cannot be unmounted. Can this be somehow fixed? Is it even wanted to have tests on loop device (the only reasonable way to support more filesystems)? Also tests will run much longer (we could filter out some filesystems not supported, if there are any). # LTP_SINGLE_FS_TYPE=ext2 PATH="/opt/ltp/testcases/bin:$PATH" nfs07.sh -v 3 -t tcp -i3 ## NOTE: testing itself is OK nfs07 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface nfs07 1 TINFO: add local addr 10.0.0.2/24 nfs07 1 TINFO: add local addr fd00:1:1:1::2/64 nfs07 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface nfs07 1 TINFO: add remote addr 10.0.0.1/24 nfs07 1 TINFO: add remote addr fd00:1:1:1::1/64 nfs07 1 TINFO: Network config (local -- remote): nfs07 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 nfs07 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 nfs07 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 tst_device.c:89: TINFO: Found free device 0 '/dev/loop0' tst_supported_fs_types.c:148: TINFO: WARNING: testing only ext2 tst_supported_fs_types.c:89: TINFO: Kernel supports ext2 tst_supported_fs_types.c:51: TINFO: mkfs.ext2 does exist nfs07 1 TINFO: Testing on ext2 nfs07 1 TINFO: Formatting ext2 with opts='/dev/loop0' nfs07 1 TINFO: timeout per run is 0h 5m 0s nfs07 1 TINFO: mount.nfs: (linux nfs-utils 2.6.1) nfs07 1 TINFO: setup NFSv3, socket type tcp nfs07 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=3 10.0.0.2:/tmp/LTP_nfs07.A3PIB82iUv/mntpoint/3/tcp /tmp/LTP_nfs07.A3PIB82iUv/mntpoint/3/0 nfs07 1 TPASS: All files and directories were correctly listed nfs07 2 TPASS: All files and directories were correctly listed nfs07 3 TPASS: All files and directories were correctly listed nfs07 4 TINFO: Cleaning up testcase ## DEBUGGING CODE in nfs_cleanup() nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w ($TST_TMPDIR) USER PID ACCESS COMMAND /tmp/LTP_nfs07.P1XS9smc5w: root kernel mount /tmp root 2125 ..c.. tst_timeout_kil nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w/mntpoint ($TST_MNTPOINT) USER PID ACCESS COMMAND /tmp/LTP_nfs07.P1XS9smc5w/mntpoint: root kernel mount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0 USER PID ACCESS COMMAND /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0: root kernel mount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0 ## from nfs_cleanup() ## grep -q "$local_dir" /proc/mounts && umount $local_dir nfs07 4 TINFO: umount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0 umount: /tmp/LTP_nfs07.P1XS9smc5w/mntpoint: target is busy. ## The rest is not relevant as the problem is above ## tst_umount from tst_test.sh trying hard to umount nfs07 4 TINFO: umount(/tmp/LTP_nfs07.P1XS9smc5w/mntpoint) failed, try 1 ... nfs07 4 TINFO: Likely gvfsd-trash is probing newly mounted fs, kill it to speed up tests. umount: /tmp/LTP_nfs07.P1XS9smc5w/mntpoint: target is busy. nfs07 4 TINFO: umount(/tmp/LTP_nfs07.P1XS9smc5w/mntpoint) failed, try 2 ... nfs07 4 TINFO: Likely gvfsd-trash is probing newly mounted fs, kill it to speed up tests. ... nfs07 4 TINFO: umount(/tmp/LTP_nfs07.P1XS9smc5w/mntpoint) failed, try 50 ... nfs07 4 TINFO: Likely gvfsd-trash is probing newly mounted fs, kill it to speed up tests. nfs07 4 TWARN: Failed to umount(/tmp/LTP_nfs07.P1XS9smc5w/mntpoint) after 50 retries ## if ! tst_device release "$TST_DEVICE"; then in _tst_do_exit() in tst_test.sh tst_device.c:255: TWARN: ioctl(/dev/loop1, LOOP_CLR_FD, 0) no ENXIO for too long Usage tst_device acquire [size [filename]] tst_device release /path/to/device tst_device clear /path/to/device ## rm -r "$TST_TMPDIR" in _tst_do_exit() in tst_test.sh nfs07 4 TWARN: Failed to release device '/dev/loop1' rm: cannot remove '/tmp/LTP_nfs07.P1XS9smc5w/mntpoint': Device or resource busy rm: cannot remove '/tmp/LTP_nfs07.P1XS9smc5w/mntpoint': Device or resource busy nfs07 4 TINFO: AppArmor enabled, this may affect test results nfs07 4 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root) nfs07 4 TINFO: loaded AppArmor profiles: none Kind regards, Petr testcases/network/nfs/nfs_stress/nfs_lib.sh | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index af7d46a21..a6557177b 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -28,7 +28,7 @@ NFS_PARSE_ARGS_CALLER="$TST_PARSE_ARGS" TST_OPTS="v:t:$TST_OPTS" TST_PARSE_ARGS=nfs_parse_args TST_USAGE=nfs_usage -TST_NEEDS_TMPDIR=1 +TST_ALL_FILESYSTEMS=1 TST_NEEDS_ROOT=1 TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs mount.nfs" TST_SETUP="${TST_SETUP:-nfs_setup}" @@ -63,7 +63,7 @@ nfs_get_remote_path() done v=${1:-$v} - echo "$TST_TMPDIR/$v/$type" + echo "$TST_MNTPOINT/$v/$type" } nfs_server_udp_enabled() @@ -162,8 +162,8 @@ nfs_setup() tst_brk TCONF "UDP support disabled on NFS server" fi - local_dir="$TST_TMPDIR/$i/$n" - remote_dir="$TST_TMPDIR/$i/$type" + local_dir="$TST_MNTPOINT/$i/$n" + remote_dir="$TST_MNTPOINT/$i/$type" mkdir -p $local_dir nfs_setup_server $(($$ + n)) @@ -174,7 +174,7 @@ nfs_setup() done if [ "$n" -eq 1 ]; then - cd ${VERSION}/0 + cd $TST_MNTPOINT/$VERSION/0 fi } @@ -190,19 +190,22 @@ nfs_cleanup() local n=0 for i in $VERSION; do - local_dir="$TST_TMPDIR/$i/$n" - grep -q "$local_dir" /proc/mounts && umount $local_dir + type=$(get_socket_type $n) + remote_dir="$TST_MNTPOINT/$i/$type" + tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" + tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" n=$(( n + 1 )) done n=0 for i in $VERSION; do - type=$(get_socket_type $n) - remote_dir="$TST_TMPDIR/$i/$type" - tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir" - tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir" + local_dir="$TST_MNTPOINT/$i/$n" + + grep -q "$local_dir" /proc/mounts && umount $local_dir n=$(( n + 1 )) done + + systemctl restart nfs-server } . tst_net.sh