|
|
@ -26,27 +26,44 @@ for line in "${sorted[@]}"; do |
|
|
|
test_time=${line_parts[0]//./} # convert to millis |
|
|
|
test_time=${line_parts[0]//./} # convert to millis |
|
|
|
test_time=${test_time##0} # remove leading zeros |
|
|
|
test_time=${test_time##0} # remove leading zeros |
|
|
|
test_name=${line_parts[1]} |
|
|
|
test_name=${line_parts[1]} |
|
|
|
|
|
|
|
|
|
|
|
# Find index of min sum |
|
|
|
|
|
|
|
idx_min_sum=0 |
|
|
|
|
|
|
|
min_sum=${sums[0]} |
|
|
|
|
|
|
|
for ((i=0; i<SPLIT_COUNT; i++)) |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
if [[ ${sums[$i]} -lt $min_sum ]] |
|
|
|
|
|
|
|
then |
|
|
|
|
|
|
|
idx_min_sum=$i |
|
|
|
|
|
|
|
min_sum=${sums[$i]} |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add the test to the min sum list |
|
|
|
|
|
|
|
min_sum_tests=${tests[$idx_min_sum]} |
|
|
|
|
|
|
|
tests[$idx_min_sum]="${min_sum_tests}${test_name}," |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update the sums |
|
|
|
|
|
|
|
((sums[idx_min_sum]+=test_time)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Does the test still exists? |
|
|
|
|
|
|
|
if grep -F -q --line-regexp "$test_name" tmp/currentTests.list |
|
|
|
|
|
|
|
then |
|
|
|
|
|
|
|
# Find index of min sum |
|
|
|
|
|
|
|
idx_min_sum=0 |
|
|
|
|
|
|
|
min_sum=${sums[0]} |
|
|
|
|
|
|
|
for ((i=0; i<SPLIT_COUNT; i++)) |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
if [[ ${sums[$i]} -lt $min_sum ]] |
|
|
|
|
|
|
|
then |
|
|
|
|
|
|
|
idx_min_sum=$i |
|
|
|
|
|
|
|
min_sum=${sums[$i]} |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add the test to the min sum list |
|
|
|
|
|
|
|
min_sum_tests=${tests[$idx_min_sum]} |
|
|
|
|
|
|
|
tests[$idx_min_sum]="${min_sum_tests}${test_name}," |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Update the sums |
|
|
|
|
|
|
|
((sums[idx_min_sum]+=test_time)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$test_name" >> tmp/processedTests.list |
|
|
|
|
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Any new test? |
|
|
|
|
|
|
|
grep -F --line-regexp -v -f tmp/processedTests.list tmp/currentTests.list > tmp/newTests.list |
|
|
|
|
|
|
|
idx_new_test=0 |
|
|
|
|
|
|
|
while read -r new_test_name |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
idx_group=$(( idx_new_test % SPLIT_COUNT )) |
|
|
|
|
|
|
|
group=${tests[$idx_group]} |
|
|
|
|
|
|
|
tests[$idx_group]="${group}${new_test_name}," |
|
|
|
|
|
|
|
idx_new_test=$(( idx_new_test + 1 )) |
|
|
|
|
|
|
|
done < tmp/newTests.list |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# return the requests index, without quotes to drop the last trailing space |
|
|
|
# return the requests index, without quotes to drop the last trailing space |
|
|
|
echo ${tests[$SPLIT_INDEX]//,/ } |
|
|
|
echo ${tests[$SPLIT_INDEX]//,/ } |