mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
7155a9b64d
commit
dc3025215b
@@ -20,17 +20,33 @@
|
|||||||
|
|
||||||
script=`basename $0`
|
script=`basename $0`
|
||||||
usage () {
|
usage () {
|
||||||
echo "Usage: $script [COMMITISH]"
|
cat << EOF
|
||||||
|
Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO]
|
||||||
|
|
||||||
|
Optional arguments:
|
||||||
|
-h show this help and exit.
|
||||||
|
-c COMMITISH test (checkout) this commit
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
|
||||||
usage
|
# Parse command line arguments
|
||||||
exit 1
|
commitish=""
|
||||||
fi
|
while getopts "hc:" opt; do
|
||||||
commitish=$1
|
case $opt in
|
||||||
|
h) usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
c) commitish=$OPTARG
|
||||||
|
;;
|
||||||
|
*) usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
echo "Running on `uname -n`"
|
echo "Running on `uname -n`"
|
||||||
|
|
||||||
if ! git_topdir=$(git rev-parse --show-toplevel); then
|
if ! git_topdir=$(git rev-parse --show-toplevel); then
|
||||||
echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`"
|
echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user