From 6c9c196f1cdf5e1a94c4ae312318dc7934508023 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 3 Aug 2017 09:25:43 -0600 Subject: copy & update test routines from what-jenkins-does Currently the only testing we had was 'what-jenkins-does' and 'make lint'. While the lint testing is suitable for developers, the 'what-jenkins-does' target really isn't, as it was designed specifically for testing on jenkins. This adds the infrastructure for basic tests that are more suitable for the developer. Extended tests and improvements will follow. Add the coreboot-builds directories to .gitignore. TODO: - Save/restore .config - Update test-abuild to use existing COREBOOT_BUILD_DIR variable Change-Id: I19e1256d79531112ff84e47a307f55791533806f Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/20874 Tested-by: build bot (Jenkins) Reviewed-by: Chris Ching --- util/testing/Makefile.inc | 80 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 8 deletions(-) (limited to 'util') diff --git a/util/testing/Makefile.inc b/util/testing/Makefile.inc index f5a4c5e6fc..160210b3e7 100644 --- a/util/testing/Makefile.inc +++ b/util/testing/Makefile.inc @@ -11,6 +11,21 @@ ## GNU General Public License for more details. ## +test-help help:: + @echo '*** coreboot test targets ***' + @echo ' what-jenkins-does - Run platform build tests with junit output' + @echo ' lint / lint-stable - run coreboot lint tools (all / minimal)' + @echo ' test-basic - Run stardard build tests. All expected to pass.' + @echo ' test-lint - basic: Run stable and extended lint tests.' + @echo ' test-tools - basic: Tests a basic list of tools.' + @echo ' test-abuild - basic: Builds all platforms' + @echo ' test-payloads - basic: Builds internal payloads' + @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_DIR = Top path from coreboot to the build subdirectory +# MAKETARGET = target to build junit.xml: echo "Building $(BLD)" echo '' > $@.tmp @@ -35,16 +50,26 @@ junit.xml: echo TOOLLIST= \ - cbmem \ - ectool \ - futility \ - inteltool \ - intelvbttool \ - nvramtool \ - superiotool \ - viatool +cbmem \ +ectool \ +futility \ +inteltool \ +intelvbttool \ +nvramtool \ +superiotool \ +viatool + +TEST_PAYLOADLIST_INTERNAL= \ +coreinfo \ +nvramcui + JENKINS_PAYLOAD?=none +TEST_PAYLOAD?=$(JENKINS_PAYLOAD) CPUS?=4 + +lint lint-stable: + util/lint/lint $@ + what-jenkins-does: util/lint/lint lint-stable --junit util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) -x -X $(top)/abuild-chromeos.xml @@ -54,3 +79,42 @@ what-jenkins-does: 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 + +test-basic: test-lint test-tools test-abuild test-payloads test-cleanup + +test-lint: + util/lint/lint lint-stable + util/lint/lint-015-final-newlines + +test-abuild: + rm -rf coreboot-builds-chromeos coreboot-builds + export COREBOOT_BUILD_DIR=coreboot-builds-chromeos; util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x + util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) + +test-payloads: + $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y) + export MFLAGS=;export MAKEFLAGS=; \ + $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \ + echo "*** Making payload $(payload) ***"; \ + $(MAKE) -C payloads/$(payload) distclean ;\ + $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\ + || exit 1; ) + +test-tools: + @echo "Build testing $(TOOLLIST)" + $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) + $(MAKE) -C util/romcc clean + $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; ) + echo "Building romcc" + $(MAKE) -C util/romcc all test -j $(CPUS) V=$(V) Q=$(Q) + +test-cleanup: + rm -rf coreboot-builds coreboot-builds-chromeos + $(MAKE) clean + $(MAKE) distclean + $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) + $(MAKE) -C util/romcc clean + +.PHONY: test-basic test-lint test-abuild test-payloads +.PHONY: test-tools test-cleanup test-help +.PHONY: lint lint-stable what-jenkins-does -- cgit v1.2.3