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