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
5fe4d279
Unverified
Commit
5fe4d279
authored
Jan 25, 2018
by
Christoph Blecker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Produce junit results for verify job
parent
a624b946
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
14 deletions
+34
-14
verify.sh
hack/make-rules/verify.sh
+14
-3
sh2ju.sh
third_party/forked/shell2junit/sh2ju.sh
+20
-11
No files found.
hack/make-rules/verify.sh
View file @
5fe4d279
...
@@ -21,6 +21,9 @@ set -o pipefail
...
@@ -21,6 +21,9 @@ set -o pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../..
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../..
source
"
${
KUBE_ROOT
}
/hack/lib/util.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/util.sh"
# include shell2junit library
source
"
${
KUBE_ROOT
}
/third_party/forked/shell2junit/sh2ju.sh"
# Excluded check patterns are always skipped.
# Excluded check patterns are always skipped.
EXCLUDED_PATTERNS
=(
EXCLUDED_PATTERNS
=(
"verify-all.sh"
# this script calls the make rule and would cause a loop
"verify-all.sh"
# this script calls the make rule and would cause a loop
...
@@ -69,11 +72,19 @@ function is-quick {
...
@@ -69,11 +72,19 @@ function is-quick {
}
}
function
run-cmd
{
function
run-cmd
{
local
filename
=
"
${
2
##*/verify-
}
"
local
testname
=
"
${
filename
%%.*
}
"
local
output
=
"
${
KUBE_JUNIT_REPORT_DIR
:-
/tmp/junit-results
}
"
local tr
if
${
SILENT
}
;
then
if
${
SILENT
}
;
then
"
$@
"
&> /dev/null
juLog
-output
=
"
${
output
}
"
-class
=
"verify"
-name
=
"
${
testname
}
"
"
$@
"
&> /dev/null
tr
=
$?
else
else
"
$@
"
juLog
-output
=
"
${
output
}
"
-class
=
"verify"
-name
=
"
${
testname
}
"
"
$@
"
tr
=
$?
fi
fi
return
${
tr
}
}
}
# Collect Failed tests in this Array , initalize it to nil
# Collect Failed tests in this Array , initalize it to nil
...
@@ -149,7 +160,7 @@ run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
...
@@ -149,7 +160,7 @@ run-checks "${KUBE_ROOT}/hack/verify-*.sh" bash
run-checks
"
${
KUBE_ROOT
}
/hack/verify-*.py"
python
run-checks
"
${
KUBE_ROOT
}
/hack/verify-*.py"
python
if
[[
${
ret
}
-eq
1
]]
;
then
if
[[
${
ret
}
-eq
1
]]
;
then
print-failed-tests
print-failed-tests
fi
fi
exit
${
ret
}
exit
${
ret
}
...
...
third_party/forked/shell2junit/sh2ju.sh
View file @
5fe4d279
...
@@ -32,6 +32,15 @@ juDIR=`pwd`/results
...
@@ -32,6 +32,15 @@ juDIR=`pwd`/results
# The name of the suite is calculated based in your script name
# The name of the suite is calculated based in your script name
suite
=
""
suite
=
""
if
LANG
=
C
sed
--help
2>&1 |
grep
-q
GNU
;
then
SED
=
"sed"
elif
which gsed &>/dev/null
;
then
SED
=
"gsed"
else
echo
"Failed to find GNU sed as sed or gsed. If you are on Mac: brew install gnu-sed."
>
&2
exit
1
fi
# A wrapper for the eval method witch allows catching seg-faults and use tee
# A wrapper for the eval method witch allows catching seg-faults and use tee
errfile
=
/tmp/evErr.
$$
.log
errfile
=
/tmp/evErr.
$$
.log
function
eVal
()
{
function
eVal
()
{
...
@@ -57,11 +66,11 @@ function juLog() {
...
@@ -57,11 +66,11 @@ function juLog() {
ya
=
""
;
icase
=
""
ya
=
""
;
icase
=
""
while
[
-z
"
$ya
"
]
;
do
while
[
-z
"
$ya
"
]
;
do
case
"
$1
"
in
case
"
$1
"
in
-name
=
*
)
name
=
`
echo
"
$1
"
|
sed
-e
's/-name=//'
`
;
shift
;;
-name
=
*
)
name
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-name=//'
`
;
shift
;;
-class
=
*
)
class
=
`
echo
"
$1
"
|
sed
-e
's/-class=//'
`
;
shift
;;
-class
=
*
)
class
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-class=//'
`
;
shift
;;
-ierror
=
*
)
ereg
=
`
echo
"
$1
"
|
sed
-e
's/-ierror=//'
`
;
icase
=
"-i"
;
shift
;;
-ierror
=
*
)
ereg
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-ierror=//'
`
;
icase
=
"-i"
;
shift
;;
-error
=
*
)
ereg
=
`
echo
"
$1
"
|
sed
-e
's/-error=//'
`
;
shift
;;
-error
=
*
)
ereg
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-error=//'
`
;
shift
;;
-output
=
*
)
juDIR
=
`
echo
"
$1
"
|
sed
-e
's/-output=//'
`
;
shift
;;
-output
=
*
)
juDIR
=
`
echo
"
$1
"
|
${
SED
}
-e
's/-output=//'
`
;
shift
;;
*
)
ya
=
1
;;
*
)
ya
=
1
;;
esac
esac
done
done
...
@@ -108,7 +117,7 @@ function juLog() {
...
@@ -108,7 +117,7 @@ function juLog() {
# set the appropriate error, based in the exit code and the regex
# 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'
`
out
=
`
cat
$outf
|
${
SED
}
-e
's/^\([^+]\)/| \1/g'
`
if
[
$err
=
0
-a
-n
"
$ereg
"
]
;
then
if
[
$err
=
0
-a
-n
"
$ereg
"
]
;
then
H
=
`
echo
"
$out
"
| egrep
$icase
"
$ereg
"
`
H
=
`
echo
"
$out
"
| egrep
$icase
"
$ereg
"
`
[
-n
"
$H
"
]
&&
err
=
1
[
-n
"
$H
"
]
&&
err
=
1
...
@@ -148,14 +157,14 @@ $errMsg
...
@@ -148,14 +157,14 @@ $errMsg
if
[[
-e
"
$juDIR
/junit_
$suite
.xml"
]]
;
then
if
[[
-e
"
$juDIR
/junit_
$suite
.xml"
]]
;
then
# file exists. first update the failures count
# file exists. first update the failures count
failCount
=
`
sed
-n
"s/.*testsuite.*failures=
\"\(
[0-9]*
\)\"
.*/
\1
/p"
"
$juDIR
/junit_
$suite
.xml"
`
failCount
=
`
${
SED
}
-n
"s/.*testsuite.*failures=
\"\(
[0-9]*
\)\"
.*/
\1
/p"
"
$juDIR
/junit_
$suite
.xml"
`
errors
=
$((
$failCount
+
$errors
))
errors
=
$((
$failCount
+
$errors
))
sed
-i
"0,/failures=
\"
$failCount
\"
/ s/failures=
\"
$failCount
\"
/failures=
\"
$errors
\"
/"
"
$juDIR
/junit_
$suite
.xml"
${
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"
${
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.
# 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^</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^</testsuites>^^g"
$juDIR
/junit_
$suite
.xml
cat
<<
EOF
>> "
$juDIR
/junit_
$suite
.xml"
cat
<<
EOF
>> "
$juDIR
/junit_
$suite
.xml"
$content
$content
</testsuite>
</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