#!/bin/bash REPORTS_DIR="$1" SPLIT_COUNT=$2 SPLIT_INDEX=$3 # extract tests time from Junit XML reports find "$REPORTS_DIR" -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v 'sum(//testcase/@time)' '{}'; echo '{}' | sed 's/.*TEST\-\(.*\)\.xml/ \1/'" > tmp/timing.tsv # Sort times in descending order IFS=$'\n' sorted=($(sort -nr tmp/timing.tsv)) unset IFS sums=() tests=() # Initialize sums for ((i=0; i