From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH OSSTEST 5/5] standalone: Use fail() from mgi-common in most places
Date: Mon, 5 Oct 2015 15:35:08 +0100 [thread overview]
Message-ID: <1444055708-15836-5-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1444055694.5302.9.camel@citrix.com>
Functional change is simply to prepend "$0: ", to change the exit
code for unknown operation and to slightly alter the error message
when no arguments are given.
A few "exit 0" and "exit $rc" remain.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: New patch
---
standalone | 42 ++++++++++++++++--------------------------
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/standalone b/standalone
index 71f656e..dfe631c 100755
--- a/standalone
+++ b/standalone
@@ -58,10 +58,11 @@ Options:
EOF
}
+. ./mgi-common
+
if [ $# -lt 1 ] ; then
- echo "Need an operation" >&2
usage
- exit 1
+ fail "No arguments given"
fi
op=$1 ; shift
@@ -123,7 +124,7 @@ while true ; do
--baseline)nobaseline=n; shift 1;;
--help) usage; exit 0;;
--) shift ; break ;;
- *) echo "Internal error!" ; exit 1 ;;
+ *) fail "Internal error!" ;;
esac
done
@@ -147,34 +148,29 @@ fi
db="standalone.db"
if [ ! -f $db ] ; then
- echo "No $db? Run standalone-reset." >&2
- exit 1
+ fail "No $db? Run standalone-reset."
fi
if [ -z "$config" ] ; then
- echo "No config specified." >&2
- exit 1
+ fail "No config specified."
fi
IFS_saved=$IFS
IFS=:
for c in $config ; do
if [ -z "$c" -o ! -r "$c" ] ; then
- echo "Cannot read config $c." >&2
- exit 1
+ fail "Cannot read config $c."
fi
done
IFS=$IFS_saved
need_flight() {
if [ -z "$flight" ] ; then
- echo "run-job: Need a flight" >&2
- exit 1
+ fail "run-job: Need a flight"
fi
}
need_host() {
if [ "x$hosts" = x ] ; then
- echo "run-job: Need a host" >&2
- exit 1
+ fail "run-job: Need a host"
fi
}
@@ -228,8 +224,7 @@ case $op in
need_flight
if [ $# -lt 1 ] ; then
- echo "make-flight: Need branch" >&2
- exit 1
+ fail "make-flight: Need branch"
fi
branch=$1; shift
@@ -248,8 +243,7 @@ case $op in
need_flight
if [ $# -lt 1 ] ; then
- echo "set-paths: Need job" >&2
- exit 1
+ fail "set-paths: Need job"
fi
job=$1; shift
@@ -276,8 +270,7 @@ case $op in
need_flight;
if [ $# -lt 1 ] ; then
- echo "run-job: Need job" >&2
- exit 1
+ fail "run-job: Need job"
fi
job=$1; shift
@@ -288,8 +281,7 @@ case $op in
need_flight; need_host
if [ $# -lt 1 ] ; then
- echo "run-job: Need job" >&2
- exit 1
+ fail "run-job: Need job"
fi
job=$1; shift
@@ -311,8 +303,7 @@ case $op in
need_flight; need_host
if [ $# -lt 2 ] ; then
- echo "run-test: Need job + test" >&2
- exit 1
+ fail "run-test: Need job + test"
fi
job=$1; shift
@@ -336,8 +327,7 @@ case $op in
need_flight;
if [ $# -ne 1 ] ; then
- echo "get-job-status: Need job" >&2
- exit 1
+ fail "get-job-status: Need job"
fi
job=$1; shift
@@ -346,5 +336,5 @@ case $op in
;;
*)
- echo "Unknown op $op" ; exit 1 ;;
+ fail "Unknown op $op" ;;
esac
--
2.5.3
next prev parent reply other threads:[~2015-10-05 14:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 14:34 [PATCH OSSTEST v3 0/5] Misc standalone wrapper improvements Ian Campbell
2015-10-05 14:35 ` [PATCH OSSTEST 1/5] cs-adjust-flight: `branch' command ought to be `branch-set' Ian Campbell
2015-10-06 14:41 ` Ian Jackson
2015-10-05 14:35 ` [PATCH OSSTEST 2/5] cs-adjust-flight: Add job-status to report job stats Ian Campbell
2015-10-06 14:44 ` Ian Jackson
2015-10-06 14:56 ` Ian Campbell
2015-10-05 14:35 ` [PATCH OSSTEST 3/5] standalone: Check job status at end of run-job Ian Campbell
2015-10-05 14:35 ` [PATCH OSSTEST 4/5] standalone: Make it possible to pass options to run-test Ian Campbell
2015-10-06 14:46 ` Ian Jackson
2015-10-06 14:59 ` Ian Campbell
2015-10-06 15:24 ` Ian Jackson
2015-10-06 15:35 ` Ian Campbell
2015-10-06 15:37 ` Ian Jackson
2015-10-05 14:35 ` Ian Campbell [this message]
2015-10-06 14:46 ` [PATCH OSSTEST 5/5] standalone: Use fail() from mgi-common in most places Ian Jackson
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=1444055708-15836-5-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).