Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
Davide Pesavento | cbef7b8 | 2019-10-09 00:15:13 -0400 | [diff] [blame] | 4 | nanos() { |
| 5 | # Cannot use date(1) because macOS does not support %N format specifier |
| 6 | python -c 'import time; print(int(time.time() * 1e9))' |
| 7 | } |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 8 | |
Davide Pesavento | cbef7b8 | 2019-10-09 00:15:13 -0400 | [diff] [blame] | 9 | for file in .jenkins.d/*; do |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 10 | [[ -f $file && -x $file ]] || continue |
Davide Pesavento | cbef7b8 | 2019-10-09 00:15:13 -0400 | [diff] [blame] | 11 | |
| 12 | if [[ -n $TRAVIS ]]; then |
| 13 | label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/') |
| 14 | echo -ne "travis_fold:start:${label}\r" |
| 15 | echo -ne "travis_time:start:${label}\r" |
| 16 | start=$(nanos) |
| 17 | fi |
| 18 | |
| 19 | echo "\$ $file" |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 20 | "$file" |
Davide Pesavento | cbef7b8 | 2019-10-09 00:15:13 -0400 | [diff] [blame] | 21 | |
| 22 | if [[ -n $TRAVIS ]]; then |
| 23 | finish=$(nanos) |
| 24 | echo -ne "travis_time:end:${label}:start=${start},finish=${finish},duration=$((finish-start)),event=${label}\r" |
| 25 | echo -ne "travis_fold:end:${label}\r" |
| 26 | fi |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 27 | done |