Commit 531dccee authored by Petr Pudlak's avatar Petr Pudlak

Add a CPP macro for checking the version of QuickCheck

.. to TestCommon as a preparation for cherry-picking changes that
need it.

The macro and the version detection will be removed in 2.14 where the
functionality is replaced with cabal.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent fce81542
......@@ -1211,6 +1211,13 @@ hs-pkg-versions:
-DMONAD_CONTROL_MAJOR=\1 -DMONAD_CONTROL_MINOR=\2 -DMONAD_CONTROL_REV=\3/'\
-e 's/^\s*//' \
>> $@
ghc-pkg list --simple-output QuickCheck \
| sed -r -e '$$!d' \
-e 's/^QuickCheck-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
-e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
-DQUICKCHECK_MAJOR=\1 -DQUICKCHECK_MINOR=\2 -DQUICKCHECK_REV=\3/'\
-e 's/^\s*//' \
>> $@
HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
if WANT_HSTESTS
......
......@@ -83,6 +83,14 @@ module Test.Ganeti.TestCommon
, getTempFileName
) where
-- The following macro is just a temporary solution for 2.12 and 2.13.
-- Since 2.14 cabal creates proper macros for all dependencies.
#define MIN_VERSION_QuickCheck(maj,min,rev) \
(((maj)<QUICKCHECK_MAJOR)|| \
(((maj)==QUICKCHECK_MAJOR)&&((min)<=QUICKCHECK_MINOR))|| \
(((maj)==QUICKCHECK_MAJOR)&&((min)==QUICKCHECK_MINOR)&& \
((rev)<=QUICKCHECK_REV)))
import Control.Applicative
import Control.Exception (catchJust)
import Control.Monad
......
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