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