Skip to content

Commit da38a73

Browse files
committed
Split up OS X tests to get them under the time.
Signed-off-by: Edward Z. Yang <[email protected]>
1 parent de19d20 commit da38a73

File tree

2 files changed

+53
-36
lines changed

2 files changed

+53
-36
lines changed

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,22 @@ matrix:
5656
# We axed GHC 7.6 and earlier because it's not worth the trouble to
5757
# make older GHC work with clang's cpp. See
5858
# https://ghc.haskell.org/trac/ghc/ticket/8493
59-
- env: GHCVER=7.8.4 SCRIPT=script
59+
- env: GHCVER=7.8.4 SCRIPT=script CABAL_LIB_ONLY=YES
6060
os: osx
6161
osx_image: xcode6.4 # We need 10.10
62+
- env: GHCVER=7.8.4 SCRIPT=script CABAL_INSTALL_ONLY=YES
63+
os: osx
64+
osx_image: xcode6.4
6265

6366
# TODO: We might want to specify OSX version
6467
# https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
65-
- env: GHCVER=7.10.3 SCRIPT=script
68+
- env: GHCVER=7.10.3 SCRIPT=script CABAL_LIB_ONLY=YES
69+
os: osx
70+
- env: GHCVER=7.10.3 SCRIPT=script CABAL_INSTALL_ONLY=YES
71+
os: osx
72+
- env: GHCVER=8.0.1 SCRIPT=script CABAL_LIB_ONLY=YES
6673
os: osx
67-
- env: GHCVER=8.0.1 SCRIPT=script
74+
- env: GHCVER=8.0.1 SCRIPT=script CABAL_INSTALL_ONLY=YES
6875
os: osx
6976
- env: GHCVER=8.0.1 SCRIPT=bootstrap
7077
os: osx

travis-script.sh

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cp cabal.project.travis cabal.project.local
4444
# do it via new-build. See also cabal.project.travis. The downside of
4545
# doing it this way is that the build product cannot be cached, but
4646
# hackage-repo-tool is a relatively small package so it's good.
47-
cabal unpack hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}
47+
timed cabal unpack hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}
4848

4949
# ---------------------------------------------------------------------
5050
# Cabal
@@ -53,54 +53,64 @@ cabal unpack hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}
5353
# Needed to work around some bugs in nix-local-build code.
5454
export CABAL_BUILDDIR="${CABAL_BDIR}"
5555

56-
# NB: Best to do everything for a single package together as it's
57-
# more efficient (since new-build will uselessly try to rebuild
58-
# Cabal otherwise).
59-
if [ "x$PARSEC" = "xYES" ]; then
60-
timed cabal new-build -fparsec Cabal Cabal:unit-tests Cabal:parser-tests Cabal:parser-hackage-tests
61-
else
62-
timed cabal new-build Cabal Cabal:unit-tests
63-
fi
56+
if [ "x$CABAL_INSTALL_ONLY" != "xYES" ] ; then
57+
# We're doing a full build and test of Cabal
6458

65-
# NB: the '|| exit $?' workaround is required on old broken versions of bash
66-
# that ship with OS X. See https://github.com/haskell/cabal/pull/3624 and
67-
# http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
59+
# NB: Best to do everything for a single package together as it's
60+
# more efficient (since new-build will uselessly try to rebuild
61+
# Cabal otherwise).
62+
if [ "x$PARSEC" = "xYES" ]; then
63+
timed cabal new-build -fparsec Cabal Cabal:unit-tests Cabal:parser-tests Cabal:parser-hackage-tests
64+
else
65+
timed cabal new-build Cabal Cabal:unit-tests
66+
fi
6867

69-
# Run tests
70-
(cd Cabal && timed ${CABAL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
68+
# NB: the '|| exit $?' workaround is required on old broken versions of bash
69+
# that ship with OS X. See https://github.com/haskell/cabal/pull/3624 and
70+
# http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
7171

72-
if [ "x$PARSEC" = "xYES" ]; then
73-
# Parser unit tests
74-
(cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-tests $TEST_OPTIONS) || exit $?
72+
# Run tests
73+
(cd Cabal && timed ${CABAL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
7574

76-
# Test we can parse Hackage
77-
(cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-hackage-tests $TEST_OPTIONS) | tail || exit $?
78-
fi
75+
if [ "x$PARSEC" = "xYES" ]; then
76+
# Parser unit tests
77+
(cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-tests $TEST_OPTIONS) || exit $?
7978

80-
# Run haddock
81-
(cd Cabal && timed cabal act-as-setup --build-type=Simple -- haddock --builddir=${CABAL_BDIR}) || exit $?
79+
# Test we can parse Hackage
80+
(cd Cabal && timed ${CABAL_BDIR}/build/parser-tests/parser-hackage-tests $TEST_OPTIONS) | tail || exit $?
81+
fi
8282

83-
# Check for package warnings
84-
(cd Cabal && timed cabal check) || exit $?
83+
# Run haddock
84+
(cd Cabal && timed cabal act-as-setup --build-type=Simple -- haddock --builddir=${CABAL_BDIR}) || exit $?
85+
86+
# Check for package warnings
87+
(cd Cabal && timed cabal check) || exit $?
88+
fi
8589

8690
unset CABAL_BUILDDIR
8791

8892
# Build and run the package tests
8993

9094
export CABAL_BUILDDIR="${CABAL_TESTSUITE_BDIR}"
9195

96+
# NB: We always build this test runner, because it is used
97+
# both by Cabal and cabal-install
9298
timed cabal new-build cabal-testsuite:cabal-tests
9399

94-
(cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS) || exit $?
100+
if [ "x$CABAL_INSTALL_ONLY" != "xYES" ] ; then
101+
# We're doing a full build and test of Cabal
102+
103+
(cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS) || exit $?
95104

96-
# Redo the package tests with different versions of GHC
97-
if [ "x$TEST_OTHER_VERSIONS" = "xYES" ]; then
98-
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.0.4/bin/ghc"; \
99-
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
100-
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.2.2/bin/ghc"; \
101-
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
102-
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/head/bin/ghc"; \
103-
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
105+
# Redo the package tests with different versions of GHC
106+
if [ "x$TEST_OTHER_VERSIONS" = "xYES" ]; then
107+
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.0.4/bin/ghc"; \
108+
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
109+
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/7.2.2/bin/ghc"; \
110+
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
111+
(export CABAL_PACKAGETESTS_WITH_GHC="/opt/ghc/head/bin/ghc"; \
112+
cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests $TEST_OPTIONS)
113+
fi
104114
fi
105115

106116
unset CABAL_BUILDDIR

0 commit comments

Comments
 (0)