mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
rename junit file
This commit is contained in:
parent
a5c1e02e0e
commit
586bb1f028
16
third_party/forked/shell2junit/sh2ju.sh
vendored
16
third_party/forked/shell2junit/sh2ju.sh
vendored
@ -43,7 +43,7 @@ function eVal() {
|
||||
# Method to clean old tests
|
||||
function juLogClean() {
|
||||
echo "+++ Removing old junit reports from: $juDIR "
|
||||
rm -f "$juDIR"/TEST-*
|
||||
rm -f "$juDIR"/junit-*
|
||||
}
|
||||
|
||||
# Execute a command and record its results
|
||||
@ -151,23 +151,23 @@ $errMsg
|
||||
"
|
||||
## testsuite block
|
||||
|
||||
if [[ -e "$juDIR/TEST-$suite.xml" ]]; then
|
||||
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/TEST-$suite.xml"`
|
||||
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/TEST-$suite.xml"
|
||||
sed -i "0,/errors=\"$failCount\"/ s/errors=\"$failCount\"/errors=\"$errors\"/" "$juDIR/TEST-$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"
|
||||
|
||||
# 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/TEST-$suite.xml ## remove testSuite so we can add it later
|
||||
cat <<EOF >> "$juDIR/TEST-$suite.xml"
|
||||
sed -i "s^</testsuite>^^g" $juDIR/junit-$suite.xml ## remove testSuite so we can add it later
|
||||
cat <<EOF >> "$juDIR/junit-$suite.xml"
|
||||
$content
|
||||
</testsuite>
|
||||
EOF
|
||||
|
||||
else
|
||||
# no file exists. Adding a new file
|
||||
cat <<EOF > "$juDIR/TEST-$suite.xml"
|
||||
cat <<EOF > "$juDIR/junit-$suite.xml"
|
||||
<testsuite failures="$errors" assertions="$assertions" name="$suite" tests="1" errors="$errors" time="$total">
|
||||
$content
|
||||
</testsuite>
|
||||
|
Loading…
Reference in New Issue
Block a user