Эх сурвалжийг харах

Merge pull request #2479 from infosiftr/test-pr-better-failure

Update "failure" output of "test-pr.sh" to be cleaner
yosifkit 9 жил өмнө
parent
commit
a53ada5bf7
1 өөрчлөгдсөн 22 нэмэгдсэн , 6 устгасан
  1. 22 6
      test-pr.sh

+ 22 - 6
test-pr.sh

@@ -153,8 +153,7 @@ files=( $(bashbrew list --repos --uniq --build-order "${files[@]}") )
 unset IFS
 
 echo 'Build test of' '#'"$pull"';' "$commit" '(`'"$(join '`, `' "${files[@]}")"'`):'
-failedBuild=()
-failedTests=()
+declare -A failedBuild=() failedTests=()
 for img in "${files[@]}"; do
 	IFS=$'\n'
 	uniqImgs=( $(bashbrew list --uniq "$img") )
@@ -163,26 +162,43 @@ for img in "${files[@]}"; do
 	echo
 	echo '```console'
 	for uniqImg in "${uniqImgs[@]}"; do
+		imgRepo="${uniqImg%%:*}"
 		echo
 		echo '$ bashbrew build' "$uniqImg"
 		if bashbrew build --pull=missing "$uniqImg"; then
 			echo
 			echo '$ test/run.sh' "$uniqImg"
 			if ! ./test/run.sh "$uniqImg"; then
-				failedTests+=( "$uniqImg" )
+				failedTests[$imgRepo]+=" $uniqImg"
 			fi
 		else
-			failedBuild+=( "$uniqImg" )
+			failedBuild[$imgRepo]+=" $uniqImg"
 		fi
 		echo
 	done
 	echo '```'
 done
+echo
 if [ "${#failedBuild[@]}" -gt 0 ]; then
+	echo 'The following images failed to build:'
+	echo
+	for repo in "${!failedBuild[@]}"; do
+		echo '- `'"$repo"'`:'
+		for img in ${failedBuild[$repo]}; do
+			echo '  - `'"$img"'`'
+		done
+	done
 	echo
-	echo 'The following images failed to build:' "${failedBuild[@]}"
 fi
 if [ "${#failedTests[@]}" -gt 0 ]; then
 	echo
-	echo 'The following images failed at least one test:' "${failedTests[@]}"
+	echo 'The following images failed at least one test:'
+	echo
+	for repo in "${!failedTests[@]}"; do
+		echo '- `'"$repo"'`:'
+		for img in ${failedTests[$repo]}; do
+			echo '  - `'"$img"'`'
+		done
+	done
+	echo
 fi