Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5-internal/cabal-make-c-test-all
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix test runner for global cabal make target
22 changes: 13 additions & 9 deletions hack/bin/cabal-run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOP_LEVEL="$(cd "$DIR/../.." && pwd)"

pkgName=${1:-Please specify package name}
package=${1:-all}

# This is required because some tests (e.g. golden tests) depend on the path
# where they are run from.
pkgDir=$(find "$TOP_LEVEL" -name "$pkgName.cabal" | grep -v dist-newstyle | head -1 | xargs -n 1 dirname)
cd "$pkgDir"

test_suites=$(cabal-plan list-bins "$pkgName"':test:*' | awk '{print $2}')

for test_suite in $test_suites; do
if [[ "$package" == all ]]; then
pattern='*.cabal'
else
pattern="$package.cabal"
fi
for cabal in $(find "$TOP_LEVEL" -name "$pattern" | grep -v dist-newstyle); do
# This is required because some tests (e.g. golden tests) must be run from
# the package root.
cd "$(dirname $cabal)"
package="$(basename ${cabal%.*})"
for test_suite in $(cabal-plan list-bins "$package:test:*" | awk '{print $2}'); do
$test_suite "${@:2}"
done
done