
Hi all, I've recently started to move my tests to use the new cabal test-suite framework. Old setup: The cabal file compiles one library + a few executables. The library contains almost all of the code and exposes the necessary modules for use by the executables. The executables mainly consist of one main file. This way, the library is only compiled once and used multiple times by the executables. Great. One of the executables compile a test runner, and is handled similarly. New setup, using test-suite: I've deleted the executable section for the test runner and added a test-suite section instead. To my surprise, the library is compiled twice now. Hence, it takes twice as long. And it is a clear regression compared to my old setup. While waiting for a build to finish [ :) ], I just wanted to write an email and check if this is intentional or only an oversight. Or maybe a technical limitation for the time being? Thanks, Ozgur

On Tue, Mar 13, 2012 at 11:16 AM, Ozgur Akgun
While waiting for a build to finish [ :) ], I just wanted to write an email and check if this is intentional or only an oversight. Or maybe a technical limitation for the time being?
If your library code and test code are in separate sub-directories and you reference your library as a package dependency for your test then Cabal won't re-build your library. That is, the 'Hs-source-disr' for the library and the test should not overlap. Otherwise GHC will compile the file-on-disk instead of grabbing the module from a package. Antoine

On 13 March 2012 16:22, Antoine Latter
If your library code and test code are in separate sub-directories and you reference your library as a package dependency for your test then Cabal won't re-build your library.
Yay! That was it. Thanks. Somehow I altered the hs-source-dir field while moving from the old setup to the new setup. So just to confirm, the behaviour of the test-suite section is exactly the same as that of executable sections. Cheers, Ozgur
participants (2)
-
Antoine Latter
-
Ozgur Akgun