Skip to content

Commit

Permalink
rename junit file
Browse files Browse the repository at this point in the history
  • Loading branch information
freehan committed Jun 29, 2016
1 parent a5c1e02 commit 586bb1f
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 @@ -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
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 586bb1f

Please sign in to comment.