From fd0bc853b727d7a63cc77d59c90d6898406c6713 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 30 Mar 2011 14:00:31 +0200 Subject: [PATCH] Clarify the need for QuickCheck/Haskell tests Expands the devnotes.rst doc and adds warnings in the Makefile. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- Makefile.am | 4 ++++ configure.ac | 8 ++++++++ doc/devnotes.rst | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a90da284c..68e18aacc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -447,6 +447,10 @@ endif $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile BINARY=$(@:htools/%=%); \ + if [ "$$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \ + echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \ + exit 1; \ + fi; \ $(GHC) --make \ $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \ -osuf $$BINARY.o -hisuf $$BINARY.hi \ diff --git a/configure.ac b/configure.ac index 10be7591a..98263bdd8 100644 --- a/configure.ac +++ b/configure.ac @@ -369,6 +369,9 @@ else AC_MSG_CHECKING([network]) GHC_PKG_NETWORK=$($GHC_PKG latest network) AC_MSG_RESULT($GHC_PKG_NETWORK) + AC_MSG_CHECKING([QuickCheck 1.x]) + GHC_PKG_QUICKCHECK=$($GHC_PKG --simple-output list 'QuickCheck-1.*') + AC_MSG_RESULT($GHC_PKG_QUICKCHECK) if test -z "$GHC_PKG_PARALLEL" || test -z "$GHC_PKG_JSON" || \ test -z "$GHC_PKG_NETWORK"; then if test "$enable_htools" != "check"; then @@ -379,8 +382,13 @@ else # we leave the other modules to be auto-selected HTOOLS_MODULES="-package $GHC_PKG_PARALLEL" fi + if test -z "$GHC_PKG_QUICKCHECK"; then + AC_MSG_WARN(m4_normalize([The QuickCheck 1.x module was not found, + you won't be able to run Haskell unittests])) + fi fi AC_SUBST(HTOOLS_MODULES) +AC_SUBST(GHC_PKG_QUICKCHECK) if test "$enable_htools" != "no"; then if test -z "$GHC" || test -z "$HTOOLS_MODULES"; then diff --git a/doc/devnotes.rst b/doc/devnotes.rst index 1982ab40b..ae36c60e5 100644 --- a/doc/devnotes.rst +++ b/doc/devnotes.rst @@ -38,7 +38,13 @@ document, plus: linter (equivalent to pylint for Python) - the `QuickCheck <http://hackage.haskell.org/package/QuickCheck>`_ library, version 1.x -- ``hpc``, which comes with the compiler, so you should already have it +- ``hpc``, which comes with the compiler, so you should already have + it + +Under Debian, these can be installed (on top of the required ones from +the quick install document) via:: + + apt-get install libghc6-quickcheck1-dev hscolour hlint Configuring for development -- GitLab