on master help sign in
Factor out targets.sh to be used in test.sh as well
commit0cbcf0b4ab87c7a705a6bdc44ba258b2065c8bf2 authorHarendra Kumar <harendra@composewell.com> dateSun 4 Jul 2021, 19:00 (5 years ago) parentcffe012
4 files changed+131−113
bin/bench-config.sh+6−108 bin/targets.sh+117 bin/test.sh+7−5 streamly.cabal+1
bin/bench-config.sh+6−108
@@ -1,5 +1,9 @@
11#!/usr/bin/env bash
22
3+BENCH_CONFIG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
4+source $BENCH_CONFIG_DIR/targets.sh \
5+ || { echo "Cannot source $BENCH_CONFIG_DIR/targets.sh"; exit 1; }
6+
37# Customization options
48bench_config () {
59 BENCH_REPORT_DIR=benchmark/bench-report
@@ -11,117 +15,11 @@ bench_config () {
1115}
1216
1317#------------------------------------------------------------------------------
14−# test and benchmark groups
18+# benchmark groups
1519#------------------------------------------------------------------------------
1620
17−# IMPORTANT NOTE: the names "_grp" and "_cmp" suffixes are special, do
18−# not rename them to something else.
19−
2021bench_targets () {
21− base_stream_grp="\
22− `bench_only Data.Stream.StreamD` \
23− `bench_only Data.Stream.StreamK` \
24− `bench_only Data.Stream.StreamDK`"
25−
26− prelude_serial_grp="\
27− Prelude.Serial \
28− Prelude.WSerial \
29− Prelude.ZipSerial"
30−
31− prelude_concurrent_grp="\
32− Prelude.Async \
33− Prelude.WAsync \
34− Prelude.Ahead \
35− Prelude.Parallel \
36− Prelude.ZipAsync"
37−
38− prelude_other_grp="\
39− `test_only Prelude` \
40− $(test_only $(dev_build Prelude.Rate)) \
41− `bench_only Prelude.Rate` \
42− `test_only Prelude.Fold` \
43− `test_only Prelude.Concurrent` \
44− $(bench_only $(dev_build Prelude.Concurrent)) \
45− `bench_only Prelude.Adaptive`"
46−
47− array_grp="\
48− Data.Array \
49− Data.Array.Foreign \
50− Data.Array.Prim \
51− Data.SmallArray \
52− Data.Array.Prim.Pinned"
53−
54− base_parser_grp="\
55− Data.Parser.ParserD \
56− `bench_only Data.Parser.ParserK`"
57−
58− parser_grp="\
59− Data.Fold \
60− Data.Parser"
61−
62− list_grp="\
63− `test_only Data.List.Base` \
64− `test_only Data.List`"
65−
66− #------------------------------------------------------------------------------
67− # Streaming vs non-streaming
68− #------------------------------------------------------------------------------
69− # The "o-1-space" groups of these benchmarks are run with long stream
70− # sizes when --long option is used.
71−
72− infinite_grp="\
73− $prelude_serial_grp \
74− $prelude_concurrent_grp \
75− `bench_only Prelude.Rate`"
76−
77− #------------------------------------------------------------------------------
78− # Benchmark comparison groups
79− #------------------------------------------------------------------------------
80−
81− # *_cmp denotes a comparison benchmark, the benchmarks provided in *_cmp
82− # variables are compared with each other
83− base_stream_cmp="Data.Stream.StreamD Data.Stream.StreamK"
84− serial_wserial_cmp="Prelude.Serial Prelude.WSerial"
85− serial_async_cmp="Prelude.Serial Prelude.Async"
86− concurrent_cmp="Prelude.Async Prelude.WAsync Prelude.Ahead Prelude.Parallel"
87− array_cmp="Memory.Array Data.Array.Prim Data.Array Data.Array.Prim.Pinned"
88− pinned_array_cmp="Memory.Array Data.Array.Prim.Pinned"
89− base_parser_cmp=$base_parser_grp
90−
91− COMPARISONS="\
92− base_stream_cmp \
93− serial_wserial_cmp \
94− serial_async_cmp \
95− concurrent_cmp \
96− array_cmp \
97− pinned_array_cmp \
98− base_parser_cmp"
99−
100− #------------------------------------------------------------------------------
101− # All test/benchmark modules must be in at least one of these
102− #------------------------------------------------------------------------------
103−
104− # All groups
105− GROUP_TARGETS="\
106− base_stream_grp \
107− prelude_serial_grp \
108− prelude_concurrent_grp \
109− prelude_other_grp \
110− array_grp \
111− base_parser_grp \
112− parser_grp \
113− list_grp \
114− infinite_grp"
115−
116− # Not in any groups
117− INDIVIDUAL_TARGETS="\
118− Data.Unfold \
119− Unicode.Stream \
120− FileSystem.Handle \
121− `test_only FileSystem.Event` \
122− `test_only Network.Socket` \
123− `test_only Network.Inet.TCP` \
124− `test_only version-bounds`"
22+ targets
12523}
12624
12725#------------------------------------------------------------------------------
bin/targets.shnew file+117
@@ -0,0 +1,117 @@
1+#------------------------------------------------------------------------------
2+# test and benchmark groups
3+#------------------------------------------------------------------------------
4+
5+# Depends on RUNNING_TESTS, RUNNING_BENCHMARKS, RUNNING_DEVBUILD variables
6+# being set for dev_build, test_only, bench_only functions to work. So the
7+# "targets" fucntion should be called only after these are set.
8+
9+# IMPORTANT NOTE: the names "_grp" and "_cmp" suffixes are special, do
10+# not rename them to something else.
11+
12+targets () {
13+ base_stream_grp="\
14+ `bench_only Data.Stream.StreamD` \
15+ `bench_only Data.Stream.StreamK` \
16+ `bench_only Data.Stream.StreamDK`"
17+
18+ prelude_serial_grp="\
19+ Prelude.Serial \
20+ Prelude.WSerial \
21+ Prelude.ZipSerial"
22+
23+ prelude_concurrent_grp="\
24+ Prelude.Async \
25+ Prelude.WAsync \
26+ Prelude.Ahead \
27+ Prelude.Parallel \
28+ Prelude.ZipAsync"
29+
30+ prelude_other_grp="\
31+ `test_only Prelude` \
32+ $(test_only $(dev_build Prelude.Rate)) \
33+ `bench_only Prelude.Rate` \
34+ `test_only Prelude.Fold` \
35+ `test_only Prelude.Concurrent` \
36+ $(bench_only $(dev_build Prelude.Concurrent)) \
37+ `bench_only Prelude.Adaptive`"
38+
39+ array_grp="\
40+ Data.Array \
41+ Data.Array.Foreign \
42+ Data.Array.Prim \
43+ Data.SmallArray \
44+ Data.Array.Prim.Pinned"
45+
46+ base_parser_grp="\
47+ Data.Parser.ParserD \
48+ `bench_only Data.Parser.ParserK`"
49+
50+ parser_grp="\
51+ Data.Fold \
52+ Data.Parser"
53+
54+ list_grp="\
55+ `test_only Data.List.Base` \
56+ `test_only Data.List`"
57+
58+ #------------------------------------------------------------------------------
59+ # Streaming vs non-streaming
60+ #------------------------------------------------------------------------------
61+ # The "o-1-space" groups of these benchmarks are run with long stream
62+ # sizes when --long option is used.
63+
64+ infinite_grp="\
65+ $prelude_serial_grp \
66+ $prelude_concurrent_grp \
67+ `bench_only Prelude.Rate`"
68+
69+ #------------------------------------------------------------------------------
70+ # Benchmark comparison groups
71+ #------------------------------------------------------------------------------
72+
73+ # *_cmp denotes a comparison benchmark, the benchmarks provided in *_cmp
74+ # variables are compared with each other
75+ base_stream_cmp="Data.Stream.StreamD Data.Stream.StreamK"
76+ serial_wserial_cmp="Prelude.Serial Prelude.WSerial"
77+ serial_async_cmp="Prelude.Serial Prelude.Async"
78+ concurrent_cmp="Prelude.Async Prelude.WAsync Prelude.Ahead Prelude.Parallel"
79+ array_cmp="Memory.Array Data.Array.Prim Data.Array Data.Array.Prim.Pinned"
80+ pinned_array_cmp="Memory.Array Data.Array.Prim.Pinned"
81+ base_parser_cmp=$base_parser_grp
82+
83+ COMPARISONS="\
84+ base_stream_cmp \
85+ serial_wserial_cmp \
86+ serial_async_cmp \
87+ concurrent_cmp \
88+ array_cmp \
89+ pinned_array_cmp \
90+ base_parser_cmp"
91+
92+ #------------------------------------------------------------------------------
93+ # All test/benchmark modules must be in at least one of these
94+ #------------------------------------------------------------------------------
95+
96+ # All groups
97+ GROUP_TARGETS="\
98+ base_stream_grp \
99+ prelude_serial_grp \
100+ prelude_concurrent_grp \
101+ prelude_other_grp \
102+ array_grp \
103+ base_parser_grp \
104+ parser_grp \
105+ list_grp \
106+ infinite_grp"
107+
108+ # Not in any groups
109+ INDIVIDUAL_TARGETS="\
110+ Data.Unfold \
111+ Unicode.Stream \
112+ FileSystem.Handle \
113+ `test_only FileSystem.Event` \
114+ `test_only Network.Socket` \
115+ `test_only Network.Inet.TCP` \
116+ `test_only version-bounds`"
117+}
bin/test.sh+7−5
@@ -1,13 +1,15 @@
11#!/usr/bin/env bash
22
3+SCRIPT_DIR=$(dirname $0)
4+
35STREAMLY_VERSION=0.8.0
6+BENCH_REPORT_DIR=benchmark/bench-report
7+source $SCRIPT_DIR/targets.sh
48
59#------------------------------------------------------------------------------
610# Script
711#------------------------------------------------------------------------------
812
9−SCRIPT_DIR=$(dirname $0)
10−
1113print_help () {
1214 echo "Usage: $0 "
1315 echo " [--targets <"target1 target2 ..." | help>]"
@@ -39,7 +41,7 @@ print_help () {
3941#-----------------------------------------------------------------------------
4042
4143RUNNING_TESTS=y
42−source $SCRIPT_DIR/build-lib.sh
44+source $BENCH_REPORT_DIR/bin/build-lib.sh
4345
4446USE_GIT_CABAL=1
4547set_common_vars
@@ -79,8 +81,8 @@ set_derived_vars
7981# Determine targets
8082#-----------------------------------------------------------------------------
8183
82−# Requires RUNNING_DEVBUILD var
83−source $SCRIPT_DIR/targets.sh
84+# Defined in targets.sh
85+targets
8486
8587if test "$(has_item "$TARGETS" help)" = "help"
8688then
streamly.cabal+1
@@ -84,6 +84,7 @@ extra-source-files:
8484 bin/run-ci.sh
8585 bin/mk-hscope.sh
8686 bin/mk-tags.sh
87+ bin/targets.sh
8788 bin/test.sh
8889 configure
8990 configure.ac