diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-08-19 13:48:58 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-25 23:03:48 +0100 |
commit | dc3025215bbdcfce9ab08ba621335f6feabe5097 (patch) | |
tree | e17077c6735139248a303430f8873a2c7d0c3af3 /scripts/contrib/build-perf-test-wrapper.sh | |
parent | 7155a9b64d859962b66e338703ff83e1a5040b32 (diff) | |
download | poky-dc3025215bbdcfce9ab08ba621335f6feabe5097.tar.gz |
build-perf-test-wrapper.sh: parse args with getopts
Use getopts for parsing the command line. This changes the usage so that
if a commit (to-be-tested) is defined it must be given by using '-c',
instead of a positional argument.
(From OE-Core rev: b1f77ba41033397a2b25977963682b86f2f76471)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/build-perf-test-wrapper.sh')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index e8e8021d58..8eb4fdbc6c 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -20,17 +20,33 @@ | |||
20 | 20 | ||
21 | script=`basename $0` | 21 | script=`basename $0` |
22 | usage () { | 22 | usage () { |
23 | echo "Usage: $script [COMMITISH]" | 23 | cat << EOF |
24 | Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO] | ||
25 | |||
26 | Optional arguments: | ||
27 | -h show this help and exit. | ||
28 | -c COMMITISH test (checkout) this commit | ||
29 | EOF | ||
24 | } | 30 | } |
25 | 31 | ||
26 | if [ $# -gt 1 ]; then | ||
27 | usage | ||
28 | exit 1 | ||
29 | fi | ||
30 | commitish=$1 | ||
31 | 32 | ||
32 | echo "Running on `uname -n`" | 33 | # Parse command line arguments |
34 | commitish="" | ||
35 | while getopts "hc:" opt; do | ||
36 | case $opt in | ||
37 | h) usage | ||
38 | exit 0 | ||
39 | ;; | ||
40 | c) commitish=$OPTARG | ||
41 | ;; | ||
42 | *) usage | ||
43 | exit 1 | ||
44 | ;; | ||
45 | esac | ||
46 | done | ||
47 | |||
33 | 48 | ||
49 | echo "Running on `uname -n`" | ||
34 | if ! git_topdir=$(git rev-parse --show-toplevel); then | 50 | if ! git_topdir=$(git rev-parse --show-toplevel); then |
35 | echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" | 51 | echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" |
36 | exit 1 | 52 | exit 1 |