Skip to content

Instantly share code, notes, and snippets.

@softprops
Last active November 16, 2019 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softprops/5c0566c12ba26b2d9efcbb5c1ca62f29 to your computer and use it in GitHub Desktop.
Save softprops/5c0566c12ba26b2d9efcbb5c1ca62f29 to your computer and use it in GitHub Desktop.
# get a bash array of packages
packages=(
$(
cargo metadata --no-deps --format-version=1 \
| jq '.packages[] | .targets[] | select(.name != "build-script-build" and .name != "instance-profile-test" and .name != "list_tables" and .name != "put_log_events") | .name' -r \
| sort
)
)
# divide by 4
divisor=$(
echo "${#packages[@]}/4" \
| bc
)
# get sublist of divisor and run cargo test -p foo -p bar -p baz
echo ${packages[@]:$(($divisor*0)):$divisor} | sed -e "s/ / -p /g " | xargs cargo test -p
echo ${packages[@]:$(($divisor*1)):$divisor} | sed -e "s/ / -p /g " | xargs cargo test -p
echo ${packages[@]:$(($divisor*2)):$divisor} | sed -e "s/ / -p /g " | xargs cargo test -p
echo ${packages[@]:$(($divisor*3)):$divisor} | sed -e "s/ / -p /g " | xargs cargo test -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment