Skip to content
Merged
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions hack/bin/cabal-run-all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TOP_LEVEL="$(cd "$DIR/../.." && pwd)"

find "$TOP_LEVEL" -name '*.cabal' |
packages=$(find "$TOP_LEVEL" -name '*.cabal' |
grep -v dist-newstyle |
xargs -n 1 dirname |
xargs -n 1 basename |
xargs -n 1 "$DIR/cabal-run-tests.sh"
xargs -n 1 echo)
Comment thread
jschaul marked this conversation as resolved.
Outdated

for p in $packages; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the workaround[1] isn't worth it, but this will cause problems if there's ever an IFS character (e.g. SPC) in a package name.

[1] Have xargs invoke a /bin/sh subshell and use $1 there instead of $p.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using xargs makes it not possible to stop the execution on first test failure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can definately stop a GNU xargs run:

If any invocation of the command exits with a status of 255, xargs will stop immediately without reading any further input.

and that's standard behavior, too:

This sequence shall be repeated until one of the following occurs: [...] An invocation of a constructed command line returns an exit status of 255.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the discussion; haskell package names never contain spaces, so this is a silly objection. But if that's what it takes to get a positive review on this PR that has been hanging for two weeks; then; sure, see 5e3333e.

echo "==== Testing $p..."
"$DIR/cabal-run-tests.sh" "$p"
done