3 # ATTENTION! Before editing this file, maybe you can make a
4 # separate script to do your test? We don't want individual
5 # Travis builds to take too long (they time out at 50min and
6 # it's generally unpleasant if the build takes that long.)
7 # If you make a separate matrix entry in .travis.yml it can
10 # NB: the '|| exit $?' workaround is required on old broken versions of bash
11 # that ship with OS X. See https://github.com/haskell/cabal/pull/3624 and
12 # http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
16 # --hide-successes uses terminal control characters which mess up
17 # Travis's log viewer. So just print them all!
20 # To be enabled temporarily when you need to pre-populate the Travis
21 # cache to avoid timeout.
24 # ---------------------------------------------------------------------
26 # ---------------------------------------------------------------------
29 echo -e -n "Usage: `basename $0`\n-j jobs\n"
33 while getopts ":hj:" opt
; do
44 if [ "$OPTARG" = "j" ]; then
49 echo "Invalid option: $OPTARG"
57 # Do not try to use -j with GHC older than 7.8
66 # ---------------------------------------------------------------------
67 # Update the Cabal index
68 # ---------------------------------------------------------------------
72 # ---------------------------------------------------------------------
73 # Install executables if necessary
74 # ---------------------------------------------------------------------
76 #if ! command -v happy; then
77 timed cabal
install $jobs happy
80 # ---------------------------------------------------------------------
81 # Setup our local project
82 # ---------------------------------------------------------------------
84 make cabal-install-monolithic
85 cp cabal.project.travis cabal.project.
local
87 # hackage-repo-tool is a bit touchy to install on GHC 8.0, so instead we
88 # do it via new-build. See also cabal.project.travis. The downside of
89 # doing it this way is that the build product cannot be cached, but
90 # hackage-repo-tool is a relatively small package so it's good.
91 timed cabal unpack hackage-repo-tool-
${HACKAGE_REPO_TOOL_VERSION}
93 # ---------------------------------------------------------------------
95 # ---------------------------------------------------------------------
97 # Needed to work around some bugs in nix-local-build code.
98 export CABAL_BUILDDIR
="${CABAL_BDIR}"
100 if [ "x$CABAL_INSTALL_ONLY" != "xYES" ] ; then
101 # We're doing a full build and test of Cabal
103 # NB: Best to do everything for a single package together as it's
104 # more efficient (since new-build will uselessly try to rebuild
106 timed cabal new-build
$jobs Cabal Cabal
:unit-tests Cabal
:check-tests Cabal
:parser-tests Cabal
:hackage-tests
--enable-tests
109 if [ "$TRAVIS_OS_NAME" = "linux" ]; then
110 # TODO: use new-haddock?
111 (cd Cabal
&& timed cabal act-as-setup
--build-type=Simple
-- haddock
--builddir=${CABAL_BDIR}) ||
exit $?
114 # Check for package warnings
115 (cd Cabal
&& timed cabal check
) ||
exit $?
120 # Build and run the package tests
122 export CABAL_BUILDDIR
="${CABAL_TESTSUITE_BDIR}"
124 # NB: We always build this test runner, because it is used
125 # both by Cabal and cabal-install
126 timed cabal new-build
$jobs cabal-testsuite
:cabal-tests
128 if [ "x$SKIP_TESTS" != "xYES" ]; then
129 (cd cabal-testsuite
&& timed
${CABAL_TESTSUITE_BDIR}/build
/cabal-tests
/cabal-tests
--builddir=${CABAL_TESTSUITE_BDIR} -j3 $TEST_OPTIONS) ||
exit $?
132 # Redo the package tests with different versions of GHC
133 if [ "x$TEST_OTHER_VERSIONS" = "xYES" ]; then
134 (cd cabal-testsuite
&& timed
${CABAL_TESTSUITE_BDIR}/build
/cabal-tests
/cabal-tests
--builddir=${CABAL_TESTSUITE_BDIR} $TEST_OPTIONS --with-ghc="/opt/ghc/7.0.4/bin/ghc")
135 (cd cabal-testsuite
&& timed
${CABAL_TESTSUITE_BDIR}/build
/cabal-tests
/cabal-tests
--builddir=${CABAL_TESTSUITE_BDIR} $TEST_OPTIONS --with-ghc="/opt/ghc/7.2.2/bin/ghc")
136 (cd cabal-testsuite
&& timed
${CABAL_TESTSUITE_BDIR}/build
/cabal-tests
/cabal-tests
--builddir=${CABAL_TESTSUITE_BDIR} $TEST_OPTIONS --with-ghc="/opt/ghc/head/bin/ghc")
141 if [ "x$CABAL_LIB_ONLY" = "xYES" ]; then
142 # If this fails, we WANT to fail, because the tests will not be running then
143 (timed .
/travis
/upload.sh
) ||
exit $?
147 # ---------------------------------------------------------------------
149 # ---------------------------------------------------------------------
151 # Needed to work around some bugs in nix-local-build code.
152 export CABAL_BUILDDIR
="${CABAL_INSTALL_BDIR}"
154 if [ "x$DEBUG_EXPENSIVE_ASSERTIONS" = "xYES" ]; then
155 CABAL_INSTALL_FLAGS
=-fdebug-expensive-assertions
158 # NB: For Travis, we do a *monolithic* build, which means all the
159 # test suites are baked into the cabal binary
160 timed cabal new-build
$jobs $CABAL_INSTALL_FLAGS cabal-install
:cabal
162 timed cabal new-build
$jobs hackage-repo-tool
164 if [ "x$SKIP_TESTS" = "xYES" ]; then
169 timed
${CABAL_INSTALL_EXE} update
172 (cd cabal-testsuite
&& timed
${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests --builddir=${CABAL_TESTSUITE_BDIR} -j3 --skip-setup-tests --with-cabal ${CABAL_INSTALL_EXE} --with-hackage-repo-tool ${HACKAGE_REPO_TOOL_BDIR}/build
/hackage-repo-tool
/hackage-repo-tool
$TEST_OPTIONS) ||
exit $?
175 # TODO: remove -main-is and re-enable me.
176 # (cd cabal-install && timed cabal check) || exit $?
178 if [ "x$TEST_SOLVER_BENCHMARKS" = "xYES" ]; then
179 timed cabal new-build
$jobs solver-benchmarks
:hackage-benchmark solver-benchmarks
:unit-tests
180 timed
${SOLVER_BENCHMARKS_BDIR}/c
/unit-tests
/build
/unit-tests
/unit-tests
$TEST_OPTIONS
184 # TODO: >= 8.4.3 would be nicer
185 if [ "$TRAVIS_OS_NAME" = "linux" -a "$GHCVER" == "8.4.4" ]; then
186 timed cabal new-haddock cabal-install
192 ${CABAL_INSTALL_EXE} --version
194 # If this fails, we WANT to fail, because the tests will not be running then
195 (timed .
/travis
/upload.sh
) ||
exit $?