-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRunfile
More file actions
111 lines (90 loc) · 5.35 KB
/
Copy pathRunfile
File metadata and controls
111 lines (90 loc) · 5.35 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
105
106
107
108
109
110
111
.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-ghc9122,pg17,pg16-ghc984-tcp,pg15-single-threaded-rts,pg14-ghc967 \
'nix-build --no-out-link --argstr ghc ghc9122 -A hpgsql-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg18-ghc9122-tests.txt nix-build --no-out-link --argstr ghc ghc9122 -A testsPg18' \
'timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg17-tests.txt nix-build --no-out-link -A testsPg17' \
'nix-build --no-out-link --argstr ghc ghc984 --argstr PGHOST localhost -A hpgsql-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg16-ghc984-tests.txt nix-build --no-out-link --argstr ghc ghc984 -A testsPg16' \
'nix-build --no-out-link --argstr threading "-threaded" -A hpgsql-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg15-single-threaded-rts-tests.txt nix-build --no-out-link --argstr threading "-threaded" -A testsPg15' \
'nix-build --no-out-link --argstr ghc ghc967 -A hpgsql-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg14-ghc967-tests.txt nix-build --no-out-link --argstr ghc ghc967 -A testsPg14'
concurrently -g --timings --names pg18-ghc9122,pg17,pg16-ghc984,pg15,pg14-ghc967 \
'nix-build --no-out-link --argstr ghc ghc984 -A hpgsql-simple-compat-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg18-ghc9122-simple-compat-tests.txt nix-build --no-out-link --argstr ghc ghc9122 -A hpgsqlSimpleCompatTestsPg18' \
'timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg17-simple-compat-tests.txt nix-build --no-out-link -A hpgsqlSimpleCompatTestsPg17' \
'nix-build --no-out-link --argstr ghc ghc984 -A hpgsql-simple-compat-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg16-ghc984-simple-compat-tests.txt nix-build --no-out-link --argstr ghc ghc984 -A hpgsqlSimpleCompatTestsPg16' \
'timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg15-simple-compat-tests.txt nix-build --no-out-link -A hpgsqlSimpleCompatTestsPg15' \
'nix-build --no-out-link --argstr ghc ghc967 -A hpgsql-simple-compat-tests && timeout 5m scripts/ci/run-tests-and-annotate-with-error.sh local/pg14-ghc967-simple-compat-tests.txt nix-build --no-out-link --argstr ghc ghc967 -A hpgsqlSimpleCompatTestsPg14'
##
# Formats all Haskell files with fourmolu and lints with hlint.
format:
set -eo pipefail
readarray -d '' FILES < <(git ls-files -z '*.hs')
for f in "${FILES[@]}"; do
echo "Formatting $f..."
fourmolu --mode inplace "$f"
done
echo "--- Running hlint"
hlint .
##
# 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
##
# 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
ghc-core:
set -eo pipefail
cabal build hpgsql-tests 1>&2
cat dist-newstyle/build/x86_64-linux/ghc-9.10.3/hpgsql-tests-0.1.0.0/x/hpgsql-tests/build/hpgsql-tests/hpgsql-tests-tmp/RowDecoderGhcCore.thr.dump-simpl