Skip to content

Commit e44124f

Browse files
authored
Merge pull request #114 from haskellari/split-tests
Split most tests and benchmarks into separate package
2 parents 27ea59a + 615c236 commit e44124f

File tree

23 files changed

+205
-150
lines changed

23 files changed

+205
-150
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
125125
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
126126
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
127-
echo "ARG_BENCH=--disable-benchmarks" >> "$GITHUB_ENV"
127+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
128128
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
129129
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
130130
env:
@@ -192,6 +192,7 @@ jobs:
192192
run: |
193193
touch cabal.project
194194
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
195+
echo "packages: $GITHUB_WORKSPACE/source/splitmix-tests" >> cabal.project
195196
cat cabal.project
196197
- name: sdist
197198
run: |
@@ -205,19 +206,28 @@ jobs:
205206
run: |
206207
PKGDIR_splitmix="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/splitmix-[0-9.]*')"
207208
echo "PKGDIR_splitmix=${PKGDIR_splitmix}" >> "$GITHUB_ENV"
209+
PKGDIR_splitmix_tests="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/splitmix-tests-[0-9.]*')"
210+
echo "PKGDIR_splitmix_tests=${PKGDIR_splitmix_tests}" >> "$GITHUB_ENV"
208211
rm -f cabal.project cabal.project.local
209212
touch cabal.project
210213
touch cabal.project.local
211214
echo "packages: ${PKGDIR_splitmix}" >> cabal.project
215+
echo "packages: ${PKGDIR_splitmix_tests}" >> cabal.project
212216
echo "package splitmix" >> cabal.project
213217
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
218+
echo "package splitmix-tests" >> cabal.project
219+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
214220
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package splitmix" >> cabal.project ; fi
215221
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
222+
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package splitmix-tests" >> cabal.project ; fi
223+
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
216224
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package splitmix" >> cabal.project ; fi
217225
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi
226+
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package splitmix-tests" >> cabal.project ; fi
227+
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi
218228
cat >> cabal.project <<EOF
219229
EOF
220-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix)$/; }' >> cabal.project.local
230+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix|splitmix-tests)$/; }' >> cabal.project.local
221231
cat cabal.project
222232
cat cabal.project.local
223233
- name: dump install plan
@@ -230,10 +240,6 @@ jobs:
230240
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
231241
path: ~/.cabal/store
232242
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
233-
- name: install dependencies
234-
run: |
235-
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
236-
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
237243
- name: build w/o tests
238244
run: |
239245
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
@@ -251,6 +257,8 @@ jobs:
251257
run: |
252258
cd ${PKGDIR_splitmix} || false
253259
${CABAL} -vnormal check
260+
cd ${PKGDIR_splitmix_tests} || false
261+
${CABAL} -vnormal check
254262
- name: haddock
255263
run: |
256264
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
@@ -265,34 +273,29 @@ jobs:
265273
run: |
266274
$CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.12' all --dry-run
267275
cabal-plan topo | sort
268-
$CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.12' --dependencies-only -j2 all
269276
$CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.12' all
270277
$CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.12' all
271278
- name: constraint set bytestring-0.11
272279
run: |
273280
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.11' all --dry-run ; fi
274281
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then cabal-plan topo | sort ; fi
275-
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.11' --dependencies-only -j2 all ; fi
276282
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.11' all ; fi
277283
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>=0.11' all ; fi
278284
- name: constraint set time-1.12
279285
run: |
280286
if [ $((HCNUMVER >= 80800 && HCNUMVER < 91200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='time ^>=1.12' all --dry-run ; fi
281287
if [ $((HCNUMVER >= 80800 && HCNUMVER < 91200)) -ne 0 ] ; then cabal-plan topo | sort ; fi
282-
if [ $((HCNUMVER >= 80800 && HCNUMVER < 91200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='time ^>=1.12' --dependencies-only -j2 all ; fi
283288
if [ $((HCNUMVER >= 80800 && HCNUMVER < 91200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='time ^>=1.12' all ; fi
284289
if [ $((HCNUMVER >= 80800 && HCNUMVER < 91200)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='time ^>=1.12' all ; fi
285290
- name: constraint set time-1.11
286291
run: |
287292
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.11' all --dry-run ; fi
288293
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then cabal-plan topo | sort ; fi
289-
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.11' --dependencies-only -j2 all ; fi
290294
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.11' all ; fi
291295
- name: constraint set time-1.10
292296
run: |
293297
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.10' all --dry-run ; fi
294298
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then cabal-plan topo | sort ; fi
295-
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.10' --dependencies-only -j2 all ; fi
296299
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='time ^>=1.10' all ; fi
297300
- name: save cache
298301
if: always()

cabal.haskell-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
branches: master
22
docspec: True
3-
benchmarks: False
3+
install-dependencies: False
44
apt: hugs libhugs-time-bundled libtestu01-0-dev
55
head-hackage: False
66

cabal.project

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
packages: .
2+
packages: splitmix-tests
23

34
tests: True
5+
benchmarks: True

splitmix-tests/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2017, Oleg Grenrus
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Oleg Grenrus nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
module Main where
55

66
import Data.Bits
7-
import Data.Bits.Compat
87
import Data.List (unfoldr)
98
import Data.Word (Word32, Word64)
109

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
cabal-version: 2.4
2+
name: splitmix-tests
3+
version: 0
4+
synopsis: Fast Splittable PRNG
5+
description:
6+
Pure Haskell implementation of SplitMix described in ...
7+
more tests
8+
9+
license: BSD-3-Clause
10+
license-file: LICENSE
11+
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
12+
bug-reports: https://github.com/haskellari/splitmix/issues
13+
category: System, Random
14+
build-type: Simple
15+
tested-with:
16+
GHC ==8.6.5
17+
|| ==8.8.4
18+
|| ==8.10.4
19+
|| ==9.0.2
20+
|| ==9.2.8
21+
|| ==9.4.8
22+
|| ==9.6.7
23+
|| ==9.8.4
24+
|| ==9.10.2
25+
|| ==9.12.2
26+
27+
library
28+
default-language: Haskell2010
29+
hs-source-dirs: src
30+
exposed-modules: Dummy
31+
build-depends: base <5
32+
33+
source-repository head
34+
type: git
35+
location: https://github.com/haskellari/splitmix.git
36+
37+
benchmark comparison
38+
type: exitcode-stdio-1.0
39+
default-language: Haskell2010
40+
ghc-options: -Wall
41+
hs-source-dirs: bench
42+
main-is: Bench.hs
43+
build-depends:
44+
, base <5
45+
, containers >=0.6.0.1 && <0.8
46+
, criterion >=1.6.0.0 && <1.7
47+
, random
48+
, splitmix
49+
, tf-random >=0.5 && <0.6
50+
51+
benchmark simple-sum
52+
type: exitcode-stdio-1.0
53+
default-language: Haskell2010
54+
ghc-options: -Wall
55+
hs-source-dirs: bench
56+
main-is: SimpleSum.hs
57+
build-depends:
58+
, base <5
59+
, random
60+
, splitmix
61+
62+
benchmark range
63+
type: exitcode-stdio-1.0
64+
default-language: Haskell2010
65+
ghc-options: -Wall
66+
hs-source-dirs: bench
67+
main-is: Range.hs
68+
build-depends:
69+
, base <5
70+
, clock >=0.8.4 && <0.9
71+
, splitmix
72+
73+
test-suite splitmix-tests
74+
type: exitcode-stdio-1.0
75+
default-language: Haskell2010
76+
ghc-options: -Wall
77+
hs-source-dirs: tests
78+
main-is: splitmix-tests.hs
79+
other-modules:
80+
MiniQC
81+
Uniformity
82+
83+
build-depends:
84+
, base <5
85+
, containers >=0.4.0.0 && <0.8
86+
, HUnit >=1.6.0.0 && <1.7
87+
, math-functions >=0.3.3.0 && <0.4
88+
, splitmix
89+
, test-framework >=0.8.2.0 && <0.9
90+
, test-framework-hunit >=0.3.0.2 && <0.4
91+
92+
test-suite montecarlo-pi
93+
type: exitcode-stdio-1.0
94+
default-language: Haskell2010
95+
ghc-options: -Wall
96+
hs-source-dirs: tests
97+
main-is: SplitMixPi.hs
98+
build-depends:
99+
, base <5
100+
, splitmix
101+
102+
test-suite montecarlo-pi-32
103+
type: exitcode-stdio-1.0
104+
default-language: Haskell2010
105+
ghc-options: -Wall
106+
hs-source-dirs: tests
107+
main-is: SplitMixPi32.hs
108+
build-depends:
109+
, base <5
110+
, splitmix
111+
112+
test-suite splitmix-dieharder
113+
default-language: Haskell2010
114+
type: exitcode-stdio-1.0
115+
ghc-options: -Wall -threaded -rtsopts
116+
hs-source-dirs: tests
117+
main-is: Dieharder.hs
118+
build-depends:
119+
, async >=2.2.1 && <2.3
120+
, base <5
121+
, bytestring >=0.10.8.2 && <0.13
122+
, deepseq
123+
, process >=1.6.0.0 && <1.7
124+
, splitmix
125+
, tf-random >=0.5 && <0.6
126+
, vector >=0.13.2.0 && <0.14
127+
128+
test-suite splitmix-testu01
129+
if !os(linux)
130+
buildable: False
131+
132+
default-language: Haskell2010
133+
type: exitcode-stdio-1.0
134+
ghc-options: -Wall -threaded -rtsopts
135+
hs-source-dirs: tests
136+
main-is: TestU01.hs
137+
c-sources: tests/cbits/testu01.c
138+
extra-libraries: testu01
139+
build-depends:
140+
, base <5
141+
, splitmix
142+
143+
test-suite initialization
144+
default-language: Haskell2010
145+
type: exitcode-stdio-1.0
146+
ghc-options: -Wall -threaded -rtsopts
147+
hs-source-dirs: tests
148+
main-is: Initialization.hs
149+
build-depends:
150+
, base <5
151+
, HUnit >=1.6.0.0 && <1.7
152+
, splitmix

splitmix-tests/src/Dummy.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Dummy () where

0 commit comments

Comments
 (0)