summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml40
-rwxr-xr-x.gitlab/ci.sh60
2 files changed, 100 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f19c78c561..f6ef3e2c3f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -753,6 +753,46 @@ perf:
rules:
- if: '$CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/'
+############################################################
+# ABI testing
+############################################################
+
+abi-test:
+ stage: testing
+ needs:
+ - job: x86_64-linux-fedora33-release
+ optional: true
+ - job: nightly-x86_64-linux-fedora33-release
+ optional: true
+ - job: release-x86_64-linux-fedora33-release
+ optional: true
+ dependencies: null
+ image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV"
+ rules:
+ - if: $CI_MERGE_REQUEST_ID
+ - if: '$CI_COMMIT_BRANCH == "master"'
+ - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
+ tags:
+ - x86_64-linux
+ script:
+ - root=$(pwd)/ghc
+ - |
+ mkdir tmp
+ tar -xf ghc-x86_64-linux-fedora33-release.tar.xz -C tmp
+ pushd tmp/ghc-*/
+ ./configure --prefix=$root
+ make install
+ popd
+ rm -Rf tmp
+ - export BOOT_HC=$(which ghc)
+ - export HC=$root/bin/ghc
+ - .gitlab/ci.sh abi_test
+ artifacts:
+ paths:
+ - out
+ rules:
+ - if: '$CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/'
+
############################################################
# Documentation deployment via GitLab Pages
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index b840500aa4..5a9097aaab 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -663,6 +663,36 @@ function test_hadrian() {
}
+function summarise_hi_files() {
+ for iface in $(find . -type f -name "*.hi" | sort); do echo "$iface $($HC --show-iface $iface | grep " ABI hash:")"; done | tee $OUT/abis
+ for iface in $(find . -type f -name "*.hi" | sort); do echo "$iface $($HC --show-iface $iface | grep " interface hash:")"; done | tee $OUT/interfaces
+ for iface in $(find . -type f -name "*.hi" | sort); do
+ fname="$OUT/$(dirname $iface)"
+ mkdir -p $fname
+ $HC --show-iface $iface > "$OUT/$iface"
+ done
+}
+
+function cabal_abi_test() {
+ if [ -z "$OUT" ]; then
+ fail "OUT not set"
+ fi
+
+ cp -r libraries/Cabal $DIR
+ pushd $DIR
+ echo $PWD
+
+ start_section "Cabal test: $OUT"
+ mkdir -p "$OUT"
+ run "$HC" \
+ -hidir tmp -odir tmp -fforce-recomp -haddock \
+ -iCabal/Cabal/src -XNoPolyKinds Distribution.Simple -j"$cores" \
+ "$@" 2>&1 | tee $OUT/log
+ summarise_hi_files
+ popd
+ end_section "Cabal test: $OUT"
+}
+
function cabal_test() {
if [ -z "$OUT" ]; then
fail "OUT not set"
@@ -693,6 +723,35 @@ function run_perf_test() {
OUT=out/Cabal-O2 cabal_test -O2
}
+function check_interfaces(){
+ difference=$(diff "$1/$3" "$2/$3") || warn "diff failed"
+ if [ -z "$difference" ]
+ then
+ info "$1 and $2 $3 match"
+ else
+ echo $difference
+ for line in $(echo "$difference" | tr ' ' '\n' | grep ".hi" | sort | uniq); do
+ diff "$1/$line" "$2/$line"
+ done
+ fail "$3"
+ fi
+}
+
+function abi_test() {
+ for i in {1..20}; do info "iteration $i"; run_abi_test; done
+}
+
+function run_abi_test() {
+ if [ -z "$HC" ]; then
+ fail "HC not set"
+ fi
+ mkdir -p out
+ OUT="$PWD/out/run1" DIR=$(mktemp -d XXXX-looooooooong) cabal_abi_test -O0
+ OUT="$PWD/out/run2" DIR=$(mktemp -d XXXX-short) cabal_abi_test -O0
+ check_interfaces out/run1 out/run2 abis "Mismatched ABI hash"
+ check_interfaces out/run1 out/run2 interfaces "Mismatched interface hashes"
+}
+
function save_cache () {
info "Storing cabal cache from $CABAL_DIR to $CABAL_CACHE..."
rm -Rf "$CABAL_CACHE"
@@ -837,6 +896,7 @@ case $1 in
exit $res ;;
run_hadrian) shift; run_hadrian "$@" ;;
perf_test) run_perf_test ;;
+ abi_test) abi_test ;;
cabal_test) cabal_test ;;
lint_author) shift; lint_author "$@" ;;
clean) clean ;;