Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5-internal/split-cannon-benchmarks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Split cannon benchmarks and tests
31 changes: 31 additions & 0 deletions services/cannon/bench/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2021 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Main where

import Bench
import qualified Cannon.API
import Data.Metrics.Test (pathsConsistencyCheck)
import Data.Metrics.WaiRoute (treeToPaths)
import Imports
import Network.Wai.Utilities.Server (compile)
import qualified Test.Cannon.Dict as D
import Test.Tasty
import Test.Tasty.HUnit
Comment thread
supersven marked this conversation as resolved.
Outdated

main :: IO ()
main = benchmark
30 changes: 29 additions & 1 deletion services/cannon/cannon.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 6c53d0a25079c3947f669ee6cf4a32b3e9a9472db9050997e478fc8fdb7b3858
-- hash: d5099fe0b4b7931455272a2a8e65ba86cb3bad30537a5485372a049a7f9ffd4b

name: cannon
version: 0.31.0
Expand Down Expand Up @@ -125,3 +125,31 @@ test-suite cannon-tests
, uuid
, wai-utilities
default-language: Haskell2010

benchmark cannon-bench
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Paths_cannon
hs-source-dirs:
bench
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DerivingVia DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path -threaded -with-rtsopts=-N
build-depends:
QuickCheck >=2.7
, async
, base
, bytestring
, cannon
, criterion >=1.0
, extended
, imports
, metrics-wai
, random >=1.0
, tasty >=0.8
, tasty-hunit >=0.8
, tasty-quickcheck >=0.8
, types-common
, uuid
, wai-utilities
default-language: Haskell2010
22 changes: 22 additions & 0 deletions services/cannon/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,28 @@ tests:
- types-common
- uuid
- wai-utilities
benchmarks:
cannon-bench:
main: Main.hs
source-dirs: bench
ghc-options:
- -threaded
- -with-rtsopts=-N
dependencies:
- async
- base
- bytestring
- cannon
- criterion >=1.0
- metrics-wai
- QuickCheck >=2.7
- random >=1.0
- tasty >=0.8
- tasty-hunit >=0.8
- tasty-quickcheck >=0.8
- types-common
- uuid
- wai-utilities
flags:
static:
description: Enable static linking
Expand Down
4 changes: 1 addition & 3 deletions services/cannon/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

module Main where

import qualified Bench as B
import qualified Cannon.API
import Data.Metrics.Test (pathsConsistencyCheck)
import Data.Metrics.WaiRoute (treeToPaths)
Expand All @@ -28,8 +27,7 @@ import Test.Tasty
import Test.Tasty.HUnit

main :: IO ()
main = do
B.benchmark
main =
defaultMain $
testGroup
"Tests"
Expand Down