Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
[CDEC-517] Parallelize tests inwallet-new
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Aug 28, 2018
1 parent 5e7fc85 commit 0057d33
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
4 changes: 3 additions & 1 deletion cardano-sl-wallet-new.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ executable wal-integr-test
MonadFailDesugaring

test-suite wallet-unit-tests
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
type: exitcode-stdio-1.0
main-is: WalletUnitTest.hs
other-modules: InputSelection.Evaluation
Expand Down Expand Up @@ -499,6 +499,7 @@ test-suite wallet-unit-tests
, cardano-sl-db
, cardano-sl-networking
, cardano-sl-util
, cardano-sl-util-test
, cardano-sl-wallet-new
, constraints
, containers
Expand Down Expand Up @@ -586,6 +587,7 @@ test-suite wallet-new-specs
, cardano-sl-core-test
, cardano-sl-crypto
, cardano-sl-chain
, cardano-sl-util
, cardano-sl-util-test
, cardano-sl-wallet
, cardano-sl-wallet-new
Expand Down
26 changes: 14 additions & 12 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Universum
import Data.Typeable (typeRep)
import Test.Hspec
import Test.Hspec.QuickCheck
import Test.Pos.Util.Parallel.Parallelize (parallelizeAllCores)
import Test.Pos.Util.Tripping (runTests)
import Test.QuickCheck

Expand All @@ -24,22 +25,23 @@ import qualified WalletNewJson
-- | Tests whether or not some instances (JSON, Bi, etc) roundtrips.
main :: IO ()
main = do
parallelizeAllCores
runTests
[ WalletNewJson.tests
]
hspec $ do
InternalAPI.spec
Marshalling.spec
API.spec
Swagger.spec
ReqSpec.spec

eqProps @WalletAddress
eqProps @Address
eqProps @Wallet
eqProps @Transaction

WalletHandlers.spec
parallel $ InternalAPI.spec
parallel $ Marshalling.spec
parallel $ API.spec
parallel $ Swagger.spec
parallel $ ReqSpec.spec

parallel $ eqProps @WalletAddress
parallel $ eqProps @Address
parallel $ eqProps @Wallet
parallel $ eqProps @Transaction

parallel $ WalletHandlers.spec

eqProps :: forall a. (Typeable a, Eq a, Arbitrary a, Show a) => Spec
eqProps = do
Expand Down
8 changes: 5 additions & 3 deletions test/unit/WalletUnitTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ module Main (main) where
import Universum

import Formatting (build, sformat)
import Test.Hspec (Spec, describe, hspec)
import Test.Hspec (Spec, describe, hspec, parallel)

import InputSelection.Evaluation (evalUsingGenData, evalUsingReplay)
import InputSelection.Evaluation.Options (Command (..), evalCommand,
getEvalOptions)
import InputSelection.Evaluation.Replot (replot)
import Test.Pos.Util.Parallel.Parallelize (parallelizeAllCores)
import UTxO.Bootstrap (bootstrapTransaction)
import UTxO.Context (Addr, TransCtxt)
import UTxO.DSL (GivenHash, Transaction)
Expand All @@ -35,11 +36,12 @@ import TxMetaStorageSpecs (txMetaStorageSpecs)

main :: IO ()
main = do
parallelizeAllCores
mEvalOptions <- getEvalOptions
case mEvalOptions of
Nothing -> do
-- _showContext
runTranslateNoErrors $ withConfig $ return $ hspec tests
runTranslateNoErrors $ withConfig $ return $ hspec $ tests
Just evalOptions ->
-- NOTE: The coin selection must be invoked with @eval@
-- Run @wallet-unit-tests eval --help@ for details.
Expand All @@ -66,7 +68,7 @@ _showContext = do
-------------------------------------------------------------------------------}

tests :: Spec
tests = describe "Wallet unit tests" $ do
tests = parallel $ describe "Wallet unit tests" $ do
Test.Spec.Kernel.spec
Test.Spec.GetTransactions.spec
Test.Spec.Translation.spec
Expand Down

0 comments on commit 0057d33

Please sign in to comment.