-
-
Save softprops/5c0566c12ba26b2d9efcbb5c1ca62f29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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