blob: 4de3307b47c996e59a300c0e01d30fd56c82b2f4 [file] [log] [blame]
Patrick Georgi7333a112020-05-08 20:48:04 +02001## SPDX-License-Identifier: GPL-2.0-only
Martin Rothe624e272017-07-31 11:52:58 -06002
Martin Roth6c9c1962017-08-03 09:25:43 -06003test-help help::
4 @echo '*** coreboot test targets ***'
5 @echo ' what-jenkins-does - Run platform build tests with junit output'
6 @echo ' lint / lint-stable - run coreboot lint tools (all / minimal)'
7 @echo ' test-basic - Run stardard build tests. All expected to pass.'
8 @echo ' test-lint - basic: Run stable and extended lint tests.'
9 @echo ' test-tools - basic: Tests a basic list of tools.'
10 @echo ' test-abuild - basic: Builds all platforms'
11 @echo ' test-payloads - basic: Builds internal payloads'
12 @echo ' test-cleanup - basic: Cleans coreboot directories'
Jakub Czapiga94828072021-05-17 12:22:48 +020013 @echo
Martin Roth6c9c1962017-08-03 09:25:43 -060014
15# junit.xml is a helper target to wrap builds that don't create junit.xml output
Martin Rothc32c0542018-05-19 17:51:20 -060016# BLD = The name of the build
Martin Roth6c9c1962017-08-03 09:25:43 -060017# BLD_DIR = Top path from coreboot to the build subdirectory
18# MAKETARGET = target to build
Martin Rothe624e272017-07-31 11:52:58 -060019junit.xml:
20 echo "Building $(BLD)"
21 echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp
22 echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp
Martin Rothc32c0542018-05-19 17:51:20 -060023 -if [ -z "$(BLD_DIR)" ]; then \
24 projdir=""; \
25 xmlfile=junit_$(BLD).xml; \
26 else \
27 projdir="-C $(BLD_DIR)"; \
28 xmlfile="$(BLD_DIR)/$@"; \
29 fi; \
30 if [ -z "$(SKIP_DISTCLEAN)" ]; then \
31 $(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \
32 fi; \
33 if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then \
34 type="system-out"; \
35 echo "<$$type>" >> $@.tmp; \
36 echo "Building $(BLD) Succeeded"; \
37 else \
38 type="failure"; \
39 echo "<failure type='buildFailed'>" >> $@.tmp; \
40 echo "Building $(BLD) Failed"; \
41 fi; \
42 cat $@.tmp.2; \
43 echo '<![CDATA[' >> $@.tmp; \
44 cat $@.tmp.2 >> $@.tmp; \
45 echo "]]></$$type>" >>$@.tmp; \
46 rm -f $@.tmp.2; \
47 echo "</testcase>" >> $@.tmp; \
48 echo "</testsuite>" >> $@.tmp; \
49 mv $@.tmp "$$xmlfile"
Martin Rothe624e272017-07-31 11:52:58 -060050 echo
51
52TOOLLIST= \
Patrick Georgic9a9f832020-11-11 10:50:49 +010053amdfwtool \
Martin Roth6c9c1962017-08-03 09:25:43 -060054cbmem \
55ectool \
56futility \
Patrick Georgic9a9f832020-11-11 10:50:49 +010057intelmetool \
Martin Roth6c9c1962017-08-03 09:25:43 -060058inteltool \
59intelvbttool \
60nvramtool \
Patrick Georgic9a9f832020-11-11 10:50:49 +010061post \
Angel Pons446e4dc2020-02-12 22:59:40 +010062superiotool
Martin Roth6c9c1962017-08-03 09:25:43 -060063
64TEST_PAYLOADLIST_INTERNAL= \
65coreinfo \
66nvramcui
67
Martin Rothe624e272017-07-31 11:52:58 -060068JENKINS_PAYLOAD?=none
Martin Roth6c9c1962017-08-03 09:25:43 -060069TEST_PAYLOAD?=$(JENKINS_PAYLOAD)
Martin Rothe624e272017-07-31 11:52:58 -060070CPUS?=4
Martin Roth6c9c1962017-08-03 09:25:43 -060071
Martin Rothea383672016-08-30 09:39:48 -060072lint lint-stable lint-extended:
Martin Roth6c9c1962017-08-03 09:25:43 -060073 util/lint/lint $@
74
Patrick Georgi3beb1082019-08-27 09:19:05 +020075ABUILD_OPTIONS=-B -J -c $(CPUS) -Z -p $(JENKINS_PAYLOAD)
Patrick Georgic1999732019-07-25 12:24:32 +020076ABUILD_OPTIONS+=$(if $(V),-v,)
77ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,-y)
Patrick Georgi99f0e0c2019-07-25 12:34:43 +020078ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT)
Patrick Georgic1999732019-07-25 12:24:32 +020079
Patrick Georgi19e1d632019-08-26 17:45:52 +020080COREBOOT_BUILD_DIR?=coreboot-builds
81
Martin Rothe624e272017-07-31 11:52:58 -060082what-jenkins-does:
Patrick Georgi19e1d632019-08-26 17:45:52 +020083 rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default
Martin Roth93122a72020-10-25 19:02:15 -060084ifneq ($(JENKINS_SKIP_LINT_TESTS),y)
Martin Rothe624e272017-07-31 11:52:58 -060085 util/lint/lint lint-stable --junit
Martin Rothea383672016-08-30 09:39:48 -060086 util/lint/lint lint-extended --junit
Martin Roth93122a72020-10-25 19:02:15 -060087endif
Arthur Heymansc44ffc32021-06-17 13:01:58 +020088 cd 3rdparty/intel-sec-tools/ ; go mod vendor
Patrick Georgi19e1d632019-08-26 17:45:52 +020089 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos.xml
90 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default $(ABUILD_OPTIONS)
Martin Rothc32c0542018-05-19 17:51:20 -060091 $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
92 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
93 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 -060094 (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml)
Raul E Rangel81ff33c2019-07-11 10:44:21 -060095# These targets don't use the standard build system, so we need to provide an xcompile to them.
96 $(MAKE) xcompile=$(COREBOOT_BUILD_DIR)/xcompile $(COREBOOT_BUILD_DIR)/xcompile
97 $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra124/lp0 BLD=tegra124_lp0 MFLAGS= MAKEFLAGS=xcompile=$(COREBOOT_BUILD_DIR)/xcompile MAKETARGET=all junit.xml
98 $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra210/lp0 BLD=tegra120_lp0 MFLAGS= MAKEFLAGS=xcompile=$(COREBOOT_BUILD_DIR)/xcompile MAKETARGET=all junit.xml
Paul Fagerburg5d4f0832021-10-26 13:21:37 -060099 $(MAKE) unit-tests JUNIT_OUTPUT=y COV=1
100 (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) unit-tests coverage-report JUNIT_OUTPUT=y COV=1)
101 $(MAKE) coverage-report JUNIT_OUTPUT=y COV=1
Martin Roth6c9c1962017-08-03 09:25:43 -0600102
103test-basic: test-lint test-tools test-abuild test-payloads test-cleanup
104
105test-lint:
106 util/lint/lint lint-stable
Martin Rothea383672016-08-30 09:39:48 -0600107 util/lint/lint lint-extended
Martin Roth6c9c1962017-08-03 09:25:43 -0600108
109test-abuild:
110 rm -rf coreboot-builds-chromeos coreboot-builds
Martin Rothb0432772020-10-25 18:57:03 -0600111 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x
112 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD)
Martin Roth6c9c1962017-08-03 09:25:43 -0600113
114test-payloads:
115 $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y)
116 export MFLAGS=;export MAKEFLAGS=; \
117 $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \
118 echo "*** Making payload $(payload) ***"; \
119 $(MAKE) -C payloads/$(payload) distclean ;\
120 $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\
121 || exit 1; )
122
123test-tools:
124 @echo "Build testing $(TOOLLIST)"
125 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600126 $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; )
Alex Thiessen15aad882018-01-02 17:40:55 +0000127 @echo "Running gitconfig tests"
128 @for test in $$(find util/gitconfig/test -maxdepth 1 \
129 -type f -executable); do \
130 echo "$${test}"; \
131 "$${test}" || exit $${?}; \
132 done
Martin Roth6c9c1962017-08-03 09:25:43 -0600133
134test-cleanup:
135 rm -rf coreboot-builds coreboot-builds-chromeos
136 $(MAKE) clean
137 $(MAKE) distclean
138 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600139
140.PHONY: test-basic test-lint test-abuild test-payloads
141.PHONY: test-tools test-cleanup test-help
142.PHONY: lint lint-stable what-jenkins-does