From: "André Almeida" <andrealmeid@collabora.com>
To: linux-block@vger.kernel.org
Cc: osandov@fb.com, kernel@collabora.com, krisman@collabora.com,
"André Almeida" <andrealmeid@collabora.com>
Subject: [PATCH blktests v2 2/3] check: Add configuration file option
Date: Wed, 30 Oct 2019 19:27:06 -0300 [thread overview]
Message-ID: <20191030222707.10142-3-andrealmeid@collabora.com> (raw)
In-Reply-To: <20191030222707.10142-1-andrealmeid@collabora.com>
Add an option to be possible to use a different configuration file
rather than the default "config" file.
Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
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
--
2.23.0
next prev parent reply other threads:[~2019-10-30 22:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 22:27 [PATCH blktests v2 0/3] Add --config argument for custom config filenames André Almeida
2019-10-30 22:27 ` [PATCH blktests v2 1/3] check: Make "device-only" option a valid option André Almeida
2019-10-30 22:27 ` André Almeida [this message]
2019-10-30 22:27 ` [PATCH blktests v2 3/3] Documentation: Add information about `--config` argument André Almeida
2019-11-13 20:20 ` [PATCH blktests v2 0/3] Add --config argument for custom config filenames Omar Sandoval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191030222707.10142-3-andrealmeid@collabora.com \
--to=andrealmeid@collabora.com \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=linux-block@vger.kernel.org \
--cc=osandov@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.