From patchwork Tue Oct 29 20:09:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 11218495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8582D13BD for ; Tue, 29 Oct 2019 20:11:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6333D2067D for ; Tue, 29 Oct 2019 20:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbfJ2ULf (ORCPT ); Tue, 29 Oct 2019 16:11:35 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54684 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfJ2ULf (ORCPT ); Tue, 29 Oct 2019 16:11:35 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 487E628F122 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: linux-block@vger.kernel.org Cc: osandov@fb.com, kernel@collabora.com, krisman@collabora.com, =?utf-8?q?A?= =?utf-8?q?ndr=C3=A9_Almeida?= Subject: [PATCH blktests 1/3] check: Add configuration file option Date: Tue, 29 Oct 2019 17:09:40 -0300 Message-Id: <20191029200942.83044-2-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029200942.83044-1-andrealmeid@collabora.com> References: <20191029200942.83044-1-andrealmeid@collabora.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add an option to be possible to use a different configuration file rather than the default "config" file. Signed-off-by: André Almeida --- check | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/check b/check index 981058c..936b0c3 100755 --- a/check +++ b/check @@ -635,6 +635,9 @@ Test runs: -x, --exclude=TEST exclude a test (or test group) from the list of tests to run + -c, --config=FILE use FILE for loading configuration instead of + default 'config' filename. + Miscellaneous: -h, --help display this help message and exit" @@ -650,7 +653,7 @@ Miscellaneous: esac } -if ! TEMP=$(getopt -o 'do:q::x:h' --long 'quick::,exclude:,output:,help' -n "$0" -- "$@"); then +if ! TEMP=$(getopt -o 'do:q::x:c:h' --long 'quick::,exclude:,output:,config:,help' -n "$0" -- "$@"); then exit 1 fi @@ -659,10 +662,8 @@ unset TEMP LOGGER_PROG="$(type -P logger)" || LOGGER_PROG=true -if [[ -r config ]]; then - # shellcheck disable=SC1091 - . config -fi +# true if the default configuration file "config" should be used +DEFAULT_CONFIG=true # Default configuration. : "${DEVICE_ONLY:=0}" @@ -706,6 +707,17 @@ while true; do EXCLUDE+=("$2") shift 2 ;; + '-c'|'--config') + if [[ -r "$2" ]]; then + # shellcheck source=/dev/null + . "$2" + DEFAULT_CONFIG=false + else + echo "Configuration file $2 not found!" + usage err + fi + shift 2 + ;; '-h'|'--help') usage out ;; @@ -719,6 +731,13 @@ while true; do esac done +# if '-c' was not used, try to use the default config file +if [[ -r config ]] && $DEFAULT_CONFIG; then + # shellcheck source=/dev/null + . config +fi + + if [[ $QUICK_RUN -ne 0 && ! "${TIMEOUT:-}" ]]; then _error "QUICK_RUN specified without TIMEOUT" fi From patchwork Tue Oct 29 20:09:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 11218497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30F0A15AB for ; Tue, 29 Oct 2019 20:11:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18A852087E for ; Tue, 29 Oct 2019 20:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbfJ2ULi (ORCPT ); Tue, 29 Oct 2019 16:11:38 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54686 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfJ2ULi (ORCPT ); Tue, 29 Oct 2019 16:11:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id ECC4028FB7E From: =?utf-8?q?Andr=C3=A9_Almeida?= To: linux-block@vger.kernel.org Cc: osandov@fb.com, kernel@collabora.com, krisman@collabora.com, =?utf-8?q?A?= =?utf-8?q?ndr=C3=A9_Almeida?= Subject: [PATCH blktests 2/3] Documentation: Add information about `--config` argument Date: Tue, 29 Oct 2019 17:09:41 -0300 Message-Id: <20191029200942.83044-3-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029200942.83044-1-andrealmeid@collabora.com> References: <20191029200942.83044-1-andrealmeid@collabora.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add information about how to use the argument `--config`. Signed-off-by: André Almeida --- Documentation/running-tests.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md index 675dac7..d5921be 100644 --- a/Documentation/running-tests.md +++ b/Documentation/running-tests.md @@ -21,7 +21,8 @@ will run all tests in the `loop` group and the `block/002` test. Test configuration goes in the `config` file at the top-level directory of the blktests repository. Test configuration options can also be set as environment -variables instead of in the `config` file. +variables instead of in the `config` file. It is also possible to use a +different file for configuration, using `--config=`. ### Test Devices From patchwork Tue Oct 29 20:09:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 11218499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A3DB15AB for ; Tue, 29 Oct 2019 20:11:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 230BA2087E for ; Tue, 29 Oct 2019 20:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726070AbfJ2ULk (ORCPT ); Tue, 29 Oct 2019 16:11:40 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54690 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfJ2ULk (ORCPT ); Tue, 29 Oct 2019 16:11:40 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 8182128FB82 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: linux-block@vger.kernel.org Cc: osandov@fb.com, kernel@collabora.com, krisman@collabora.com, =?utf-8?q?A?= =?utf-8?q?ndr=C3=A9_Almeida?= Subject: [PATCH blktests 3/3] check: Make "device-only" option a valid option Date: Tue, 29 Oct 2019 17:09:42 -0300 Message-Id: <20191029200942.83044-4-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029200942.83044-1-andrealmeid@collabora.com> References: <20191029200942.83044-1-andrealmeid@collabora.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org "--device-only" option is described at the "Usage" help message and it's even parsed as an option by the main code. However, since it's not a parameter of getopt, when trying to use it will trigger a "unrecognized option". Fix that to allow usage of this option. Signed-off-by: André Almeida --- check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check b/check index 936b0c3..6b4c0d0 100755 --- a/check +++ b/check @@ -653,7 +653,7 @@ Miscellaneous: esac } -if ! TEMP=$(getopt -o 'do:q::x:c:h' --long 'quick::,exclude:,output:,config:,help' -n "$0" -- "$@"); then +if ! TEMP=$(getopt -o 'do:q::x:c:h' --long 'device-only,quick::,exclude:,output:,config:,help' -n "$0" -- "$@"); then exit 1 fi