[coreboot-gerrit] Change in coreboot[master]: util/testing: Update junit.xml to support coreboot builds

Martin Roth (Code Review) gerrit at coreboot.org
Mon May 21 15:17:42 CEST 2018


Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/26421 )

Change subject: util/testing: Update junit.xml to support coreboot builds
......................................................................

util/testing: Update junit.xml to support coreboot builds

Up to this point, junit.xml has only been used to build tools, as abuild
has handled the coreboot builds.  To add additional tests not covered
by abuild, we need junit.xml to work with bare directories.

This also requires updating the build directory (BLD_DIR) for existing
builds using the junit.xml target.

Change-Id: If6e27e02e25e20f48e5a9372373de6058ca378dd
Signed-off-by: Martin Roth <gaumless at gmail.com>
Reviewed-on: https://review.coreboot.org/26421
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi at google.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
---
M util/testing/Makefile.inc
1 file changed, 32 insertions(+), 22 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Patrick Georgi: Looks good to me, approved
  Jonathan Neuschäfer: Looks good to me, but someone else must approve



diff --git a/util/testing/Makefile.inc b/util/testing/Makefile.inc
index ff6dfde..d9bb0f7 100644
--- a/util/testing/Makefile.inc
+++ b/util/testing/Makefile.inc
@@ -23,30 +23,40 @@
 	@echo  '  test-cleanup           - basic: Cleans coreboot directories'
 
 # junit.xml is a helper target to wrap builds that don't create junit.xml output
-# BLD = Subdirectory the build lives in - The name of the build
+# BLD = The name of the build
 # BLD_DIR = Top path from coreboot to the build subdirectory
 # MAKETARGET = target to build
 junit.xml:
 	echo "Building $(BLD)"
 	echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp
 	echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp
-	-$(MAKE) -j $(CPUS) -C "$(BLD_DIR)$(BLD)" clean distclean > $@.tmp.2 2>&1
-	$(MAKE) -j $(CPUS) -C "$(BLD_DIR)$(BLD)" $(MAKETARGET) >> $@.tmp.2 2>&1 && type="system-out" || type="failure"; \
-	cat $@.tmp.2; \
-	if [ "$$type" = "failure" ]; then \
-		echo "<failure type='buildFailed'>" >> $@.tmp; \
-		echo "Building $(BLD) Failed"; \
-	else \
-		echo "<$$type>" >> $@.tmp; \
-		echo "Building $(BLD) Succeeded"; \
-	fi; \
-	echo '<![CDATA[' >> $@.tmp; \
-	cat $@.tmp.2 >> $@.tmp; \
-	echo "]]></$$type>" >>$@.tmp
-	rm -f $@.tmp.2
-	echo "</testcase>" >> $@.tmp
-	echo "</testsuite>" >> $@.tmp
-	mv $@.tmp "$(BLD_DIR)$(BLD)/$@"
+	-if [ -z "$(BLD_DIR)" ]; then                                          \
+		projdir="";                                                    \
+		xmlfile=junit_$(BLD).xml;                                      \
+	else                                                                   \
+		projdir="-C $(BLD_DIR)";                                       \
+		xmlfile="$(BLD_DIR)/$@";                                       \
+	fi;                                                                    \
+	if [ -z "$(SKIP_DISTCLEAN)" ]; then                                    \
+		$(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \
+	fi;                                                                    \
+	if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then   \
+		type="system-out";                                             \
+		echo "<$$type>" >> $@.tmp;                                     \
+		echo "Building $(BLD) Succeeded";                              \
+	else                                                                   \
+		type="failure";                                                \
+		echo "<failure type='buildFailed'>" >> $@.tmp;                 \
+		echo "Building $(BLD) Failed";                                 \
+	fi;                                                                    \
+	cat $@.tmp.2;                                                          \
+	echo '<![CDATA[' >> $@.tmp;                                            \
+	cat $@.tmp.2 >> $@.tmp;                                                \
+	echo "]]></$$type>" >>$@.tmp;                                          \
+	rm -f $@.tmp.2;                                                        \
+	echo "</testcase>" >> $@.tmp;                                          \
+	echo "</testsuite>" >> $@.tmp;                                         \
+	mv $@.tmp "$$xmlfile"
 	echo
 
 TOOLLIST= \
@@ -77,10 +87,10 @@
 	util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) -x -X $(top)/abuild-chromeos.xml
 	util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD)
 	(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml)
-	$(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=util/ BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
-	unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/ BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
-	unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/ BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml
-	$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=util/ BLD=romcc MFLAGS= MAKEFLAGS= MAKETARGET=test junit.xml
+	$(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
+	unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
+	unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/coreinfo BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml
+	$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=util/romcc BLD=romcc MFLAGS= MAKEFLAGS= MAKETARGET=test junit.xml
 	$(MAKE) -C src/soc/nvidia/tegra124/lp0 all clean
 	$(MAKE) -C src/soc/nvidia/tegra210/lp0 all clean
 

-- 
To view, visit https://review.coreboot.org/26421
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If6e27e02e25e20f48e5a9372373de6058ca378dd
Gerrit-Change-Number: 26421
Gerrit-PatchSet: 2
Gerrit-Owner: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
Gerrit-Reviewer: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180521/13216473/attachment.html>


More information about the coreboot-gerrit mailing list