Disallow parsing quoted versions with old parser (#4066)
[cabal.git] / travis-script.sh
blobf4eb91f11c91bb732d58965f6f5eeec770cd2fe4
1 #!/bin/sh
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
8 # be run in parallel.
10 . ./travis-common.sh
12 CABAL_STORE_DB="${HOME}/.cabal/store/ghc-${GHCVER}/package.db"
13 CABAL_LOCAL_DB="${PWD}/dist-newstyle/packagedb/ghc-${GHCVER}"
14 CABAL_BDIR="${PWD}/dist-newstyle/build/Cabal-${CABAL_VERSION}"
15 CABAL_TESTSUITE_BDIR="${PWD}/dist-newstyle/build/cabal-testsuite-${CABAL_VERSION}"
16 CABAL_INSTALL_BDIR="${PWD}/dist-newstyle/build/cabal-install-${CABAL_VERSION}"
17 CABAL_INSTALL_SETUP="${CABAL_INSTALL_BDIR}/setup/setup"
18 # --hide-successes uses terminal control characters which mess up
19 # Travis's log viewer. So just print them all!
20 TEST_OPTIONS=""
22 # ---------------------------------------------------------------------
23 # Update the Cabal index
24 # ---------------------------------------------------------------------
26 timed cabal update
28 # ---------------------------------------------------------------------
29 # Install happy if necessary
30 # ---------------------------------------------------------------------
32 if ! command -v happy; then
33 timed cabal install happy
36 # ---------------------------------------------------------------------
37 # Setup our local project
38 # ---------------------------------------------------------------------
40 cp cabal.project.travis cabal.project.local
42 # ---------------------------------------------------------------------
43 # Cabal
44 # ---------------------------------------------------------------------
46 # Needed to work around some bugs in nix-local-build code.
47 export CABAL_BUILDDIR="${CABAL_BDIR}"
49 # NB: Best to do everything for a single package together as it's
50 # more efficient (since new-build will uselessly try to rebuild
51 # Cabal otherwise).
52 if [ "x$PARSEC" = "xYES" ]; then
53 timed cabal new-build -fparsec Cabal Cabal:unit-tests Cabal:parser-tests Cabal:parser-hackage-tests
54 else
55 timed cabal new-build Cabal Cabal:unit-tests
58 # NB: the '|| exit $?' workaround is required on old broken versions of bash
59 # that ship with OS X. See https://github.com/haskell/cabal/pull/3624 and
60 # http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
62 # Run tests
63 (cd Cabal && timed ${CABAL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
65 if [ "x$PARSEC" = "xYES" ]; then
66 # Parser unit tests
67 (cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-tests $TEST_OPTIONS) || exit $?
69 # Test we can parse Hackage
70 (cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-hackage-tests $TEST_OPTIONS) | tail || exit $?
73 # Run haddock (hack: use the Setup script from package-tests!)
74 (cd Cabal && timed cabal act-as-setup --build-type=Simple -- haddock --builddir=${CABAL_BDIR}) || exit $?
76 # Check for package warnings
77 (cd Cabal && timed cabal check) || exit $?
79 unset CABAL_BUILDDIR
81 # Build and run the package tests
83 export CABAL_BUILDDIR="${CABAL_TESTSUITE_BDIR}"
85 timed cabal new-build cabal-testsuite:package-tests
87 (cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/package-tests/package-tests $TEST_OPTIONS) || exit $?
89 # Redo the package tests with different versions of GHC
90 if [ "x$TEST_OTHER_VERSIONS" = "xYES" ]; then
91 (export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.0.4/bin/ghc"; \
92 cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/package-tests/package-tests $TEST_OPTIONS)
93 (export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.2.2/bin/ghc"; \
94 cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/package-tests/package-tests $TEST_OPTIONS)
95 (export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/head/bin/ghc"; \
96 cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/package-tests/package-tests $TEST_OPTIONS)
99 unset CABAL_BUILDDIR
101 if [ "x$CABAL_LIB_ONLY" = "xYES" ]; then
102 exit 0;
105 # ---------------------------------------------------------------------
106 # cabal-install
107 # ---------------------------------------------------------------------
109 # Needed to work around some bugs in nix-local-build code.
110 export CABAL_BUILDDIR="${CABAL_INSTALL_BDIR}"
112 timed cabal new-build cabal-install:cabal \
113 cabal-install:integration-tests \
114 cabal-install:integration-tests2 \
115 cabal-install:unit-tests \
116 cabal-install:solver-quickcheck
118 # The integration-tests2 need the hackage index, and need it in the secure
119 # format, which is not necessarily the default format of the bootstrap cabal.
120 # If the format does match then this will be very quick.
121 timed ${CABAL_INSTALL_BDIR}/build/cabal/cabal update
123 # Run tests
124 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
125 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/solver-quickcheck/solver-quickcheck $TEST_OPTIONS --quickcheck-tests=1000) || exit $?
126 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/integration-tests/integration-tests $TEST_OPTIONS) || exit $?
127 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/integration-tests2/integration-tests2 $TEST_OPTIONS) || exit $?
129 # Haddock
130 (cd cabal-install && timed ${CABAL_INSTALL_SETUP} haddock --builddir=${CABAL_INSTALL_BDIR} ) || exit $?
132 (cd cabal-install && timed cabal check) || exit $?
134 unset CABAL_BUILDDIR
136 # Check what we got
137 ${CABAL_INSTALL_BDIR}/build/cabal/cabal --version