@@ -13,6 +13,7 @@ CABALINSTALLTESTS=true
13
13
CABALSUITETESTS=true
14
14
CABALONLY=false
15
15
DEPSONLY=false
16
+ DOCTEST=false
16
17
VERBOSE=false
17
18
18
19
# Help
@@ -22,7 +23,7 @@ show_usage() {
22
23
cat << EOF
23
24
./validate.sh - build & test
24
25
25
- Usage: ./validate.sh [ -j JOBS | -l | -C | -c | -s | -w HC | -x CABAL | -y CABALPLAN | -d | -v ]
26
+ Usage: ./validate.sh [ -j JOBS | -l | -C | -c | -s | -w HC | -x CABAL | -y CABALPLAN | -d | -D | - v ]
26
27
A script which runs all the tests.
27
28
28
29
Available options:
@@ -35,6 +36,7 @@ Available options:
35
36
-x CABAL With cabal-install
36
37
-y CABALPLAN With cabal-plan
37
38
-d Build dependencies only
39
+ -D Run doctest
38
40
-v Verbose
39
41
EOF
40
42
exit 0
@@ -110,7 +112,7 @@ footer() {
110
112
# getopt
111
113
# ######################################################################
112
114
113
- while getopts ' j:lCcsw:x:y:dv ' flag; do
115
+ while getopts ' j:lCcsw:x:y:dDv ' flag; do
114
116
case $flag in
115
117
j) JOBS=" $OPTARG "
116
118
;;
@@ -130,6 +132,8 @@ while getopts 'j:lCcsw:x:y:dv' flag; do
130
132
;;
131
133
d) DEPSONLY=true
132
134
;;
135
+ D) DOCTEST=true
136
+ ;;
133
137
v) VERBOSE=true
134
138
;;
135
139
? ) show_usage
@@ -165,6 +169,7 @@ cabal-install tests: $CABALINSTALLTESTS
165
169
cabal-testsuite: $CABALSUITETESTS
166
170
library only: $CABALONLY
167
171
dependencies only: $DEPSONLY
172
+ doctest: $DOCTEST
168
173
verbose: $VERBOSE
169
174
170
175
EOF
@@ -237,6 +242,21 @@ timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks --dry-r
237
242
timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks --dep || exit 1
238
243
timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks || exit 1
239
244
245
+ if $DOCTEST ; then
246
+ if command -v doctest > /dev/null; then
247
+ echo " $CYAN === Cabal: doctest ===================================== $( date +%T) === $RESET "
248
+
249
+ timed $CABALNEWBUILD Cabal:lib:Cabal --enable-tests --disable-benchmarks --write-ghc-environment-files=always || exit 1
250
+ timed doctest --fast Cabal/Distribution Cabal/Language
251
+ timed rm -f .ghc.environment.*
252
+
253
+ else
254
+
255
+ echo " No doctest command found"
256
+
257
+ fi # command -v doctest
258
+ fi # DOCTEST
259
+
240
260
if $CABALTESTS ; then
241
261
echo " $CYAN === Cabal: test ======================================== $( date +%T) === $RESET "
242
262
0 commit comments