Skip to content

Commit

Permalink
Merge pull request kubernetes#47614 from mengqiy/fix_naming
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

fix naming for testgrid to pick up cmd test junit

Fixes kubernetes#47613

The file name for testgrid to pick up should match regex `'junit(_[^_]+)?(_\d+-\d+)?(_\d+)?.xml'`
Name before is `junit-test-cmd.xml`
Name after is `junit_test-cmd.xml`

```release-note
NONE
```

/assign @krzyzacy
  • Loading branch information
Kubernetes Submit Queue authored Jul 20, 2017
2 parents 9e5eb70 + fa91eb4 commit ec2fa9d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions third_party/forked/shell2junit/sh2ju.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,25 @@ $errMsg
"
## testsuite block

if [[ -e "$juDIR/junit-$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/junit-$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/junit-$suite.xml"
sed -i "0,/errors=\"$failCount\"/ s/errors=\"$failCount\"/errors=\"$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"

# 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
cat <<EOF >> "$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>
</testsuites>
EOF

else
# no file exists. Adding a new file
cat <<EOF > "$juDIR/junit-$suite.xml"
cat <<EOF > "$juDIR/junit_$suite.xml"
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite failures="$errors" assertions="$assertions" name="$suite" tests="1" errors="$errors" time="$total">
Expand Down

0 comments on commit ec2fa9d

Please sign in to comment.