From 67f0dc4fd54047cca8f24231abb857a5a8ae2f48 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 30 Mar 2020 17:55:07 -0700 Subject: [PATCH] Update distro tests to support newer Cabal --- test/buildtest | 23 ++++++++++++++++++----- test/distrotest | 22 +++++++++------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/test/buildtest b/test/buildtest index e3aa1eb..68bd048 100755 --- a/test/buildtest +++ b/test/buildtest @@ -11,21 +11,34 @@ command -v cabal || cabal update || die "can't update" -cabal install --dependencies-only --enable-tests || - die "can't install dependencies" -cabal configure --enable-tests || + +if [ -e /etc/arch-release ] +then + # Arch has an unconventional packaging setup + flags=(--disable-library-vanilla --enable-shared --enable-executable-dynamic --ghc-options=-dynamic) +else + flags=() +fi + +cabal install --dependencies-only --enable-tests "${flags[@]}" || + cabal install --dependencies-only "${flags[@]}" || + die "can't install dependencies" +cabal configure --enable-tests "${flags[@]}" || die "configure failed" cabal build || die "build failed" cabal test || die "test failed" -dist/build/shellcheck/shellcheck - << 'EOF' || die "execution failed" +sc="$(find . -name shellcheck -type f -perm -111)" +[ -x "$sc" ] || die "Can't find executable" + +"$sc" - << 'EOF' || die "execution failed" #!/bin/sh echo "Hello World" EOF -dist/build/shellcheck/shellcheck - << 'EOF' && die "negative execution failed" +"$sc" - << 'EOF' && die "negative execution failed" #!/bin/sh echo $1 EOF diff --git a/test/distrotest b/test/distrotest index d706185..346a706 100755 --- a/test/distrotest +++ b/test/distrotest @@ -17,13 +17,13 @@ and is still highly experimental. Make sure you're plugged in and have screen/tmux in place, then re-run with $0 --run to continue. -Also note that 'dist' will be deleted. +Also note that dist* will be deleted. EOF exit 0 } -echo "Deleting 'dist'..." -rm -rf dist +echo "Deleting 'dist' and 'dist-newstyle'..." +rm -rf dist dist-newstyle log=$(mktemp) || die "Can't create temp file" date >> "$log" || die "Can't write to log" @@ -61,20 +61,16 @@ done << EOF debian:stable apt-get update && apt-get install -y cabal-install debian:testing apt-get update && apt-get install -y cabal-install ubuntu:latest apt-get update && apt-get install -y cabal-install +haskell:latest true opensuse/leap:latest zypper install -y cabal-install ghc +fedora:latest dnf install -y cabal-install ghc-template-haskell-devel findutils +archlinux/base:latest pacman -S -y --noconfirm cabal-install ghc-static base-devel -# Other Ubuntu versions we want to support -ubuntu:19.04 apt-get update && apt-get install -y cabal-install -ubuntu:18.10 apt-get update && apt-get install -y cabal-install +# Other versions we want to support +ubuntu:18.04 apt-get update && apt-get install -y cabal-install # Misc Haskell including current and latest Stack build -ubuntu:18.10 set -e; apt-get update && apt-get install -y curl && curl -sSL https://get.haskellstack.org/ | sh -s - -f && cd /mnt && exec test/stacktest -haskell:latest true - -# Known to currently fail -centos:latest yum install -y epel-release && yum install -y cabal-install -fedora:latest dnf install -y cabal-install -archlinux/base:latest pacman -S -y --noconfirm cabal-install ghc-static base-devel +ubuntu:18.04 set -e; apt-get update && apt-get install -y curl && curl -sSL https://get.haskellstack.org/ | sh -s - -f && cd /mnt && exec test/stacktest EOF exit "$final"