util/abuild: Add all builds to junit.xml files

The builds from the configs directory were not being saved in the
junit.xml files that Jenkins uses to determine pass vs fail of the
individual builds.

This also fixes the path to a log file that I noticed while testing.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I37dbee676cc9e507e612ce66994a04aba062757a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78863
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/util/abuild/abuild b/util/abuild/abuild
index 0e7e97b..4bdf7ee 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -11,8 +11,8 @@
 
 #set -x # Turn echo on....
 
-ABUILD_DATE="Feb 3, 2023"
-ABUILD_VERSION="0.11.01"
+ABUILD_DATE="Nov 1, 2023"
+ABUILD_VERSION="0.11.02"
 
 TOP=$PWD
 
@@ -561,7 +561,7 @@
 		tail -n $CONTEXT "$build_dir/config.log" 2> /dev/null || tail -$CONTEXT "$build_dir/config.log"
 
 		junit "</testcase>"
-		echo "$BUILD_NAME - Log: ${TOP}/$build_dir/config.log" >> "$FAILED_BOARDS"
+		echo "$BUILD_NAME - Log: $build_dir/config.log" >> "$FAILED_BOARDS"
 		return
 	fi
 
@@ -607,6 +607,18 @@
 	junit "</testcase>"
 }
 
+function record_mainboard
+{
+	local log=$1
+
+	if test "$mode" != "text" && test -f "$TARGET/abuild/${log}.xml"; then
+		cat "$TARGET/abuild/${log}.xml" >> "$REAL_XMLFILE"
+		echo "$TARGET/abuild/${log}.xml written to $REAL_XMLFILE" >&2
+	else
+		echo "Warning: $TARGET/abuild/${log}.xml not found." >&2
+	fi
+}
+
 # One target may build several configs
 function build_target
 {
@@ -630,6 +642,7 @@
 			echo "Building config $BUILD_NAME"
 			build_dir=$TARGET/${BUILD_NAME}
 			build_config "$MAINBOARD" "$build_dir" "$BUILD_NAME" "$config"
+			record_mainboard "$BUILD_NAME"
 			remove_target "$BUILD_NAME"
 		done
 	fi
@@ -637,6 +650,7 @@
 	echo "Building board $MAINBOARD (using default config)"
 	build_dir=$TARGET/${MAINBOARD}
 	build_config "$MAINBOARD" "$build_dir" "$MAINBOARD"
+	record_mainboard "$MAINBOARD"
 	remove_target "$MAINBOARD"
 }
 
@@ -1043,9 +1057,6 @@
 		exit 1
 	else
 		build_target "${MAINBOARD}"
-		test "$mode" != "text" && \
-		test -f "$TARGET/abuild/${MAINBOARD}.xml" && \
-		cat "$TARGET/abuild/${MAINBOARD}.xml" >> "$REAL_XMLFILE"
 		XMLFILE=$REAL_XMLFILE
 	fi
 else