Skip to contentSkip to conversation

build-perf-test: usability improvements

PATCH New Markus Lehtonen 1 participant 3 messages Sep 29, 2016

lore
Share & tools
lore
#0 lore raw

cover build-perf-test: usability improvements

Two small patches that slightly improve the usability of build-perf-test-wrapper.sh script.

Markus Lehtonen (2):
build-perf-test-wrapper.sh: check for positional arguments build-perf-test-wrapper.sh: show defaults for '-a' and '-w'

 scripts/contrib/build-perf-test-wrapper.sh | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
Signature · 1 line
2.6.6
#1 lore raw

PATCH 1/2 build-perf-test-wrapper.sh: check for positional arguments

Stricter checking of command line arguments. The script doesn't use any positional arguments so don't accept any and error out if those are found.

---
 scripts/contrib/build-perf-test-wrapper.sh | 8 ++++++++
 1 file changed, 8 insertions(+)
scripts/contrib/build-perf-test-wrapper.sh +8 -0
index d61e438..90dd545 100755
@@ -57,6 +57,14 @@ while getopts "ha:c:C:w:" opt; do
     esac
 done
 
+# Check positional args
+shift "$((OPTIND - 1))"
+if [ $# -ne 0 ]; then
+    echo "ERROR: No positional args are accepted."
+    usage
+    exit 1
+fi
+
 echo "Running on `uname -n`"
 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`"
Signature · 1 line
2.6.6
#2 lore raw

PATCH 2/2 build-perf-test-wrapper.sh: show defaults for '-a' and '-w'

In reply to Markus Lehtonen

Display default values for '-a' and '-w' command line arguments in the usage help text.

---
 scripts/contrib/build-perf-test-wrapper.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/contrib/build-perf-test-wrapper.sh +4 -2
index 90dd545..97e24d8 100755
@@ -19,6 +19,8 @@
 # oe-build-perf-test and archives the results.
 
 script=`basename $0`
+archive_dir=~/perf-results/archives
+
 usage () {
 cat << EOF
 Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO]
@@ -26,16 +28,16 @@ Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO]
 Optional arguments:
   -h                show this help and exit.
   -a ARCHIVE_DIR    archive results tarball here, give an empty string to
-                    disable tarball archiving
+                    disable tarball archiving (default: $archive_dir)
   -c COMMITISH      test (checkout) this commit
   -C GIT_REPO       commit results into Git
   -w WORK_DIR       work dir for this script
+                    (default: GIT_TOP_DIR/build-perf-test)
 EOF
 }
 
 
 # Parse command line arguments
-archive_dir=~/perf-results/archives
 commitish=""
 while getopts "ha:c:C:w:" opt; do
     case $opt in
Signature · 1 line
2.6.6