blob: 7c820f59ea54c1ed069bd5d979d97b2ebc1a3dab [file] [log] [blame]
Martin Rothe624e272017-07-31 11:52:58 -06001##
Martin Rothe624e272017-07-31 11:52:58 -06002##
Patrick Georgi7333a112020-05-08 20:48:04 +02003## SPDX-License-Identifier: GPL-2.0-only
Martin Rothe624e272017-07-31 11:52:58 -06004
Martin Roth6c9c1962017-08-03 09:25:43 -06005test-help help::
6 @echo '*** coreboot test targets ***'
7 @echo ' what-jenkins-does - Run platform build tests with junit output'
8 @echo ' lint / lint-stable - run coreboot lint tools (all / minimal)'
9 @echo ' test-basic - Run stardard build tests. All expected to pass.'
10 @echo ' test-lint - basic: Run stable and extended lint tests.'
11 @echo ' test-tools - basic: Tests a basic list of tools.'
12 @echo ' test-abuild - basic: Builds all platforms'
13 @echo ' test-payloads - basic: Builds internal payloads'
14 @echo ' test-cleanup - basic: Cleans coreboot directories'
15
16# junit.xml is a helper target to wrap builds that don't create junit.xml output
Martin Rothc32c0542018-05-19 17:51:20 -060017# BLD = The name of the build
Martin Roth6c9c1962017-08-03 09:25:43 -060018# BLD_DIR = Top path from coreboot to the build subdirectory
19# MAKETARGET = target to build
Martin Rothe624e272017-07-31 11:52:58 -060020junit.xml:
21 echo "Building $(BLD)"
22 echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp
23 echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp
Martin Rothc32c0542018-05-19 17:51:20 -060024 -if [ -z "$(BLD_DIR)" ]; then \
25 projdir=""; \
26 xmlfile=junit_$(BLD).xml; \
27 else \
28 projdir="-C $(BLD_DIR)"; \
29 xmlfile="$(BLD_DIR)/$@"; \
30 fi; \
31 if [ -z "$(SKIP_DISTCLEAN)" ]; then \
32 $(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \
33 fi; \
34 if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then \
35 type="system-out"; \
36 echo "<$$type>" >> $@.tmp; \
37 echo "Building $(BLD) Succeeded"; \
38 else \
39 type="failure"; \
40 echo "<failure type='buildFailed'>" >> $@.tmp; \
41 echo "Building $(BLD) Failed"; \
42 fi; \
43 cat $@.tmp.2; \
44 echo '<![CDATA[' >> $@.tmp; \
45 cat $@.tmp.2 >> $@.tmp; \
46 echo "]]></$$type>" >>$@.tmp; \
47 rm -f $@.tmp.2; \
48 echo "</testcase>" >> $@.tmp; \
49 echo "</testsuite>" >> $@.tmp; \
50 mv $@.tmp "$$xmlfile"
Martin Rothe624e272017-07-31 11:52:58 -060051 echo
52
53TOOLLIST= \
Martin Roth6c9c1962017-08-03 09:25:43 -060054cbmem \
55ectool \
56futility \
57inteltool \
58intelvbttool \
59nvramtool \
Angel Pons446e4dc2020-02-12 22:59:40 +010060superiotool
Martin Roth6c9c1962017-08-03 09:25:43 -060061
62TEST_PAYLOADLIST_INTERNAL= \
63coreinfo \
64nvramcui
65
Martin Rothe624e272017-07-31 11:52:58 -060066JENKINS_PAYLOAD?=none
Martin Roth6c9c1962017-08-03 09:25:43 -060067TEST_PAYLOAD?=$(JENKINS_PAYLOAD)
Martin Rothe624e272017-07-31 11:52:58 -060068CPUS?=4
Martin Roth6c9c1962017-08-03 09:25:43 -060069
Martin Rothea383672016-08-30 09:39:48 -060070lint lint-stable lint-extended:
Martin Roth6c9c1962017-08-03 09:25:43 -060071 util/lint/lint $@
72
Patrick Georgi3beb1082019-08-27 09:19:05 +020073ABUILD_OPTIONS=-B -J -c $(CPUS) -Z -p $(JENKINS_PAYLOAD)
Patrick Georgic1999732019-07-25 12:24:32 +020074ABUILD_OPTIONS+=$(if $(V),-v,)
75ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,-y)
Patrick Georgi99f0e0c2019-07-25 12:34:43 +020076ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT)
Patrick Georgic1999732019-07-25 12:24:32 +020077
Patrick Georgi19e1d632019-08-26 17:45:52 +020078COREBOOT_BUILD_DIR?=coreboot-builds
79
Martin Rothe624e272017-07-31 11:52:58 -060080what-jenkins-does:
Patrick Georgi19e1d632019-08-26 17:45:52 +020081 rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default
Martin Rothe624e272017-07-31 11:52:58 -060082 util/lint/lint lint-stable --junit
Martin Rothea383672016-08-30 09:39:48 -060083 util/lint/lint lint-extended --junit
Patrick Georgi19e1d632019-08-26 17:45:52 +020084 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos.xml
85 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default $(ABUILD_OPTIONS)
Martin Rothc32c0542018-05-19 17:51:20 -060086 $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
87 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
88 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/coreinfo BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml
Keith Short31af70d2019-07-11 17:54:57 -060089 (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml)
Martin Roth1613e252018-05-19 17:59:10 -060090 $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra124/lp0 BLD=tegra124_lp0 MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
91 $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra210/lp0 BLD=tegra120_lp0 MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
Martin Roth6c9c1962017-08-03 09:25:43 -060092
93test-basic: test-lint test-tools test-abuild test-payloads test-cleanup
94
95test-lint:
96 util/lint/lint lint-stable
Martin Rothea383672016-08-30 09:39:48 -060097 util/lint/lint lint-extended
Martin Roth6c9c1962017-08-03 09:25:43 -060098
99test-abuild:
100 rm -rf coreboot-builds-chromeos coreboot-builds
101 export COREBOOT_BUILD_DIR=coreboot-builds-chromeos; util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x
102 util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD)
103
104test-payloads:
105 $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y)
106 export MFLAGS=;export MAKEFLAGS=; \
107 $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \
108 echo "*** Making payload $(payload) ***"; \
109 $(MAKE) -C payloads/$(payload) distclean ;\
110 $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\
111 || exit 1; )
112
113test-tools:
114 @echo "Build testing $(TOOLLIST)"
115 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600116 $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; )
Alex Thiessen457d1c82018-01-03 19:09:50 +0000117 echo "Testing broadcom/secimage"
118 $(MAKE) -C util/broadcom/secimage test
Alex Thiessen15aad882018-01-02 17:40:55 +0000119 @echo "Running gitconfig tests"
120 @for test in $$(find util/gitconfig/test -maxdepth 1 \
121 -type f -executable); do \
122 echo "$${test}"; \
123 "$${test}" || exit $${?}; \
124 done
Martin Roth6c9c1962017-08-03 09:25:43 -0600125
126test-cleanup:
127 rm -rf coreboot-builds coreboot-builds-chromeos
128 $(MAKE) clean
129 $(MAKE) distclean
130 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600131
132.PHONY: test-basic test-lint test-abuild test-payloads
133.PHONY: test-tools test-cleanup test-help
134.PHONY: lint lint-stable what-jenkins-does