Commit 606b1600 authored by Robert Henderson's avatar Robert Henderson
Browse files

Merge remote-tracking branch 'upstream/master' into issue-3502-part4

parents 7bfb03cf cdc2f91d
......@@ -117,7 +117,7 @@ install:
# ./dist/setup/setup here instead of cabal-install to avoid breakage when the
# build config format changed.
script:
- ./travis-${SCRIPT}.sh
- ./travis-${SCRIPT}.sh -j
cache:
directories:
......
......@@ -39,7 +39,8 @@ desugarBuildTool pkg led =
toolName = mkUnqualComponentName name
foundLocal = toolName `elem` map exeName (executables pkg)
whitelist = [ "hscolour", "haddock", "happy", "alex", "hsc2hs", "c2hs"
, "cpphs", "greencard"]
, "cpphs", "greencard", "hspec-discover"
]
whiteMap = Map.fromList $ flip map whitelist $ \n ->
(n, ExeDependency (mkPackageName n) (mkUnqualComponentName n) reqVer)
......
......@@ -218,7 +218,7 @@ haddock pkg_descr lbi suffixes flags' = do
version lib
let libArgs' = commonArgs `mappend` libArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CFLib flib -> do
CFLib flib -> when (flag haddockForeignLibs) $ do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
flibArgs <- fromForeignLib verbosity tmp lbi clbi htmlTemplate
......
(import ../.).Cabal.env
......@@ -51,7 +51,7 @@ Here are some other useful variations on the commands:
~~~~
cabal new-build Cabal # build library only
cabal new-build Cabal:package-tests # build Cabal's package test suite
cabal new-build Cabal:unit-tests # build Cabal's unit test suite
cabal new-build cabal-install:integration-tests # etc...
~~~~
......@@ -88,23 +88,13 @@ several. In general, the test executable for
To run a single test, use `-p` which applies a regex filter to the test names.
* `Cabal:package-tests` are out-of-process integration tests on the top-level `Setup`
command line interface. If you are hacking on the Cabal library you
want to run this test suite. It must be run from the `Cabal` subdirectory
(ugh!) This test suite can be a bit touchy; see
[Cabal/tests/README.md](Cabal/tests/README.md) for more information.
Build products and test logs are generated and stored in
`Cabal/tests/PackageTests` under folders named `dist-test` and
`dist-test.$subname`.
Handy command line spell to find test logs is:
```sh
find . -name test.log|grep test-name
```
`test.sh` in the same directory as `test.log` is intended to let you rerun
the test without running the actual test driver.
* `cabal-testsuite:cabal-tests` is an executable runner for out-of-process
integration tests for both the `Setup` interface, as well as
`cabal-install` (if you pass the path to the executable
to test via the `--with-cabal` flag). Most user-visible changes
to Cabal should come with a test in this framework. See
[cabal-testsuite/README.md](cabal-testsuite/README.md) for more
information about how to run tests and write new ones.
* `Cabal:unit-tests` are small, quick-running unit tests
on small pieces of functionality in Cabal. If you are working
......
......@@ -17,11 +17,11 @@ import Control.Applicative ((<$>))
import Control.Exception (bracket, catch)
import Control.Monad (filterM, when, unless)
import System.Directory
( createDirectoryIfMissing, doesDirectoryExist, doesFileExist
, makeAbsolute, removeDirectoryRecursive, removeFile )
( canonicalizePath, createDirectoryIfMissing, doesDirectoryExist
, doesFileExist, removeDirectoryRecursive, removeFile )
import System.Environment (getArgs, getExecutablePath)
import System.FilePath
( (</>), (<.>), replaceExtension, takeDirectory, takeFileName )
( (</>), replaceExtension, takeDirectory, takeFileName )
import System.IO (IOMode(..), hClose, openFile)
import System.IO.Error (isDoesNotExistError)
import System.Process (showCommandForUser)
......@@ -100,7 +100,7 @@ nixInstantiate verb dist force globalFlags config =
instantiated <- doesFileExist shellDrv
-- an extra timestamp file is necessary because the derivation lives in
-- the store so its mtime is always 1.
let timestamp = shellDrv <.> "timestamp"
let timestamp = timestampPath dist shellNix
upToDate <- existsAndIsMoreRecentThan timestamp shellNix
let ready = alreadyInShell || (instantiated && upToDate && not force)
......@@ -159,9 +159,19 @@ nixShell verb dist globalFlags config go = do
drvPath :: FilePath -> FilePath -> IO FilePath
drvPath dist path =
drvPath dist path = do
-- We do not actually care about canonicity, but makeAbsolute is only
-- available in newer versions of directory.
-- We expect the path to be a symlink if it exists, so we do not canonicalize
-- the entire path because that would dereference the symlink.
distNix <- canonicalizePath (dist </> "nix")
-- Nix garbage collector roots must be absolute paths
makeAbsolute (dist </> "nix" </> replaceExtension (takeFileName path) "drv")
return (distNix </> replaceExtension (takeFileName path) "drv")
timestampPath :: FilePath -> FilePath -> FilePath
timestampPath dist path =
dist </> "nix" </> replaceExtension (takeFileName path) "drv.timestamp"
gcrootPath :: FilePath -> FilePath
......
(import ../.).cabal-install.env
......@@ -20,6 +20,48 @@ HACKAGE_REPO_TOOL_BDIR="${PWD}/dist-newstyle/build/hackage-repo-tool-${HACKAGE_R
# Travis's log viewer. So just print them all!
TEST_OPTIONS=""
# ---------------------------------------------------------------------
# Parse options
# ---------------------------------------------------------------------
usage() {
echo -e -n "Usage: `basename $0`\n-j jobs\n"
}
jobs="-j1"
while getopts ":hj:" opt; do
case $opt in
h)
usage
exit 0
;;
j)
jobs="-j$OPTARG"
;;
:)
# Argument-less -j
if [ "$OPTARG" = "j" ]; then
jobs="-j"
fi
;;
\?)
echo "Invalid option: $OPTARG"
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
# Do not try to use -j with GHC older than 7.8
case $GHCVER in
7.4*|7.6*)
jobs=""
;;
*)
;;
esac
# ---------------------------------------------------------------------
# Update the Cabal index
# ---------------------------------------------------------------------
......@@ -31,7 +73,7 @@ timed cabal update
# ---------------------------------------------------------------------
if ! command -v happy; then
timed cabal install happy
timed cabal install $jobs happy
fi
# ---------------------------------------------------------------------
......@@ -60,9 +102,9 @@ if [ "x$CABAL_INSTALL_ONLY" != "xYES" ] ; then
# more efficient (since new-build will uselessly try to rebuild
# Cabal otherwise).
if [ "x$PARSEC" = "xYES" ]; then
timed cabal new-build -fparsec Cabal Cabal:unit-tests Cabal:parser-tests Cabal:parser-hackage-tests
timed cabal new-build $jobs -fparsec Cabal Cabal:unit-tests Cabal:parser-tests Cabal:parser-hackage-tests
else
timed cabal new-build Cabal Cabal:unit-tests
timed cabal new-build $jobs Cabal Cabal:unit-tests
fi
# NB: the '|| exit $?' workaround is required on old broken versions of bash
......@@ -95,7 +137,7 @@ export CABAL_BUILDDIR="${CABAL_TESTSUITE_BDIR}"
# NB: We always build this test runner, because it is used
# both by Cabal and cabal-install
timed cabal new-build cabal-testsuite:cabal-tests
timed cabal new-build $jobs cabal-testsuite:cabal-tests
if [ "x$CABAL_INSTALL_ONLY" != "xYES" ] ; then
# We're doing a full build and test of Cabal
......@@ -126,7 +168,7 @@ fi
# Needed to work around some bugs in nix-local-build code.
export CABAL_BUILDDIR="${CABAL_INSTALL_BDIR}"
timed cabal new-build cabal-install:cabal \
timed cabal new-build $jobs cabal-install:cabal \
cabal-install:integration-tests \
cabal-install:integration-tests2 \
cabal-install:unit-tests \
......@@ -145,7 +187,7 @@ timed ${CABAL_INSTALL_BDIR}/build/cabal/cabal update
(cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/integration-tests2/integration-tests2 $TEST_OPTIONS) || exit $?
(cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/memory-usage-tests/memory-usage-tests $TEST_OPTIONS) || exit $?
timed cabal new-build hackage-repo-tool
timed cabal new-build $jobs hackage-repo-tool
(cd cabal-testsuite && timed ${CABAL_TESTSUITE_BDIR}/build/cabal-tests/cabal-tests -j3 --skip-setup-tests --with-cabal ${CABAL_INSTALL_BDIR}/build/cabal/cabal --with-hackage-repo-tool ${HACKAGE_REPO_TOOL_BDIR}/build/hackage-repo-tool/hackage-repo-tool $TEST_OPTIONS) || exit $?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment