From patchwork Wed Oct 30 22:27:05 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: 11220155 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 EC8931390 for ; Wed, 30 Oct 2019 22:28:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D406B20874 for ; Wed, 30 Oct 2019 22:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbfJ3W2k (ORCPT ); Wed, 30 Oct 2019 18:28:40 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39730 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfJ3W2k (ORCPT ); Wed, 30 Oct 2019 18:28:40 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 29E3F28F109 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 v2 1/3] check: Make "device-only" option a valid option Date: Wed, 30 Oct 2019 19:27:05 -0300 Message-Id: <20191030222707.10142-2-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030222707.10142-1-andrealmeid@collabora.com> References: <20191030222707.10142-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 981058c..a19b9dc 100755 --- a/check +++ b/check @@ -650,7 +650,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:h' --long 'device-only,quick::,exclude:,output:,help' -n "$0" -- "$@"); then exit 1 fi From patchwork Wed Oct 30 22:27:06 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: 11220157 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 9C3EE13B1 for ; Wed, 30 Oct 2019 22:28:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AA1B20874 for ; Wed, 30 Oct 2019 22:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbfJ3W2n (ORCPT ); Wed, 30 Oct 2019 18:28:43 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39732 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfJ3W2m (ORCPT ); Wed, 30 Oct 2019 18:28:42 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 9D59C28F108 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 v2 2/3] check: Add configuration file option Date: Wed, 30 Oct 2019 19:27:06 -0300 Message-Id: <20191030222707.10142-3-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030222707.10142-1-andrealmeid@collabora.com> References: <20191030222707.10142-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 a19b9dc..97a3c97 100755 --- a/check +++ b/check @@ -635,6 +635,10 @@ 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. Note that, for multiple + uses of this option, all files will be loaded. + Miscellaneous: -h, --help display this help message and exit" @@ -650,7 +654,7 @@ Miscellaneous: esac } -if ! TEMP=$(getopt -o 'do:q::x:h' --long 'device-only,quick::,exclude:,output:,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 @@ -659,10 +663,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 +708,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 +732,12 @@ 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 Wed Oct 30 22:27:07 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: 11220159 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 A03A613B1 for ; Wed, 30 Oct 2019 22:28:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88A2220874 for ; Wed, 30 Oct 2019 22:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726710AbfJ3W2p (ORCPT ); Wed, 30 Oct 2019 18:28:45 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39736 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfJ3W2p (ORCPT ); Wed, 30 Oct 2019 18:28:45 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id DA75D28FF50 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 v2 3/3] Documentation: Add information about `--config` argument Date: Wed, 30 Oct 2019 19:27:07 -0300 Message-Id: <20191030222707.10142-4-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030222707.10142-1-andrealmeid@collabora.com> References: <20191030222707.10142-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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md index 675dac7..2f71e18 100644 --- a/Documentation/running-tests.md +++ b/Documentation/running-tests.md @@ -21,7 +21,9 @@ 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=`. Note that, for +multiple uses of this option, all files will be loaded. ### Test Devices