Created
March 14, 2019 17:51
-
-
Save dpino/f1d5d056d75728e7050f06e5e0423eaf to your computer and use it in GitHub Desktop.
Split LayoutTests in several jobs
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
#!/usr/bin/env bash | |
function usage { | |
echo "Usage: layout-tests-split [jobs] [webkit-dir]" | |
} | |
JOBS="${1:-1}" | |
WEBKIT_DIR="${2:-.}" | |
LAYOUT_TESTS_DIR="$WEBKIT_DIR/LayoutTests/" | |
if [[ ! -d "$LAYOUT_TESTS_DIR" ]]; then | |
echo "Couldn't find layout tests dir at '$LAYOUT_TESTS_DIR'" | |
exit 1 | |
fi | |
OUT="$(mktemp)" | |
find ${LAYOUT_TESTS_DIR} -name "*.html" 1> $OUT | |
lines=$(wc -l $OUT | awk '{print $1}') | |
stride=$(expr $lines / $JOBS) | |
for i in `seq 1 $JOBS`; do | |
echo "layout-tests-$i" | |
until=$(expr $i \* $stride) | |
if [[ $i == $JOBS ]]; then | |
# On the last job, we get until the very end. Stride might be larger. | |
diff=$(expr $lines - $until) | |
until=$lines | |
stride=$(expr $stride + $diff) | |
fi | |
cat layout-tests | head -n $until | tail -n $stride > "layout-tests-$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment