blob: dc135fbde329e67adaa7d190d6b0914628706530 [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 Rothe61e7782022-02-25 18:12:02 -070054cbfstool \
Martin Roth6c9c1962017-08-03 09:25:43 -060055cbmem \
56ectool \
57futility \
Patrick Georgi19072dc2021-11-25 10:31:10 +010058ifdtool \
Patrick Georgic9a9f832020-11-11 10:50:49 +010059intelmetool \
Martin Roth6c9c1962017-08-03 09:25:43 -060060inteltool \
61intelvbttool \
62nvramtool \
Patrick Georgic9a9f832020-11-11 10:50:49 +010063post \
Angel Pons446e4dc2020-02-12 22:59:40 +010064superiotool
Martin Roth6c9c1962017-08-03 09:25:43 -060065
66TEST_PAYLOADLIST_INTERNAL= \
67coreinfo \
68nvramcui
69
Martin Rothe624e272017-07-31 11:52:58 -060070JENKINS_PAYLOAD?=none
Martin Roth6c9c1962017-08-03 09:25:43 -060071TEST_PAYLOAD?=$(JENKINS_PAYLOAD)
Martin Rothe624e272017-07-31 11:52:58 -060072CPUS?=4
Martin Roth6c9c1962017-08-03 09:25:43 -060073
Martin Rothea383672016-08-30 09:39:48 -060074lint lint-stable lint-extended:
Martin Roth6c9c1962017-08-03 09:25:43 -060075 util/lint/lint $@
76
Patrick Georgi3beb1082019-08-27 09:19:05 +020077ABUILD_OPTIONS=-B -J -c $(CPUS) -Z -p $(JENKINS_PAYLOAD)
Patrick Georgic1999732019-07-25 12:24:32 +020078ABUILD_OPTIONS+=$(if $(V),-v,)
79ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,-y)
Patrick Georgi99f0e0c2019-07-25 12:34:43 +020080ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT)
Patrick Georgic1999732019-07-25 12:24:32 +020081
Patrick Georgi19e1d632019-08-26 17:45:52 +020082COREBOOT_BUILD_DIR?=coreboot-builds
83
Martin Rothe624e272017-07-31 11:52:58 -060084what-jenkins-does:
Patrick Georgi19e1d632019-08-26 17:45:52 +020085 rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default
Arthur Heymans8855db92022-02-18 12:40:37 +010086 rm -rf $(COREBOOT_BUILD_DIR)/chromeos-clang $(COREBOOT_BUILD_DIR)/default-clang
Martin Roth93122a72020-10-25 19:02:15 -060087ifneq ($(JENKINS_SKIP_LINT_TESTS),y)
Martin Rothe624e272017-07-31 11:52:58 -060088 util/lint/lint lint-stable --junit
Martin Rothea383672016-08-30 09:39:48 -060089 util/lint/lint lint-extended --junit
Martin Roth93122a72020-10-25 19:02:15 -060090endif
Patrick Georgi673716d2021-09-09 13:42:29 +020091 if [ ! -f 3rdparty/intel-sec-tools/go.mod ]; then \
92 echo "Please download 3rdparty/intel-sec-tools/:"; \
93 echo "git submodule update --init 3rdparty/intel-sec-tools"; \
94 exit 1; \
95 fi
Arthur Heymansc44ffc32021-06-17 13:01:58 +020096 cd 3rdparty/intel-sec-tools/ ; go mod vendor
Maximilian Brune1d7a9de2022-04-14 14:54:16 +020097 cd util/goswid ; go mod vendor
Patrick Georgi19e1d632019-08-26 17:45:52 +020098 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos.xml
99 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default $(ABUILD_OPTIONS)
Arthur Heymans574b8b62022-11-14 11:25:06 +0100100 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos-clang $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos_clang.xml -L
101 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default-clang $(ABUILD_OPTIONS) -L
Martin Rothc32c0542018-05-19 17:51:20 -0600102 $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
103 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
104 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 -0600105 (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 -0600106# These targets don't use the standard build system, so we need to provide an xcompile to them.
107 $(MAKE) xcompile=$(COREBOOT_BUILD_DIR)/xcompile $(COREBOOT_BUILD_DIR)/xcompile
108 $(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
109 $(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
Jakub Czapigaa0e36d82022-09-06 10:42:16 +0200110 +$(MAKE) junit.xml-unit-tests COV=1
111 +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) junit.xml-unit-tests COV=1)
112 +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) coverage-report COV=1)
113 +$(MAKE) coverage-report JUNIT_OUTPUT=y COV=1
Paul Fagerburg18dd6b82021-12-07 09:52:41 -0700114 find . -name 'tests.info' -exec cat {} + >$(COREBOOT_BUILD_DIR)/coverage.info
Martin Roth6c9c1962017-08-03 09:25:43 -0600115
116test-basic: test-lint test-tools test-abuild test-payloads test-cleanup
117
118test-lint:
119 util/lint/lint lint-stable
Martin Rothea383672016-08-30 09:39:48 -0600120 util/lint/lint lint-extended
Martin Roth6c9c1962017-08-03 09:25:43 -0600121
122test-abuild:
123 rm -rf coreboot-builds-chromeos coreboot-builds
Martin Rothb0432772020-10-25 18:57:03 -0600124 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x
125 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD)
Arthur Heymans8855db92022-02-18 12:40:37 +0100126 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos-clang -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x -L
127 util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default-clang -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -L
Martin Roth6c9c1962017-08-03 09:25:43 -0600128
129test-payloads:
130 $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y)
131 export MFLAGS=;export MAKEFLAGS=; \
132 $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \
133 echo "*** Making payload $(payload) ***"; \
134 $(MAKE) -C payloads/$(payload) distclean ;\
135 $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\
136 || exit 1; )
137
138test-tools:
139 @echo "Build testing $(TOOLLIST)"
140 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600141 $(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 +0000142 @echo "Running gitconfig tests"
143 @for test in $$(find util/gitconfig/test -maxdepth 1 \
144 -type f -executable); do \
145 echo "$${test}"; \
146 "$${test}" || exit $${?}; \
147 done
Martin Roth6c9c1962017-08-03 09:25:43 -0600148
149test-cleanup:
150 rm -rf coreboot-builds coreboot-builds-chromeos
151 $(MAKE) clean
152 $(MAKE) distclean
153 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
Martin Roth6c9c1962017-08-03 09:25:43 -0600154
155.PHONY: test-basic test-lint test-abuild test-payloads
156.PHONY: test-tools test-cleanup test-help
157.PHONY: lint lint-stable what-jenkins-does