Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sh2ju use awk instead of bc. #60695

Merged
merged 1 commit into from
Mar 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions third_party/forked/shell2junit/sh2ju.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function juLog() {
# calculate vars
asserts=$(($asserts+1))
errors=$(($errors+$err))
time=`echo "${end} - ${ini}" | bc -l`
total=`echo "${total} + ${time}" | bc -l`
time=`echo "${end} ${ini}" | awk '{print $1 - $2}'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't we also just use bash arithmetic?

echo $((${end} - ${ini}))
echo $((${total} + ${time}))

I checked in the busybox image and this seems to work and is more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since the times are floating points. Bash doesn't have floating point arithmetic.

total=`echo "${total} ${time}" | awk '{print $1 + $2}'`

# write the junit xml report
## failure tag
Expand Down