forked from haskell-hvr/hackage-index
/
bisect-test.sh
executable file
·37 lines (29 loc) · 934 Bytes
/
bisect-test.sh
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
#!/bin/bash
# Example test-script to be used with `hit bisect-run`
GOAL=libs
XFLAGS="-vnormal+nowrap"
case $# in
1) TS="$1" ;;
2) TS="$2"; GOAL="$1" ;;
*) echo "usage: $0 [BUILD-TARGET] INDEXSTATE"; exit 128;;
esac
rm -f dist-newstyle/cache/plan.json
cabal v2-build --index-state="$TS" $XFLAGS --dep "$GOAL"
rc=$?
# Note: if plan.json exists but we have a non-zero exit-code, something failed during dep building
cp -v dist-newstyle/cache/plan.json "bisect.$TS.plan"
echo "============================================================================"
if [ "$rc" -eq 0 ]; then
cabal v2-build --index-state="$TS" $XFLAGS "$GOAL" |& tee "bisect.$TS.log"
rc=${PIPESTATUS[0]}
echo "============================================================================"
if [ "$rc" -eq 0 ]; then
touch "bisect.$TS.good"
else
touch "bisect.$TS.bad"
fi
exit "$rc"
else
touch "bisect.$TS.skip"
exit 125 # skip
fi