rl:
> Simon Peyton Jones wrote:
> >Thu Feb  7 08:22:44 PST 2008  [EMAIL PROTECTED]
> >  * Add a new category of "eyeball" tests 
> >  
> >  These tests are hard to do automatically, but they record examples that 
> >  provoked changes to the optimiser.  Each one has notes that says what 
> >  you
> >  should expect to see!
> 
> I think we should try to do them automatically. Usually it's just a 
> matter of dumping the simplifier output and grepping for things. For the 
> tests you added:
> 
> >    A ./tests/ghc-regress/eyeball/dead1.hs
> 
> Make sure "bar" doesn't occur in the output of phase 0.
> 
> >    A ./tests/ghc-regress/eyeball/inline1.hs
> 
> Make sure "myIndex" doesn't occur in the output of phase 2.
> 
> >    A ./tests/ghc-regress/eyeball/inline2.hs
> 
> Count the number of simplifier iterations in -dshow-passes.
> 
> >     A ./tests/ghc-regress/eyeball/inline3.hs
> 
> Count the number of calls to (+#).
> 
> And so on. I'll try to implement a simple framework. I'm just not sure 
> if it should be in Haskell, Python or shell?
> 

Grab the pcre-light regex package? 
Like so:

    import Text.Regex.PCRE.Light.Char8
    import System.Environment
    import Text.Printf
    import Data.Char

    fired = compile "([0-9]+) FPS pack/packAddress" [caseless]
    regex = dropWhile (/= '"') . show $ fired

    main = do
        s <- getContents
        case match fired s [] of
             Nothing    -> error $ printf "Rule %s didn't fire!\n" regex
             Just (_:n:_) -> printf "Rule %s fired %s times\n." regex n

And then we can match on rules:

    $ ghc -O2 A.hs -ddump-simpl-stats --make | ./Check
    Rule "([0-9]+) FPS pack/packAddress" fired 1 times

I'd do this in Haskell now (esp. if you want to analyse the results)

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to