Merge pull request #4262 from Ericson2314/needed-exes-only
[cabal.git] / travis-common.sh
blobe9def1faddb5ce2e01f091fb3d442e626aaef8ee
1 set -e
3 HACKAGE_REPO_TOOL_VERSION="0.1.1"
4 CABAL_VERSION="1.25.0.0"
6 # ---------------------------------------------------------------------
7 # Timing / diagnostic output
8 # ---------------------------------------------------------------------
10 JOB_START_TIME=$(date +%s)
12 timed() {
13 echo "\$ $*"
14 start_time=$(date +%s)
16 # Run the job
17 $* || exit $?
19 # Calculate the durations
20 end_time=$(date +%s)
21 duration=$((end_time - start_time))
22 total_duration=$((end_time - JOB_START_TIME))
24 # Print them
25 echo "$* took $duration seconds."
26 echo "whole job took $total_duration seconds so far."
28 # Terminate on OSX
29 if [ $total_duration -ge 2400 -a $(uname) = "Darwin" ]; then
30 echo "Job taking over 40 minutes. Terminating"
31 exit 1
33 echo "----"