blob: d9bb0f78e50c0066451966ee2a6814cc2e67bd1e [file] [log] [blame]
Martin Rothe624e272017-07-31 11:52:58 -06001##
2## This file is part of the coreboot project.
3##
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; version 2 of the License.
7##
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11## GNU General Public License for more details.
12##
13
Martin Roth6c9c1962017-08-03 09:25:43 -060014test-help help::
15 @echo '*** coreboot test targets ***'
16 @echo ' what-jenkins-does - Run platform build tests with junit output'
17 @echo ' lint / lint-stable - run coreboot lint tools (all / minimal)'
18 @echo ' test-basic - Run stardard build tests. All expected to pass.'
19 @echo ' test-lint - basic: Run stable and extended lint tests.'
20 @echo ' test-tools - basic: Tests a basic list of tools.'
21 @echo ' test-abuild - basic: Builds all platforms'
22 @echo ' test-payloads - basic: Builds internal payloads'
23 @echo ' test-cleanup - basic: Cleans coreboot directories'
24
25# junit.xml is a helper target to wrap builds that don't create junit.xml output
Martin Rothc32c0542018-05-19 17:51:20 -060026# BLD = The name of the build
Martin Roth6c9c1962017-08-03 09:25:43 -060027# BLD_DIR = Top path from coreboot to the build subdirectory
28# MAKETARGET = target to build
Martin Rothe624e272017-07-31 11:52:58 -060029junit.xml:
30 echo "Building $(BLD)"
31 echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp
32 echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp
Martin Rothc32c0542018-05-19 17:51:20 -060033 -if [ -z "$(BLD_DIR)" ]; then \
34 projdir=""; \
35 xmlfile=junit_$(BLD).xml; \
36 else \
37 projdir="-C $(BLD_DIR)"; \
38 xmlfile="$(BLD_DIR)/$@"; \
39 fi; \
40 if [ -z "$(SKIP_DISTCLEAN)" ]; then \
41 $(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \
42 fi; \
43 if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then \
44 type="system-out"; \
45 echo "<$$type>" >> $@.tmp; \
46 echo "Building $(BLD) Succeeded"; \
47 else \
48 type="failure"; \
49 echo "<failure type='buildFailed'>" >> $@.tmp; \
50 echo "Building $(BLD) Failed"; \
51 fi; \
52 cat $@.tmp.2; \
53 echo '<![CDATA[' >> $@.tmp; \
54 cat $@.tmp.2 >> $@.tmp; \
55 echo "]]></$$type>" >>$@.tmp; \
56 rm -f $@.tmp.2; \
57 echo "</testcase>" >> $@.tmp; \
58 echo "</testsuite>" >> $@.tmp; \
59 mv $@.tmp "$$xmlfile"
Martin Rothe624e272017-07-31 11:52:58 -060060 echo
61
62TOOLLIST= \
Alex Thiessen457d1c82018-01-03 19:09:50 +000063broadcom/secimage \
Martin Roth6c9c1962017-08-03 09:25:43 -060064cbmem \
65ectool \
66futility \
67inteltool \
68intelvbttool \
69nvramtool \
70superiotool \
71viatool
72
73TEST_PAYLOADLIST_INTERNAL= \
74coreinfo \
75nvramcui
76
Martin Rothe624e272017-07-31 11:52:58 -060077JENKINS_PAYLOAD?=none
Martin Roth6c9c1962017-08-03 09:25:43 -060078TEST_PAYLOAD?=$(JENKINS_PAYLOAD)
Martin Rothe624e272017-07-31 11:52:58 -060079CPUS?=4
Martin Roth6c9c1962017-08-03 09:25:43 -060080
Martin Rothea383672016-08-30 09:39:48 -060081lint lint-stable lint-extended:
Martin Roth6c9c1962017-08-03 09:25:43 -060082 util/lint/lint $@
83
Martin Rothe624e272017-07-31 11:52:58 -060084what-jenkins-does:
85 util/lint/lint lint-stable --junit
Martin Rothea383672016-08-30 09:39:48 -060086 util/lint/lint lint-extended --junit
Martin Rothe624e272017-07-31 11:52:58 -060087 util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) -x -X $(top)/abuild-chromeos.xml
88 util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD)
89 (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml)
Martin Rothc32c0542018-05-19 17:51:20 -060090 $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; )
91 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml
92 unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/coreinfo BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml
93 $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=util/romcc BLD=romcc MFLAGS= MAKEFLAGS= MAKETARGET=test junit.xml
Patrick Georgie41b0d02017-09-06 13:22:59 +020094 $(MAKE) -C src/soc/nvidia/tegra124/lp0 all clean
95 $(MAKE) -C src/soc/nvidia/tegra210/lp0 all clean
Martin Roth6c9c1962017-08-03 09:25:43 -060096
97test-basic: test-lint test-tools test-abuild test-payloads test-cleanup
98
99test-lint:
100 util/lint/lint lint-stable
Martin Rothea383672016-08-30 09:39:48 -0600101 util/lint/lint lint-extended
Martin Roth6c9c1962017-08-03 09:25:43 -0600102
103test-abuild:
104 rm -rf coreboot-builds-chromeos coreboot-builds
105 export COREBOOT_BUILD_DIR=coreboot-builds-chromeos; util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x
106 util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD)
107
108test-payloads:
109 $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y)
110 export MFLAGS=;export MAKEFLAGS=; \
111 $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \
112 echo "*** Making payload $(payload) ***"; \
113 $(MAKE) -C payloads/$(payload) distclean ;\
114 $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\
115 || exit 1; )
116
117test-tools:
118 @echo "Build testing $(TOOLLIST)"
119 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
120 $(MAKE) -C util/romcc clean
121 $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; )
122 echo "Building romcc"
123 $(MAKE) -C util/romcc all test -j $(CPUS) V=$(V) Q=$(Q)
Alex Thiessen457d1c82018-01-03 19:09:50 +0000124 echo "Testing broadcom/secimage"
125 $(MAKE) -C util/broadcom/secimage test
Martin Roth6c9c1962017-08-03 09:25:43 -0600126
127test-cleanup:
128 rm -rf coreboot-builds coreboot-builds-chromeos
129 $(MAKE) clean
130 $(MAKE) distclean
131 $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; )
132 $(MAKE) -C util/romcc clean
133
134.PHONY: test-basic test-lint test-abuild test-payloads
135.PHONY: test-tools test-cleanup test-help
136.PHONY: lint lint-stable what-jenkins-does