-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunfile
More file actions
104 lines (84 loc) · 3.38 KB
/
Copy pathRunfile
File metadata and controls
104 lines (84 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
.SHELL = bash
##
# Runs benchmarks with a postgresql DB listening.
benchmarks:
set -eo pipefail
cabal build hpgsql-benchmarks
nix-shell -A shellPg18 ./default.nix --run "./scripts/run-benchmarks-db-internal.sh"
##
# Runs the benchmarks executable without all the CSV-producing and memory usage collecting tooling around it.
# OPTION NIX --nix Use a Nix-built test executable instead of compiling with cabal in the user's shell.
bench-single:
set -eo pipefail
[ -n "$1" ] && BARGS=$(printf "'%s' " "${@}")
if [ -n "$NIX" ]; then
nix-build -A hpgsql-benchmarks -o local/hpgsql-benchmarks
nix-shell -A shellPg18 ./default.nix --run "./local/hpgsql-benchmarks/bin/hpgsql-benchmarks $BARGS"
else
cabal build hpgsql-benchmarks
nix-shell -A shellPg18 ./default.nix --run "./scripts/run-benchmarks-single.sh $BARGS"
fi
##
# Runs all tests that CI runs, exactly like CI runs them.
ci-tests:
set -eo pipefail
hlint .
concurrently -g --timings --names pg18,pg17,pg16,pg15,pg14 \
'nix-build --no-out-link -A testsPg18' \
'nix-build --no-out-link -A testsPg17' \
'nix-build --no-out-link -A testsPg16' \
'nix-build --no-out-link -A testsPg15' \
'nix-build --no-out-link -A testsPg14'
# concurrently -g --timings --names single-threaded,ghc984,ghc967 \
# 'nix-build --no-out-link --argstr threading "-threaded" -A testsPg18' \
# 'nix-build --no-out-link --argstr ghc ghc984 -A testsPg18' \
# 'nix-build --no-out-link --argstr ghc ghc967 -A testsPg18'
##
# Formats all Haskell files with fourmolu.
format-hs:
set -eo pipefail
readarray -d '' FILES < <(git ls-files -z '*.hs')
for f in "${FILES[@]}"; do
echo "Formatting $f..."
fourmolu --mode inplace "$f"
done
##
# Runs all tests.
# OPTION PG --pg <pg> The version of the postgresql instance to start or 'all'. Defaults to 18 if unspecified.
# OPTION NIX --nix Run tests in a Nix derivation's sandbox
tests:
set -eo pipefail
[ -z "$PG" ] && PG=(18)
[ "${PG[0]}" = "all" ] && PG=(14 15 16 17 18)
[ -n "$1" ] && TARGS=$(printf "'%s' " "${@}")
for pg in "${PG[@]}"; do
echo "Running tests on Postgres $pg"
if [ -n "$NIX" ]; then
nix-build --no-out-link -A "testsPg${pg}" --argstr hspecArgs "$TARGS"
else
cabal build hpgsql-tests hpgsql-simple-compat-tests
nix-shell -A "shellPg${pg}" ./default.nix --run "./scripts/run-tests-db-internal.sh $TARGS"
fi
done
echo "--- Running hlint"
hlint .
##
# Runs tests 100 times, reporting how many passed and how many failed.
# This is useful to better test thread safety and interruption safety, as those
# lead to flaky tests when not properly implemented.
tests-stress:
set -eo pipefail
./scripts/run-tests-100.sh
##
# Runs hpgsql-simple-compat's tests.
# OPTION PG --pg <pg> The version of the postgresql instance to start or 'all'. Defaults to 18 if unspecified.
tests-compat:
set -eo pipefail
[ -z "$PG" ] && PG=(18)
[ "${PG[0]}" = "all" ] && PG=(14 15 16 17 18)
TARGS=() && [ -n "$1" ] && TARGS=$(printf "'%s' " "${@}")
for pg in "${PG[@]}"; do
echo "Running tests on Postgres $pg"
cabal build hpgsql-simple-compat-tests
nix-shell -A "shellPg${pg}" ./default.nix --run "./scripts/run-hpgsql-simple-compat-tests-db-internal.sh $TARGS"
done