Skip to content

Commit

Permalink
Add brackets and quotes where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
cblecker committed Jan 26, 2018
1 parent 670505e commit 3bcc6e9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions third_party/forked/shell2junit/sh2ju.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ errfile=/tmp/evErr.$$.log
function eVal() {
(eval "$1")
# stdout and stderr may currently be inverted (see below) so echo may write to stderr
echo $? 2>&1 | tr -d "\n" > ${errfile}
echo "$?" 2>&1 | tr -d "\n" > "${errfile}"
}

# Method to clean old tests
Expand All @@ -64,7 +64,7 @@ function juLog() {

# parse arguments
ya=""; icase=""
while [ -z "$ya" ]; do
while [[ -z "$ya" ]]; do
case "$1" in
-name=*) name=`echo "$1" | ${SED} -e 's/-name=//'`; shift;;
-class=*) class=`echo "$1" | ${SED} -e 's/-class=//'`; shift;;
Expand All @@ -78,7 +78,7 @@ function juLog() {
# create output directory
mkdir -p "${juDIR}" || exit
# use first arg as name if it was not given
if [ -z "${name}" ]; then
if [[ -z "${name}" ]]; then
name="${asserts}-$1"
shift
fi
Expand All @@ -90,9 +90,9 @@ function juLog() {
suite=${class}

# calculate command to eval
[ -z "$1" ] && return
[[ -z "$1" ]] && return
cmd="$1"; shift
while [ -n "${1:-}" ]
while [[ -n "${1:-}" ]]
do
cmd="${cmd} \"$1\""
shift
Expand All @@ -116,13 +116,13 @@ function juLog() {
echo "+++ exit code: ${evErr}" | tee -a ${outf}

# set the appropriate error, based in the exit code and the regex
[ ${evErr} != 0 ] && err=1 || err=0
[[ ${evErr} != 0 ]] && err=1 || err=0
out=`cat $outf | ${SED} -e 's/^\([^+]\)/| \1/g'`
if [ ${err} = 0 -a -n "${ereg:-}" ]; then
H=`echo "${out}" | egrep ${icase} "${ereg}"`
[ -n "${H}" ] && err=1
[[ -n "${H}" ]] && err=1
fi
[ ${err} != 0 ] && echo "+++ error: ${err}" | tee -a ${outf}
[[ ${err} != 0 ]] && echo "+++ error: ${err}" | tee -a ${outf}
rm -f ${outf}

errMsg=`cat ${errf}`
Expand All @@ -135,7 +135,7 @@ function juLog() {

# write the junit xml report
## failure tag
[ ${err} = 0 ] && failure="" || failure="
[[ ${err} = 0 ]] && failure="" || failure="
<failure type=\"ScriptError\" message=\"Script Error\">
<![CDATA[
${errMsg}
Expand Down Expand Up @@ -183,5 +183,5 @@ EOF
EOF
fi

return $err
return ${err}
}

0 comments on commit 3bcc6e9

Please sign in to comment.