proptotype of make style dep stuff
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Tue Oct 30 18:45:34 EDT 2007
On Fri, 2007-10-26 at 10:48 +0000, Duncan Coutts wrote:
> So what's next...
>
> We want to write some specifications
Spencer, Lennart, Thomas and I had a joint hacking session in which we
made some progress on this issue today. Specifically we can now generate
random dep graphs for use in QuickCheck tests. For example:
http://haskell.org/~duncan/cabal/foo.svg
We can tune the size and 'density' of these graphs. As you can see we
get cycles in the graphs. We'll have to filter out cycles. Any
suggestions on a simple way to do that? It's ok to depend on Data.Graph
for this kind of test code.
So the first testing strategy we're going for is to generate random dep
graphs. From there we will write out a suitable selection of the files
and run the make algorithm. We then inspect the resulting event trace
and final state to check that everything worked correctly. So we'll be
making the dependency generator from this random dep graph too.
So this is for testing make in isolation. For the next bit of testing
our rule sets for building Haskell projects we'll have to generate dep
graphs that use files mentioned in our rule sets. That's probably a bit
harder.
We're using a trivial representation of the random dep graphs:
> newtype TestDepGraph = TestDepGraph [Dep]
> data Dep = Target :<= Target deriving (Eq, Show)
foo :<= bar means that we generate foo from bar
So an example property might look something like:
> prop_makeUpToDate :: Property
> prop_makeUpToDate =
> forall $ \graph ->
> let build = do
> mapM_ touch (files graph)
> make (gen graph)
> in allUpToDate (finalState build)
As I mentioned, the gen function will have to do its rule generation
based on the random graph we generated.
The new code will be in the repo shortly...
darcs get http://haskell.org/~duncan/cabal/dep-experiment/
Duncan
More information about the cabal-devel
mailing list