Skip to content

Commit

Permalink
TASK_THRESHOLD -> COMMAND_THRESHOLD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed Jul 27, 2018
1 parent a61cca7 commit de32984
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ matrix:
# job which also includes "make requirements" and other steps
# "make requirements" can take substantially lower if the cache is purged
# and this would cause too many intermediate failures / false positives
- env: TASK=ci-unit TASK_THRESHOLD=640 # 10.8 minutes
- env: TASK=ci-unit COMMAND_THRESHOLD=640 # 10.8 minutes
python: 2.7
name: "Unit Tests (Python 2.7)"
- env: TASK=ci-integration TASK_THRESHOLD=670 # 11.1 minutes
- env: TASK=ci-integration COMMAND_THRESHOLD=670 # 11.1 minutes
python: 2.7
name: "Integration Tests (Python 2.7)"
- env: TASK="ci-checks ci-packs-tests" TASK_THRESHOLD=210 # 3.5 minutes
- env: TASK="ci-checks ci-packs-tests" COMMAND_THRESHOLD=210 # 3.5 minutes
python: 2.7
name: "Lint Checks, Packs Tests (Python 2.7)"
- env: TASK="compilepy3 ci-py3-unit" CACHE_NAME=py3 TASK_THRESHOLD=685 # 11.4 minutes
- env: TASK="compilepy3 ci-py3-unit" CACHE_NAME=py3 COMMAND_THRESHOLD=685 # 11.4 minutes
python: 3.6
name: "Unit Tests (Python 3.6)"
- env: TASK="ci-py3-integration" CACHE_NAME=py3 TASK_THRESHOLD=310 # 5.1 minutes
- env: TASK="ci-py3-integration" CACHE_NAME=py3 COMMAND_THRESHOLD=310 # 5.1 minutes
python: 3.6
name: "Integration Tests (Python 3.6)"
addons:
Expand Down Expand Up @@ -103,7 +103,7 @@ before_script:
script:
# NOTE: We enable code coverage and per test timing information on master so build can take twice
# as long as PR builds
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then TASK_THRESHOLD=$(expr ${TASK_THRESHOLD} \* 2); fi; ./scripts/travis/time-command.sh "make ${TASK}" ${TASK_THRESHOLD}
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then COMMAND_THRESHOLD=$(expr ${COMMAND_THRESHOLD} \* 2); fi; ./scripts/travis/time-command.sh "make ${TASK}" ${COMMAND_THRESHOLD}
# NOTE: We only generate and submit coverage report for master and version branches
# NOTE: We put this here and not after_success so build is marked as failed if this step fails
# See https://docs.travis-ci.com/user/customizing-the-build/#breaking-the-build
Expand Down
10 changes: 5 additions & 5 deletions scripts/travis/time-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ GREEN=`tput setaf 2`
RESET=`tput sgr0`

BASH_COMMAND_STRING=$1
TASK_THRESHOLD=$2
COMMAND_THRESHOLD=$2

START_TS=$(date +%s)

# Run the actual task
echo "Running ${BASH_COMMAND_STRING} (TASK_THRESHOLD=${TASK_THRESHOLD}s)"
echo "Running ${BASH_COMMAND_STRING} (COMMAND_THRESHOLD=${COMMAND_THRESHOLD}s)"

eval "${BASH_COMMAND_STRING}"
EXIT_CODE=$?
Expand All @@ -41,11 +41,11 @@ END_TS=$(date +%s)
DURATION=$(expr ${END_TS} - ${START_TS})

echo ""
echo "Command \"${BASH_COMMAND_STRING}\" duration: ${DURATION}s (TASK_THRESHOLD=${TASK_THRESHOLD}s)"
echo "Command \"${BASH_COMMAND_STRING}\" duration: ${DURATION}s (COMMAND_THRESHOLD=${COMMAND_THRESHOLD}s)"
echo ""

if [ "${TASK_THRESHOLD}" ] && [ ${TASK_THRESHOLD} -lt ${DURATION} ]; then
>&2 echo "${RED}Command ${RED_ON_WHITE}${BASH_COMMAND_STRING}${RESET}${RED} took longer than ${RED_ON_WHITE}${TASK_THRESHOLD}${RESET}${RED} seconds, failing the build."
if [ "${COMMAND_THRESHOLD}" ] && [ ${COMMAND_THRESHOLD} -lt ${DURATION} ]; then
>&2 echo "${RED}Command ${RED_ON_WHITE}${BASH_COMMAND_STRING}${RESET}${RED} took longer than ${RED_ON_WHITE}${COMMAND_THRESHOLD}${RESET}${RED} seconds, failing the build."
>&2 echo "This likely means that a regression has been introduced in the code / tests which significantly slows things down."
>&2 echo "If you think it's an intermediate error, re-run the tests."
>&2 echo "If you think it's a legitimate duration increase, bump the threshold in .travis.yml.${RESET}"
Expand Down

0 comments on commit de32984

Please sign in to comment.