Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Split LayoutTests in several jobs
#!/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
You can’t perform that action at this time.