Only insist on haskell test dependencies if needed
authorKlaus Aehlig <aehlig@google.com>
Tue, 11 Aug 2015 11:58:07 +0000 (13:58 +0200)
committerKlaus Aehlig <aehlig@google.com>
Tue, 11 Aug 2015 13:11:07 +0000 (15:11 +0200)
While developers usually run tests and hence need all the infrastructure
for it, people who just want to build and use Ganeti usually do not want
to run tests. So, while still using cabal to get a consistent set of
dependency packages, make the test infra structure optional in the cabal
file. The decision on whether to require test dependencies will be made
based on whether the haskell tests are configured to be run.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

Makefile.am
cabal/ganeti.template.cabal

index 9c44e6c..5f7e765 100644 (file)
@@ -1351,6 +1351,7 @@ $(HASKELL_PACKAGE_VERSIONS_FILE): Makefile ganeti.cabal \
                                   cabal/CabalDependenciesMacros.hs
        touch empty-cabal-config
        $(CABAL) --config-file=empty-cabal-config configure --user \
+         -f`test $(HTEST) == yes && echo "htest" || echo "-htest"` \
          -f`test $(ENABLE_MOND) == True && echo "mond" || echo "-mond"` \
          -f`test $(ENABLE_METADATA) == True && echo "metad" || echo "-metad"`
        runhaskell $(abs_top_srcdir)/cabal/CabalDependenciesMacros.hs \
index b1b41d1..3813087 100644 (file)
@@ -5,7 +5,7 @@ license:             BSD2
 license-file:        COPYING
 author:              Google Inc.
 maintainer:          ganeti-devel@googlegroups.com
-copyright:           2006-2014 Google Inc.
+copyright:           2006-2015 Google Inc.
 category:            System
 build-type:          Simple
 extra-source-files:  README
@@ -25,6 +25,10 @@ flag metad
   description: enable the ganeti metadata daemon
   default:     True
 
+flag htest
+  description: enable tests
+  default:     True
+
 
 library
   exposed-modules:
@@ -69,17 +73,19 @@ library
     , utf8-string                   >= 0.3.7      && < 0.4
     , zlib                          >= 0.5.3.3    && < 0.6
 
-    , HUnit                         >= 1.2.4.2    && < 1.3
-    , QuickCheck                    >= 2.4.2      && < 2.8
-    , test-framework                >= 0.6        && < 0.9
-    , test-framework-hunit          >= 0.2.7      && < 0.4
-    , test-framework-quickcheck2    >= 0.2.12.1   && < 0.4
-
     -- Executables:
     -- , happy
     -- , hscolour
     -- , shelltestrunner
 
+  if flag(htest)
+    build-depends:
+        HUnit                         >= 1.2.4.2    && < 1.3
+      , QuickCheck                    >= 2.4.2      && < 2.8
+      , test-framework                >= 0.6        && < 0.9
+      , test-framework-hunit          >= 0.2.7      && < 0.4
+      , test-framework-quickcheck2    >= 0.2.12.1   && < 0.4
+
   if flag(mond)
     build-depends:
         PSQueue                       >= 1.1        && < 1.2