8000 [travis] Add timing info by nicolas-grekas · Pull Request #23972 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[travis] Add timing info #23972

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

Merged
merged 1 commit into from
Aug 25, 2017
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
[travis] Add timing info
  • Loading branch information
nicolas-grekas committed Aug 24, 2017
commit 51d210e2c03fa16af11d9a04c9e8a8ddac7a2f3b
33 changes: 28 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,38 @@ before_install:
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'

nanoseconds() {
local cmd="date"
local format="+%s%N"
local os=$(uname)
if hash gdate > /dev/null 2>&1; then
cmd="gdate"
elif [[ "$os" = Darwin ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't test on macOS (yet) right?

Copy link
Member Author

Choose a reason for hiding this comment

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

right, I just borrowed this code from elsewhere

format="+%s000000000"
fi
$cmd -u $format
}
export -f nanoseconds

# tfold is a helper to create folded reports
tfold () {
title=$1
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
local title=$1
local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
shift
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
bash -xc "$*" 2>&1 &&
local id=$(printf %08x $(( RANDOM * RANDOM )))
local start=$(nanoseconds)
echo -e "travis_fold:start:$fold"
echo -e "travis_time:start:$id"
echo -e "\\e[1;34m$title\\e[0m"

bash -xc "$*" 2>&1
local ok=$?
local end=$(nanoseconds)
echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
(exit $ok) &&
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
echo -e "\\e[41mKO\\e[0m $title\\n"
(exit $ok)
}
export -f tfold

Expand Down
0