mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-09-11 08:25:40 +03:00
Separate streamly tests into another package
To be able to use an internal test library, we need to have it as a separate package. See comments in streamly-benchmarks.cabal for details. Use a test library for common test modules Also, added "opt" flag to control optimization levels. Add a README for tests. Update benchmarks readme.
This commit is contained in:
parent
18109c6007
commit
b677d0ddc9
@ -193,6 +193,7 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
apt-get install -y ghc-8.2.2
|
apt-get install -y ghc-8.2.2
|
||||||
apt-get install -y cabal-install-3.2
|
apt-get install -y cabal-install-3.2
|
||||||
|
apt-get install libtinfo-dev
|
||||||
bash -c "$PACKCHECK $BUILD"
|
bash -c "$PACKCHECK $BUILD"
|
||||||
- *save
|
- *save
|
||||||
cabal-ghc-8_0_2:
|
cabal-ghc-8_0_2:
|
||||||
|
@ -1,11 +1,77 @@
|
|||||||
## Running Benchmarks
|
## Building a single benchmark suite
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build streamly-benchmarks:Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --enable-benchmarks bench:Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building all benchmarks suites
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --enable-benchmarks streamly-benchmarks
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --enable-benchmarks all
|
||||||
|
```
|
||||||
|
|
||||||
|
Disable optimization, quick build:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --flag "-opt" ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build and run single benchmarks:
|
||||||
|
|
||||||
|
For quick results you may have to use `--quick` and possibly some other
|
||||||
|
`gauge` options, or better use `bench.sh --quick` as described in the
|
||||||
|
following sections.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal run bench:Prelude.Serial -- --quick
|
||||||
|
```
|
||||||
|
|
||||||
|
`cabal bench` can be used but you cannot pass arguments (like --quick):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal bench Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build and run all benchmarks
|
||||||
|
|
||||||
|
Don't try this, it will take too long, use the `bench.sh` method instead.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal bench all
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd benchmark; cabal bench
|
||||||
|
```
|
||||||
|
|
||||||
|
or this, note this command does not work from "benchmark" dir:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal bench streamly-benchmarks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building and Running Benchmarks with bench.sh
|
||||||
|
|
||||||
`bench.sh` script at the root of the repo is the top level driver for running
|
`bench.sh` script at the root of the repo is the top level driver for running
|
||||||
benchmarks. It runs the requested benchmarks and then creates a report from the
|
benchmarks. It runs the requested benchmarks and then creates a report from the
|
||||||
results using the `bench-show` package. Try `bench.sh --help` for available
|
results using the `bench-show` package. Try `bench.sh --help` for available
|
||||||
options to run it.
|
options to run it.
|
||||||
|
|
||||||
## Quick start
|
## bench.sh: Quick start
|
||||||
|
|
||||||
You must be in the repo root directory to run these commands.
|
You must be in the repo root directory to run these commands.
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ description: Benchmarks are separated from the main package because we
|
|||||||
for serial, async, ahead style streams, therefore, we need to use
|
for serial, async, ahead style streams, therefore, we need to use
|
||||||
the common code in several benchmarks, just changing the type of
|
the common code in several benchmarks, just changing the type of
|
||||||
the stream. It takes a long time to compile this file and it gets
|
the stream. It takes a long time to compile this file and it gets
|
||||||
compiled for each benchmarks once if we do not have a library. Cabal
|
compiled for each benchmark once if we do not have a library. Cabal
|
||||||
does no support internal libraries without per-component builds and
|
does not support internal libraries without per-component builds and
|
||||||
per-component builds are not supported with Configure, so we are not
|
per-component builds are not supported with Configure, so we are not
|
||||||
left with any other choice.
|
left with any other choice.
|
||||||
|
|
||||||
@ -44,6 +44,11 @@ flag no-charts
|
|||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
|
flag opt
|
||||||
|
description: off=-O0 (faster builds), on=-O2
|
||||||
|
manual: True
|
||||||
|
default: True
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Common stanzas
|
-- Common stanzas
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -78,19 +83,16 @@ common compile-options
|
|||||||
ghc-options: -fno-ignore-asserts
|
ghc-options: -fno-ignore-asserts
|
||||||
|
|
||||||
common optimization-options
|
common optimization-options
|
||||||
ghc-options: -O2
|
if flag(opt)
|
||||||
-fdicts-strict
|
ghc-options: -O2
|
||||||
-fspec-constr-recursive=16
|
-fdicts-strict
|
||||||
-fmax-worker-args=16
|
-fspec-constr-recursive=16
|
||||||
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
-fmax-worker-args=16
|
||||||
ghc-options: -fplugin Fusion.Plugin
|
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
||||||
|
ghc-options: -fplugin Fusion.Plugin
|
||||||
|
else
|
||||||
|
ghc-options: -O0
|
||||||
|
|
||||||
-- We need optimization options here to optimize internal (non-inlined)
|
|
||||||
-- versions of functions. Also, we have some benchmarking inspection tests
|
|
||||||
-- part of the library when built with --benchmarks flag. Thos tests fail
|
|
||||||
-- if we do not use optimization options here. It was observed that due to
|
|
||||||
-- -O2 here some concurrent/nested benchmarks improved and others regressed.
|
|
||||||
-- We can investigate a bit more here why the regression occurred.
|
|
||||||
common lib-options
|
common lib-options
|
||||||
import: compile-options, optimization-options
|
import: compile-options, optimization-options
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
packages: streamly.cabal
|
packages: streamly.cabal
|
||||||
, benchmark/streamly-benchmarks.cabal
|
, test/streamly-tests.cabal
|
||||||
|
, benchmark/streamly-benchmarks.cabal
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,3 +17,6 @@ package streamly
|
|||||||
package streamly-benchmarks
|
package streamly-benchmarks
|
||||||
ghc-options: -Werror
|
ghc-options: -Werror
|
||||||
flags: inspection
|
flags: inspection
|
||||||
|
|
||||||
|
package streamly-tests
|
||||||
|
ghc-options: -Werror
|
||||||
|
@ -51,6 +51,9 @@ let haskellPackages =
|
|||||||
streamly-benchmarks =
|
streamly-benchmarks =
|
||||||
mkPackage super "streamly-benchmarks"
|
mkPackage super "streamly-benchmarks"
|
||||||
./benchmark flags inShell;
|
./benchmark flags inShell;
|
||||||
|
streamly-tests =
|
||||||
|
mkPackage super "streamly-tests"
|
||||||
|
./test flags inShell;
|
||||||
|
|
||||||
# Example to Use a different version of a package
|
# Example to Use a different version of a package
|
||||||
#QuickCheck = self.QuickCheck_2_14;
|
#QuickCheck = self.QuickCheck_2_14;
|
||||||
@ -78,6 +81,7 @@ let haskellPackages =
|
|||||||
packages = p:
|
packages = p:
|
||||||
[ p.streamly
|
[ p.streamly
|
||||||
p.streamly-benchmarks
|
p.streamly-benchmarks
|
||||||
|
p.streamly-tests
|
||||||
];
|
];
|
||||||
# some dependencies of hoogle fail to build with quickcheck-2.14
|
# some dependencies of hoogle fail to build with quickcheck-2.14
|
||||||
# We should use hoogle as external tool instead of building it here
|
# We should use hoogle as external tool instead of building it here
|
||||||
|
@ -2,6 +2,7 @@ resolver: lts-16.12
|
|||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
- './benchmark'
|
- './benchmark'
|
||||||
|
- './test'
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
|
- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
|
||||||
- QuickCheck-2.14.1@sha256:01e46d7b0a8d3148288ec977625f62d5516ebb5031a50c63f0453863301b4a79,7736
|
- QuickCheck-2.14.1@sha256:01e46d7b0a8d3148288ec977625f62d5516ebb5031a50c63f0453863301b4a79,7736
|
||||||
|
259
streamly.cabal
259
streamly.cabal
@ -157,7 +157,21 @@ extra-source-files:
|
|||||||
src/Streamly/Internal/FileSystem/Event/Darwin.h
|
src/Streamly/Internal/FileSystem/Event/Darwin.h
|
||||||
src/config.h.in
|
src/config.h.in
|
||||||
src/inline.hs
|
src/inline.hs
|
||||||
|
test/README.md
|
||||||
test/Streamly/Test/Common/Array.hs
|
test/Streamly/Test/Common/Array.hs
|
||||||
|
test/Streamly/Test/Data/*.hs
|
||||||
|
test/Streamly/Test/Data/Array/Prim.hs
|
||||||
|
test/Streamly/Test/Data/Array/Prim/Pinned.hs
|
||||||
|
test/Streamly/Test/Data/Array/Storable/Foreign.hs
|
||||||
|
test/Streamly/Test/Data/Parser/ParserD.hs
|
||||||
|
test/Streamly/Test/FileSystem/Event.hs
|
||||||
|
test/Streamly/Test/Prelude.hs
|
||||||
|
test/Streamly/Test/Prelude/*.hs
|
||||||
|
test/Streamly/Test/Unicode/Stream.hs
|
||||||
|
test/lib/Streamly/Test/Common.hs
|
||||||
|
test/lib/Streamly/Test/Prelude/Common.hs
|
||||||
|
test/streamly-tests.cabal
|
||||||
|
test/version-bounds.hs
|
||||||
stack.yaml
|
stack.yaml
|
||||||
|
|
||||||
extra-tmp-files:
|
extra-tmp-files:
|
||||||
@ -210,6 +224,11 @@ flag use-c-malloc
|
|||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
|
flag opt
|
||||||
|
description: off=GHC default, on=-O2
|
||||||
|
manual: True
|
||||||
|
default: True
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Common stanzas
|
-- Common stanzas
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -296,10 +315,11 @@ common default-extensions
|
|||||||
-- UnboxedTuples -- interferes with (#.)
|
-- UnboxedTuples -- interferes with (#.)
|
||||||
|
|
||||||
common optimization-options
|
common optimization-options
|
||||||
ghc-options: -O2
|
if flag(opt)
|
||||||
-fdicts-strict
|
ghc-options: -O2
|
||||||
-fspec-constr-recursive=16
|
-fdicts-strict
|
||||||
-fmax-worker-args=16
|
-fspec-constr-recursive=16
|
||||||
|
-fmax-worker-args=16
|
||||||
|
|
||||||
common threading-options
|
common threading-options
|
||||||
ghc-options: -threaded
|
ghc-options: -threaded
|
||||||
@ -314,50 +334,6 @@ common threading-options
|
|||||||
common lib-options
|
common lib-options
|
||||||
import: compile-options, optimization-options, default-extensions
|
import: compile-options, optimization-options, default-extensions
|
||||||
|
|
||||||
common test-dependencies
|
|
||||||
build-depends:
|
|
||||||
streamly
|
|
||||||
, base >= 4.9 && < 5
|
|
||||||
, containers >= 0.5 && < 0.7
|
|
||||||
, exceptions >= 0.8 && < 0.11
|
|
||||||
, ghc
|
|
||||||
, hspec >= 2.0 && < 3
|
|
||||||
, mtl >= 2.2 && < 3
|
|
||||||
, random >= 1.0.0 && < 2
|
|
||||||
, transformers >= 0.4 && < 0.6
|
|
||||||
, QuickCheck >= 2.13 && < 2.15
|
|
||||||
, directory >= 1.2.2 && < 1.4
|
|
||||||
, filepath >= 1.4.1 && < 1.5
|
|
||||||
, temporary >= 1.3 && < 1.4
|
|
||||||
|
|
||||||
-- Compilation for coverage builds on CI machines takes too long without -O0
|
|
||||||
-- XXX we should use coverage flag for that, -O0 may take too long to run tests
|
|
||||||
-- in general.
|
|
||||||
common test-options
|
|
||||||
import: compile-options, threading-options, default-extensions
|
|
||||||
,test-dependencies
|
|
||||||
|
|
||||||
ghc-options: -O0
|
|
||||||
-fno-ignore-asserts
|
|
||||||
include-dirs: test
|
|
||||||
-- XXX we need -O for plugin to work
|
|
||||||
-- if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
|
||||||
-- ghc-options: -fplugin Fusion.Plugin
|
|
||||||
-- build-depends:
|
|
||||||
-- fusion-plugin >= 0.2 && < 0.3
|
|
||||||
|
|
||||||
hs-source-dirs: test
|
|
||||||
js-sources: jsbits/clock.js
|
|
||||||
default-language: Haskell2010
|
|
||||||
|
|
||||||
-- Used by maxrate test, benchmarks and executables
|
|
||||||
common exe-options
|
|
||||||
import: compile-options, optimization-options, threading-options
|
|
||||||
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
|
||||||
ghc-options: -fplugin Fusion.Plugin
|
|
||||||
build-depends:
|
|
||||||
fusion-plugin >= 0.2 && < 0.3
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Library
|
-- Library
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -558,190 +534,3 @@ library
|
|||||||
-- tests fail
|
-- tests fail
|
||||||
if flag(dev) && flag(inspection)
|
if flag(dev) && flag(inspection)
|
||||||
build-depends: inspection-and-dev-flags-cannot-be-used-together
|
build-depends: inspection-and-dev-flags-cannot-be-used-together
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
-- Test suites
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
test-suite Data.List.Base
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/List.hs
|
|
||||||
|
|
||||||
test-suite Data.List
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/List.hs
|
|
||||||
cpp-options: -DUSE_STREAMLY_LIST
|
|
||||||
|
|
||||||
test-suite Prelude
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.main
|
|
||||||
|
|
||||||
test-suite Prelude.Serial
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Serial.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Serial.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.WSerial
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/WSerial.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.WSerial.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.ZipSerial
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/ZipSerial.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.ZipSerial.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.ZipAsync
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/ZipAsync.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.ZipAsync.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.Ahead
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Ahead.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Ahead.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.Async
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Async.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Async.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.WAsync
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/WAsync.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.WAsync.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.Parallel
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Parallel.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Parallel.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.Concurrent
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Concurrent.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Concurrent.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
build-depends: mtl >= 2.2 && < 3
|
|
||||||
|
|
||||||
test-suite Prelude.Fold
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/Fold.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.Fold.main
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
, Streamly.Test.Prelude.Common
|
|
||||||
|
|
||||||
test-suite Prelude.MaxRate
|
|
||||||
import: test-options, exe-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Prelude/MaxRate.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Prelude.MaxRate.main
|
|
||||||
if flag(dev)
|
|
||||||
buildable: True
|
|
||||||
else
|
|
||||||
buildable: False
|
|
||||||
|
|
||||||
test-suite Data.Array.Storable.Foreign
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Array/Storable/Foreign.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Data.Array.Storable.Foreign.main
|
|
||||||
|
|
||||||
test-suite Data.Fold
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Fold.hs
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
|
|
||||||
test-suite Data.Unfold
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Unfold.hs
|
|
||||||
hs-source-dirs: test
|
|
||||||
|
|
||||||
test-suite Data.Parser
|
|
||||||
import: test-options
|
|
||||||
ghc-options: -O2
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Parser.hs
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
|
|
||||||
test-suite Data.Parser.ParserD
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Parser/ParserD.hs
|
|
||||||
other-modules: Streamly.Test.Common
|
|
||||||
|
|
||||||
test-suite Data.Array
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Array.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Data.Array.main
|
|
||||||
|
|
||||||
test-suite Data.SmallArray
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/SmallArray.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Data.SmallArray.main
|
|
||||||
|
|
||||||
test-suite Data.Array.Prim
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Array/Prim.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Data.Array.Prim.main
|
|
||||||
|
|
||||||
test-suite Data.Array.Prim.Pinned
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Data/Array/Prim/Pinned.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Data.Array.Prim.Pinned.main
|
|
||||||
|
|
||||||
test-suite Unicode.Stream
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/Unicode/Stream.hs
|
|
||||||
ghc-options: -main-is Streamly.Test.Unicode.Stream.main
|
|
||||||
|
|
||||||
test-suite version-bounds
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: version-bounds.hs
|
|
||||||
|
|
||||||
test-suite FileSystem.Event
|
|
||||||
import: test-options
|
|
||||||
type: exitcode-stdio-1.0
|
|
||||||
main-is: Streamly/Test/FileSystem/Event.hs
|
|
||||||
hs-source-dirs: test
|
|
||||||
default-language: Haskell2010
|
|
||||||
if os(darwin)
|
|
||||||
buildable: False
|
|
||||||
|
80
test/README.md
Normal file
80
test/README.md
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
## Build a single test
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build test:Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd test; cabal build Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
Build with optimizations:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --flag opt ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build all tests
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --enable-tests all
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd test; cabal build --enable-tests
|
||||||
|
```
|
||||||
|
|
||||||
|
Or this, note this command does not work as expected when in the "test" dir:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal build --enable-tests streamly-tests
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build and run
|
||||||
|
|
||||||
|
Running all test suites, use any of the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal test all
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd test; cabal test
|
||||||
|
```
|
||||||
|
|
||||||
|
Or this, note this command does not work as expected when in the "test" dir:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal test streamly-tests
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build and Run a single test suite
|
||||||
|
|
||||||
|
To run `Prelude.Serial` test-suite:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cabal run test:Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd test; cabal run Prelude.Serial
|
||||||
|
```
|
||||||
|
|
||||||
|
Note you could use `cabal test Prelude.Serial` but that unfortunately builds
|
||||||
|
all the test suites before running `Prelude.Serial`.
|
||||||
|
|
||||||
|
## Naming of test modules
|
||||||
|
|
||||||
|
Tests are organized by source modules. For example, for the source
|
||||||
|
module `Streamly.Data.Array` and `Streamly.Internal.Data.Array` we have
|
||||||
|
a test module `Data.Array`. For some modules tests for a source module
|
||||||
|
are broken into multiple modules. For example, for `Streamly.Prelude` we have
|
||||||
|
`Streamly.Prelude.Serial`, `Streamly.Prelude.Async` etc.
|
327
test/streamly-tests.cabal
Normal file
327
test/streamly-tests.cabal
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
cabal-version: 2.2
|
||||||
|
name: streamly-tests
|
||||||
|
version: 0.0.0
|
||||||
|
synopsis: Tests for streamly
|
||||||
|
description: See streamly-benchmarks for the reason why we use a separate
|
||||||
|
package for tests.
|
||||||
|
|
||||||
|
flag fusion-plugin
|
||||||
|
description: Use fusion plugin for benchmarks and executables
|
||||||
|
manual: True
|
||||||
|
default: False
|
||||||
|
|
||||||
|
flag dev
|
||||||
|
description: Development build
|
||||||
|
manual: True
|
||||||
|
default: False
|
||||||
|
|
||||||
|
flag has-llvm
|
||||||
|
description: Use llvm backend for better performance
|
||||||
|
manual: True
|
||||||
|
default: False
|
||||||
|
|
||||||
|
flag opt
|
||||||
|
description: off=-O0 (faster builds), on=-O2
|
||||||
|
manual: True
|
||||||
|
default: True
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- Common stanzas
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
common compile-options
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
if os(darwin)
|
||||||
|
cpp-options: -DCABAL_OS_DARWIN
|
||||||
|
|
||||||
|
if os(linux)
|
||||||
|
cpp-options: -DCABAL_OS_LINUX
|
||||||
|
|
||||||
|
if os(windows)
|
||||||
|
cpp-options: -DCABAL_OS_WINDOWS
|
||||||
|
|
||||||
|
if flag(dev)
|
||||||
|
cpp-options: -DDEVBUILD
|
||||||
|
|
||||||
|
ghc-options: -Wall
|
||||||
|
-Wcompat
|
||||||
|
-Wunrecognised-warning-flags
|
||||||
|
-Widentities
|
||||||
|
-Wincomplete-record-updates
|
||||||
|
-Wincomplete-uni-patterns
|
||||||
|
-Wredundant-constraints
|
||||||
|
-Wnoncanonical-monad-instances
|
||||||
|
-Rghc-timing
|
||||||
|
|
||||||
|
if flag(has-llvm)
|
||||||
|
ghc-options: -fllvm
|
||||||
|
|
||||||
|
if flag(dev)
|
||||||
|
ghc-options: -Wmissed-specialisations
|
||||||
|
-Wall-missed-specialisations
|
||||||
|
|
||||||
|
ghc-options: -fno-ignore-asserts
|
||||||
|
|
||||||
|
common default-extensions
|
||||||
|
default-extensions:
|
||||||
|
BangPatterns
|
||||||
|
CApiFFI
|
||||||
|
CPP
|
||||||
|
ConstraintKinds
|
||||||
|
DeriveDataTypeable
|
||||||
|
DeriveGeneric
|
||||||
|
DeriveTraversable
|
||||||
|
ExistentialQuantification
|
||||||
|
FlexibleContexts
|
||||||
|
FlexibleInstances
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
InstanceSigs
|
||||||
|
KindSignatures
|
||||||
|
LambdaCase
|
||||||
|
MagicHash
|
||||||
|
MultiParamTypeClasses
|
||||||
|
PatternSynonyms
|
||||||
|
RankNTypes
|
||||||
|
RecordWildCards
|
||||||
|
ScopedTypeVariables
|
||||||
|
TupleSections
|
||||||
|
TypeFamilies
|
||||||
|
ViewPatterns
|
||||||
|
|
||||||
|
-- MonoLocalBinds, enabled by TypeFamilies, causes performance
|
||||||
|
-- regressions. Disable it. This must come after TypeFamilies,
|
||||||
|
-- otherwise TypeFamilies will enable it again.
|
||||||
|
NoMonoLocalBinds
|
||||||
|
|
||||||
|
-- UndecidableInstances -- Does not show any perf impact
|
||||||
|
-- UnboxedTuples -- interferes with (#.)
|
||||||
|
|
||||||
|
common threading-options
|
||||||
|
ghc-options: -threaded
|
||||||
|
-with-rtsopts=-N
|
||||||
|
|
||||||
|
common optimization-options
|
||||||
|
if flag(opt)
|
||||||
|
ghc-options: -O2
|
||||||
|
-fdicts-strict
|
||||||
|
-fmax-worker-args=16
|
||||||
|
-fspec-constr-recursive=16
|
||||||
|
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
||||||
|
ghc-options: -fplugin Fusion.Plugin
|
||||||
|
else
|
||||||
|
ghc-options: -O0
|
||||||
|
|
||||||
|
common test-dependencies
|
||||||
|
build-depends:
|
||||||
|
streamly
|
||||||
|
, base >= 4.9 && < 5
|
||||||
|
, containers >= 0.5 && < 0.7
|
||||||
|
, exceptions >= 0.8 && < 0.11
|
||||||
|
, ghc
|
||||||
|
, hspec >= 2.0 && < 3
|
||||||
|
, mtl >= 2.2 && < 3
|
||||||
|
, random >= 1.0.0 && < 2
|
||||||
|
, transformers >= 0.4 && < 0.6
|
||||||
|
, QuickCheck >= 2.13 && < 2.15
|
||||||
|
, directory >= 1.2.2 && < 1.4
|
||||||
|
, filepath >= 1.4.1 && < 1.5
|
||||||
|
, temporary >= 1.3 && < 1.4
|
||||||
|
|
||||||
|
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
||||||
|
build-depends:
|
||||||
|
fusion-plugin >= 0.2 && < 0.3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- Library
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
common lib-options
|
||||||
|
import: compile-options
|
||||||
|
, optimization-options
|
||||||
|
, threading-options
|
||||||
|
, default-extensions
|
||||||
|
, test-dependencies
|
||||||
|
|
||||||
|
library
|
||||||
|
import: lib-options, test-dependencies
|
||||||
|
hs-source-dirs: lib
|
||||||
|
exposed-modules: Streamly.Test.Common
|
||||||
|
, Streamly.Test.Prelude.Common
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
-- Test suites
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
common test-options
|
||||||
|
import: lib-options
|
||||||
|
include-dirs: .
|
||||||
|
build-depends: streamly-tests
|
||||||
|
|
||||||
|
common always-optimized
|
||||||
|
import: compile-options
|
||||||
|
, threading-options
|
||||||
|
, default-extensions
|
||||||
|
, test-dependencies
|
||||||
|
ghc-options: -O2
|
||||||
|
-fdicts-strict
|
||||||
|
-fmax-worker-args=16
|
||||||
|
-fspec-constr-recursive=16
|
||||||
|
if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
|
||||||
|
ghc-options: -fplugin Fusion.Plugin
|
||||||
|
|
||||||
|
test-suite Data.List.Base
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/List.hs
|
||||||
|
|
||||||
|
test-suite Data.List
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/List.hs
|
||||||
|
cpp-options: -DUSE_STREAMLY_LIST
|
||||||
|
|
||||||
|
test-suite Prelude
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.main
|
||||||
|
|
||||||
|
test-suite Prelude.Serial
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Serial.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Serial.main
|
||||||
|
|
||||||
|
test-suite Prelude.WSerial
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/WSerial.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.WSerial.main
|
||||||
|
|
||||||
|
test-suite Prelude.ZipSerial
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/ZipSerial.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.ZipSerial.main
|
||||||
|
|
||||||
|
test-suite Prelude.ZipAsync
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/ZipAsync.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.ZipAsync.main
|
||||||
|
|
||||||
|
test-suite Prelude.Ahead
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Ahead.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Ahead.main
|
||||||
|
|
||||||
|
test-suite Prelude.Async
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Async.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Async.main
|
||||||
|
|
||||||
|
test-suite Prelude.WAsync
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/WAsync.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.WAsync.main
|
||||||
|
|
||||||
|
test-suite Prelude.Parallel
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Parallel.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Parallel.main
|
||||||
|
|
||||||
|
test-suite Prelude.Concurrent
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Concurrent.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Concurrent.main
|
||||||
|
|
||||||
|
test-suite Prelude.Fold
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/Fold.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.Fold.main
|
||||||
|
|
||||||
|
test-suite Prelude.MaxRate
|
||||||
|
import:always-optimized
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Prelude/MaxRate.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Prelude.MaxRate.main
|
||||||
|
if flag(dev)
|
||||||
|
buildable: True
|
||||||
|
else
|
||||||
|
buildable: False
|
||||||
|
|
||||||
|
test-suite Data.Array.Storable.Foreign
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Array/Storable/Foreign.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Data.Array.Storable.Foreign.main
|
||||||
|
|
||||||
|
test-suite Data.Fold
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Fold.hs
|
||||||
|
|
||||||
|
test-suite Data.Unfold
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Unfold.hs
|
||||||
|
|
||||||
|
test-suite Data.Parser
|
||||||
|
import: test-options
|
||||||
|
ghc-options: -O2
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Parser.hs
|
||||||
|
|
||||||
|
test-suite Data.Parser.ParserD
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Parser/ParserD.hs
|
||||||
|
|
||||||
|
test-suite Data.Array
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Array.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Data.Array.main
|
||||||
|
|
||||||
|
test-suite Data.SmallArray
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/SmallArray.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Data.SmallArray.main
|
||||||
|
|
||||||
|
test-suite Data.Array.Prim
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Array/Prim.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Data.Array.Prim.main
|
||||||
|
|
||||||
|
test-suite Data.Array.Prim.Pinned
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Data/Array/Prim/Pinned.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Data.Array.Prim.Pinned.main
|
||||||
|
|
||||||
|
test-suite Unicode.Stream
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/Unicode/Stream.hs
|
||||||
|
ghc-options: -main-is Streamly.Test.Unicode.Stream.main
|
||||||
|
|
||||||
|
test-suite version-bounds
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: version-bounds.hs
|
||||||
|
|
||||||
|
test-suite FileSystem.Event
|
||||||
|
import: test-options
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
main-is: Streamly/Test/FileSystem/Event.hs
|
||||||
|
if os(darwin)
|
||||||
|
buildable: False
|
Loading…
Reference in New Issue
Block a user