Commit 8d05c589 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Test case for the Configure build-type.



This test-case was lifted straight from the Cabal manual.
It also tests if buildinfo is handled correctly.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 4021ce46
......@@ -283,6 +283,7 @@ componentDisabledReason (CBench bm)
componentDisabledReason _ = Nothing
lookupComponent :: PackageDescription -> ComponentName -> Maybe Component
lookupComponent pkg (CLibName "") = lookupComponent pkg (defaultLibName (package pkg))
lookupComponent pkg (CLibName name) =
fmap CLib $ find ((name ==) . libName) (libraries pkg)
lookupComponent pkg (CExeName name) =
......
X11.buildinfo
autom4te.cache/
*.log
*.status
include/HsX11Config.h
configure
import Distribution.Simple
main = defaultMainWithHooks autoconfUserHooks
buildable: True
cc-options:
ld-options:
buildable: @BUILD_PACKAGE_BOOL@
cc-options: @X_CFLAGS@
ld-options: @X_LIBS@
name: X11
version: 1.1
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Configure
cabal-version: >=1.10
library
exposed-modules: A
build-depends: base
default-language: Haskell2010
AC_INIT([Haskell X11 package], [1.1], [libraries@haskell.org], [X11])
# Safety check: Ensure that we are in the correct source directory.
AC_CONFIG_SRCDIR([X11.cabal])
# Header file to place defines in
AC_CONFIG_HEADERS([include/HsX11Config.h])
# Check for X11 include paths and libraries
AC_PATH_XTRA
AC_TRY_CPP([#include <X11/Xlib.h>],,[no_x=yes])
# Build the package if we found X11 stuff
if test "$no_x" = yes
then BUILD_PACKAGE_BOOL=False
else BUILD_PACKAGE_BOOL=True
fi
AC_SUBST([BUILD_PACKAGE_BOOL])
AC_CONFIG_FILES([X11.buildinfo])
AC_OUTPUT
/* include/HsX11Config.h.in. Generated from configure.ac by autoheader. */
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
......@@ -25,6 +25,7 @@ module PackageTests.PackageTester
, ghcPkg
, ghcPkg'
, compileSetup
, shell
, run
, runExe
, runExe'
......@@ -474,6 +475,11 @@ runInstalledExe' exe_name args = do
let exe = usr </> "bin" </> exe_name
run Nothing exe args
shell :: String -> [String] -> TestM Result
shell exe args = do
pkg_dir <- packageDir
run (Just pkg_dir) exe args
run :: Maybe FilePath -> String -> [String] -> TestM Result
run mb_cwd path args = do
verbosity <- getVerbosity
......@@ -487,8 +493,11 @@ rawRun verbosity mb_cwd path envOverrides args = do
-- path is relative to the current directory; canonicalizePath makes it
-- absolute, so that runProcess will find it even when changing directory.
path' <- do pathExists <- doesFileExist path
canonicalizePath (if pathExists then path
else path <.> exeExtension)
exePathExists <- doesFileExist (path <.> exeExtension)
case () of
_ | pathExists -> canonicalizePath path
| exePathExists -> canonicalizePath (path <.> exeExtension)
| otherwise -> return path
menv <- getEffectiveEnvironment envOverrides
printRawCommandAndArgsAndEnv verbosity path' args menv
......
......@@ -304,6 +304,14 @@ tests config = do
runExe' "macros-b" []
>>= assertOutputContains "macros-b.exe"
-- Test for 'build-type: Configure' example from the Cabal manual.
-- Disabled on Windows since MingW doesn't ship with autoreconf by
-- default.
unlessWindows $ do
tc "Configure" $ do
_ <- shell "autoreconf" ["-i"]
cabal_build []
where
ghc_pkg_guess bin_name = do
cwd <- packageDir
......
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