Skip to content

Commit 4c64561

Browse files
author
Nicolas Mattia
committed
Export analysis related functions
1 parent 2756ec7 commit 4c64561

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

examples/end-to-end-benchmarks.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ benchmarks =
2020
main :: IO ()
2121
main = defaultMainWith config "hyperion-example-end-to-end" benchmarks
2222
where
23-
config = defaultConfig
23+
config = defaultConfigMonoid
2424
{ configMonoidSamplingStrategy =
2525
pure $ timeBound (fromSeconds 5) (repeat 10)
2626
}

src/Hyperion/Main.hs

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
module Hyperion.Main
99
( defaultMain
1010
, Mode(..)
11+
, Config(..)
1112
, ConfigMonoid(..)
1213
, ReportOutput(..)
14+
, configFromMonoid
1315
, nullOutputPath
1416
, defaultConfig
17+
, defaultConfigMonoid
1518
, defaultMainWith
19+
, doAnalyze
20+
, doRun
1621
) where
1722

1823
import Control.Applicative
@@ -178,8 +183,11 @@ nullOutputPath = "nul"
178183
nullOutputPath = "/dev/null"
179184
#endif
180185

181-
defaultConfig :: ConfigMonoid
182-
defaultConfig = mempty
186+
defaultConfigMonoid :: ConfigMonoid
187+
defaultConfigMonoid = mempty
188+
189+
defaultConfig :: Config
190+
defaultConfig = configFromMonoid defaultConfigMonoid
183191

184192
data DuplicateIdentifiers a = DuplicateIdentifiers [a]
185193
instance (Show a, Typeable a) => Exception (DuplicateIdentifiers a)
@@ -315,4 +323,4 @@ defaultMain
315323
:: String -- ^ Package name, user provided.
316324
-> [Benchmark] -- ^ Benchmarks to be run.
317325
-> IO ()
318-
defaultMain = defaultMainWith defaultConfig
326+
defaultMain = defaultMainWith defaultConfigMonoid

tests/Hyperion/MainSpec.hs

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ spec = do
1515
it "checks for duplicate identifiers" $ property $ \b ->
1616
length (b^..identifiers) /= length (group (sort (b^..identifiers))) ==>
1717
expectFailure $ monadicIO $ run $
18-
defaultMainWith defaultConfig{configMonoidMode = return Run} "spec" [b]
18+
defaultMainWith
19+
defaultConfigMonoid{configMonoidMode = return Run} "spec" [b]
1920
it "Analyzes uniquely identified benchmarks" $ property $ \b ->
2021
length (b^..identifiers) == length (group (sort (b^..identifiers))) ==>
2122
monadicIO $ run $
22-
defaultMainWith defaultConfig{configMonoidReportOutputs = [ReportJson nullOutputPath]} "specs" [b]
23+
defaultMainWith
24+
defaultConfigMonoid{configMonoidReportOutputs = [ReportJson nullOutputPath]} "specs" [b]

0 commit comments

Comments
 (0)