Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9e719d8d
Unverified
Commit
9e719d8d
authored
Feb 17, 2019
by
Bob Killen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix shellcheck lint errors in third_party/forked/shell2junit/sh2ju.sh
parent
ca554325
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
.shellcheck_failures
hack/.shellcheck_failures
+0
-1
sh2ju.sh
third_party/forked/shell2junit/sh2ju.sh
+25
-25
No files found.
hack/.shellcheck_failures
View file @
9e719d8d
...
...
@@ -96,7 +96,6 @@
./test/images/volume/gluster/run_gluster.sh
./test/images/volume/iscsi/create_block.sh
./test/images/volume/nfs/run_nfs.sh
./third_party/forked/shell2junit/sh2ju.sh
./third_party/intemp/intemp.sh
./third_party/multiarch/qemu-user-static/register/qemu-binfmt-conf.sh
./third_party/multiarch/qemu-user-static/register/register.sh
third_party/forked/shell2junit/sh2ju.sh
View file @
9e719d8d
...
...
@@ -24,10 +24,10 @@
###
asserts
=
00
;
errors
=
0
;
total
=
0
;
content
=
""
date
=
`
which gdate 2>/dev/null
||
which
date
`
date
=
"
$(
which gdate 2>/dev/null
||
which
date
)
"
# default output folder
juDIR
=
`
pwd
`
/results
juDIR
=
"
$(
pwd
)
/results"
# The name of the suite is calculated based in your script name
suite
=
""
...
...
@@ -59,18 +59,18 @@ function juLogClean() {
function
juLog
()
{
suite
=
""
;
errfile
=
/tmp/evErr.
$$
.log
date
=
`
which gdate 2>/dev/null
||
which
date
`
date
=
"
$(
which gdate 2>/dev/null
||
which
date
)
"
asserts
=
00
;
errors
=
0
;
total
=
0
;
content
=
""
# parse arguments
ya
=
""
;
icase
=
""
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
;;
-ierror
=
*
)
ereg
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-ierror=//'
`
;
icase
=
"-i"
;
shift
;;
-error
=
*
)
ereg
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-error=//'
`
;
shift
;;
-output
=
*
)
juDIR
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-output=//'
`
;
shift
;;
-name
=
*
)
name
=
"
$(
echo
"
$1
"
|
${
SED
}
-e
's/-name=//'
)
"
;
shift
;;
-class
=
*
)
class
=
"
$(
echo
"
$1
"
|
${
SED
}
-e
's/-class=//'
)
"
;
shift
;;
-ierror
=
*
)
ereg
=
"
$(
echo
"
$1
"
|
${
SED
}
-e
's/-ierror=//'
)
"
;
icase
=
"-i"
;
shift
;;
-error
=
*
)
ereg
=
"
$(
echo
"
$1
"
|
${
SED
}
-e
's/-error=//'
)
"
;
shift
;;
-output
=
*
)
juDIR
=
"
$(
echo
"
$1
"
|
${
SED
}
-e
's/-output=//'
)
"
;
shift
;;
*
)
ya
=
1
;;
esac
done
...
...
@@ -101,37 +101,37 @@ function juLog() {
# eval the command sending output to a file
outf
=
/var/tmp/ju
$$
.txt
errf
=
/var/tmp/ju
$$
-err
.txt
>
${
outf
}
:
>
${
outf
}
echo
""
|
tee
-a
${
outf
}
echo
"+++ Running case:
${
class
}
.
${
name
}
"
|
tee
-a
${
outf
}
echo
"+++ working dir:
"
`
pwd
`
|
tee
-a
${
outf
}
echo
"+++ working dir:
$(
pwd
)
"
|
tee
-a
${
outf
}
echo
"+++ command:
${
cmd
}
"
|
tee
-a
${
outf
}
ini
=
`
${
date
}
+%s.%N
`
ini
=
"
$(${
date
}
+%s.%N
)
"
# execute the command, temporarily swapping stderr and stdout so they can be tee'd to separate files,
# then swapping them back again so that the streams are written correctly for the invoking process
(
(
eVal
"
${
cmd
}
"
|
tee
-a
${
outf
}
)
3>&1 1>&2 2>&3 |
tee
${
errf
}
)
3>&1 1>&2 2>&3
evErr
=
`
cat
${
errfile
}
`
evErr
=
"
$(
cat
${
errfile
})
"
rm
-f
${
errfile
}
end
=
`
${
date
}
+%s.%N
`
end
=
"
$(${
date
}
+%s.%N
)
"
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
out
=
`
cat
$outf
|
${
SED
}
-e
's/^\([^+]\)/| \1/g'
`
if
[
${
err
}
=
0
-a
-n
"
${
ereg
:-}
"
]
;
then
H
=
`
echo
"
${
out
}
"
| egrep
${
icase
}
"
${
ereg
}
"
`
out
=
"
$(${
SED
}
-e
's/^\([^+]\)/| \1/g'
"
$outf
"
)
"
if
[
${
err
}
=
0
]
&&
[
-n
"
${
ereg
:-}
"
]
;
then
H
=
$(
echo
"
${
out
}
"
|
grep
-E
${
icase
}
"
${
ereg
}
"
)
[[
-n
"
${
H
}
"
]]
&&
err
=
1
fi
[[
${
err
}
!=
0
]]
&&
echo
"+++ error:
${
err
}
"
|
tee
-a
${
outf
}
rm
-f
${
outf
}
errMsg
=
`
cat
${
errf
}
`
errMsg
=
$(
cat
${
errf
})
rm
-f
${
errf
}
# calculate vars
asserts
=
$((
$
asserts
+
1
))
errors
=
$((
$errors
+
$
err
))
time
=
`
echo
"
${
end
}
${
ini
}
"
|
awk
'{print $1 - $2}'
`
total
=
`
echo
"
${
total
}
${
time
}
"
|
awk
'{print $1 + $2}'
`
asserts
=
$((
asserts+1
))
errors
=
$((
errors+
err
))
time
=
$(
echo
"
${
end
}
${
ini
}
"
|
awk
'{print $1 - $2}'
)
total
=
$(
echo
"
${
total
}
${
time
}
"
|
awk
'{print $1 + $2}'
)
# write the junit xml report
## failure tag
...
...
@@ -149,14 +149,14 @@ function juLog() {
if
[[
-e
"
${
juDIR
}
/junit_
${
suite
}
.xml"
]]
;
then
# file exists. first update the failures count
failCount
=
`
${
SED
}
-n
"s/.*testsuite.*failures=
\"\(
[0-9]*
\)\"
.*/
\1
/p"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
`
errors
=
$((
$failCount
+
$
errors
))
failCount
=
$(${
SED
}
-n
"s/.*testsuite.*failures=
\"\(
[0-9]*
\)\"
.*/
\1
/p"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
)
errors
=
$((
failCount+
errors
))
${
SED
}
-i
"0,/failures=
\"
${
failCount
}
\"
/ s/failures=
\"
${
failCount
}
\"
/failures=
\"
${
errors
}
\"
/"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
${
SED
}
-i
"0,/errors=
\"
${
failCount
}
\"
/ s/errors=
\"
${
failCount
}
\"
/errors=
\"
${
errors
}
\"
/"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
# file exists. Need to append to it. If we remove the testsuite end tag, we can just add it in after.
${
SED
}
-i
"s^</testsuite>^^g"
${
juDIR
}
/junit_
${
suite
}
.xml
## remove testSuite so we can add it later
${
SED
}
-i
"s^</testsuites>^^g"
${
juDIR
}
/junit_
${
suite
}
.xml
${
SED
}
-i
"s^</testsuite>^^g"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
## remove testSuite so we can add it later
${
SED
}
-i
"s^</testsuites>^^g"
"
${
juDIR
}
/junit_
${
suite
}
.xml"
cat
<<
EOF
>> "
$juDIR
/junit_
$suite
.xml"
${
content
:-}
</testsuite>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment