Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 2 | |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 3 | test-help help:: |
| 4 | @echo '*** coreboot test targets ***' |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 5 | @echo ' what-jenkins-does - Run platform build tests with junit output' |
| 6 | @echo ' Skip tests by setting env vars JENKINS_SKIP_x_TESTS' |
| 7 | @echo ' to 'y' where x is: CLANG, GCC, LINT, TOOL, or UNIT' |
| 8 | @echo ' lint / lint-stable - Run coreboot lint tools (all / minimal)' |
| 9 | @echo ' test-basic - Run standard 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' |
Jakub Czapiga | 9482807 | 2021-05-17 12:22:48 +0200 | [diff] [blame] | 15 | @echo |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 16 | |
| 17 | # junit.xml is a helper target to wrap builds that don't create junit.xml output |
Martin Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 18 | # BLD = The name of the build |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 19 | # BLD_DIR = Top path from coreboot to the build subdirectory |
| 20 | # MAKETARGET = target to build |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 21 | junit.xml: |
| 22 | echo "Building $(BLD)" |
| 23 | echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp |
| 24 | echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp |
Martin Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 25 | -if [ -z "$(BLD_DIR)" ]; then \ |
| 26 | projdir=""; \ |
| 27 | xmlfile=junit_$(BLD).xml; \ |
| 28 | else \ |
| 29 | projdir="-C $(BLD_DIR)"; \ |
| 30 | xmlfile="$(BLD_DIR)/$@"; \ |
| 31 | fi; \ |
| 32 | if [ -z "$(SKIP_DISTCLEAN)" ]; then \ |
| 33 | $(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \ |
| 34 | fi; \ |
| 35 | if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then \ |
| 36 | type="system-out"; \ |
| 37 | echo "<$$type>" >> $@.tmp; \ |
| 38 | echo "Building $(BLD) Succeeded"; \ |
| 39 | else \ |
| 40 | type="failure"; \ |
| 41 | echo "<failure type='buildFailed'>" >> $@.tmp; \ |
| 42 | echo "Building $(BLD) Failed"; \ |
| 43 | fi; \ |
| 44 | cat $@.tmp.2; \ |
| 45 | echo '<![CDATA[' >> $@.tmp; \ |
| 46 | cat $@.tmp.2 >> $@.tmp; \ |
| 47 | echo "]]></$$type>" >>$@.tmp; \ |
| 48 | rm -f $@.tmp.2; \ |
| 49 | echo "</testcase>" >> $@.tmp; \ |
| 50 | echo "</testsuite>" >> $@.tmp; \ |
| 51 | mv $@.tmp "$$xmlfile" |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 52 | echo |
| 53 | |
| 54 | TOOLLIST= \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 55 | amdfwtool \ |
Martin Roth | e61e778 | 2022-02-25 18:12:02 -0700 | [diff] [blame] | 56 | cbfstool \ |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 57 | cbmem \ |
| 58 | ectool \ |
| 59 | futility \ |
Patrick Georgi | 19072dc | 2021-11-25 10:31:10 +0100 | [diff] [blame] | 60 | ifdtool \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 61 | intelmetool \ |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 62 | inteltool \ |
| 63 | intelvbttool \ |
| 64 | nvramtool \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 65 | post \ |
Angel Pons | 446e4dc | 2020-02-12 22:59:40 +0100 | [diff] [blame] | 66 | superiotool |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 67 | |
| 68 | TEST_PAYLOADLIST_INTERNAL= \ |
| 69 | coreinfo \ |
| 70 | nvramcui |
| 71 | |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 72 | JENKINS_PAYLOAD?=none |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 73 | TEST_PAYLOAD?=$(JENKINS_PAYLOAD) |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 74 | CPUS?=4 |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 75 | |
Martin Roth | ea38367 | 2016-08-30 09:39:48 -0600 | [diff] [blame] | 76 | lint lint-stable lint-extended: |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 77 | util/lint/lint $@ |
| 78 | |
Martin Roth | b399f10 | 2022-11-19 15:59:27 -0700 | [diff] [blame] | 79 | ABUILD_OPTIONS=--blobs --junit --cpus $(CPUS) --clean-somewhat --payloads $(JENKINS_PAYLOAD) |
| 80 | ABUILD_OPTIONS+=$(if $(V),--verbose,) |
| 81 | ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,--ccache) |
Patrick Georgi | 99f0e0c | 2019-07-25 12:34:43 +0200 | [diff] [blame] | 82 | ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT) |
Patrick Georgi | c199973 | 2019-07-25 12:24:32 +0200 | [diff] [blame] | 83 | |
Patrick Georgi | 19e1d63 | 2019-08-26 17:45:52 +0200 | [diff] [blame] | 84 | COREBOOT_BUILD_DIR?=coreboot-builds |
| 85 | |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 86 | validate_sec_tools: |
Patrick Georgi | 673716d | 2021-09-09 13:42:29 +0200 | [diff] [blame] | 87 | if [ ! -f 3rdparty/intel-sec-tools/go.mod ]; then \ |
| 88 | echo "Please download 3rdparty/intel-sec-tools/:"; \ |
| 89 | echo "git submodule update --init 3rdparty/intel-sec-tools"; \ |
| 90 | exit 1; \ |
| 91 | fi |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 92 | |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 93 | what-jenkins-does: test-cleanup validate_sec_tools |
Martin Roth | b3f60a5 | 2022-11-19 15:53:11 -0700 | [diff] [blame] | 94 | ifneq ($(JENKINS_SKIP_LINT_TESTS),y) |
| 95 | JUNIT=--junit $(MAKE) test-lint |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 96 | endif |
Arthur Heymans | c44ffc3 | 2021-06-17 13:01:58 +0200 | [diff] [blame] | 97 | cd 3rdparty/intel-sec-tools/ ; go mod vendor |
Maximilian Brune | 1d7a9de | 2022-04-14 14:54:16 +0200 | [diff] [blame] | 98 | cd util/goswid ; go mod vendor |
Martin Roth | dfafe79 | 2022-11-19 15:55:45 -0700 | [diff] [blame] | 99 | $(MAKE) test-abuild |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 100 | ifneq ($(JENKINS_SKIP_TOOL_TESTS),y) |
Martin Roth | 36dcaba | 2022-11-19 16:34:04 -0700 | [diff] [blame] | 101 | $(MAKE) test-tools |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 102 | endif |
| 103 | ifneq ($(JENKINS_SKIP_UNIT_TESTS),y) |
Jakub Czapiga | a0e36d8 | 2022-09-06 10:42:16 +0200 | [diff] [blame] | 104 | +$(MAKE) junit.xml-unit-tests COV=1 |
| 105 | +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) junit.xml-unit-tests COV=1) |
| 106 | +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) coverage-report COV=1) |
| 107 | +$(MAKE) coverage-report JUNIT_OUTPUT=y COV=1 |
Paul Fagerburg | 18dd6b8 | 2021-12-07 09:52:41 -0700 | [diff] [blame] | 108 | find . -name 'tests.info' -exec cat {} + >$(COREBOOT_BUILD_DIR)/coverage.info |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 109 | endif |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 110 | |
| 111 | test-basic: test-lint test-tools test-abuild test-payloads test-cleanup |
| 112 | |
| 113 | test-lint: |
Martin Roth | b3f60a5 | 2022-11-19 15:53:11 -0700 | [diff] [blame] | 114 | util/lint/lint lint-stable $(JUNIT) |
| 115 | util/lint/lint lint-extended $(JUNIT) |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 116 | |
| 117 | test-abuild: |
Martin Roth | b5e9946 | 2022-11-19 16:41:18 -0700 | [diff] [blame] | 118 | NAME=scanbuild; SCANBUILD_ARGS='-k -plist-html -maxloop 10' util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/$${NAME} $(ABUILD_OPTIONS) -scan-build --target EMULATION_QEMU_X86_Q35 --exitcode --name $${NAME} |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 119 | ifneq ($(JENKINS_SKIP_GCC_TESTS),y) |
Martin Roth | 676e0ac | 2022-11-19 16:54:26 -0700 | [diff] [blame] | 120 | NAME=gcc-chromeos; util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/$${NAME} $(ABUILD_OPTIONS) -x --name $${NAME} |
| 121 | NAME=gcc; util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/$${NAME} $(ABUILD_OPTIONS) --name $${NAME} |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 122 | endif |
| 123 | ifneq ($(JENKINS_SKIP_CLANG_TESTS),y) |
Martin Roth | 676e0ac | 2022-11-19 16:54:26 -0700 | [diff] [blame] | 124 | NAME=clang-chromeos; util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/$${NAME} $(ABUILD_OPTIONS) -L -x --name $${NAME} |
| 125 | NAME=clang; util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/$${NAME} $(ABUILD_OPTIONS) -L --name $${NAME} |
Martin Roth | 6202fbb | 2022-11-12 21:40:04 -0700 | [diff] [blame^] | 126 | endif |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 127 | |
| 128 | test-payloads: |
| 129 | $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y) |
| 130 | export MFLAGS=;export MAKEFLAGS=; \ |
| 131 | $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \ |
| 132 | echo "*** Making payload $(payload) ***"; \ |
| 133 | $(MAKE) -C payloads/$(payload) distclean ;\ |
| 134 | $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\ |
| 135 | || exit 1; ) |
| 136 | |
| 137 | test-tools: |
| 138 | @echo "Build testing $(TOOLLIST)" |
Martin Roth | 36dcaba | 2022-11-19 16:34:04 -0700 | [diff] [blame] | 139 | $(foreach tool, $(TOOLLIST), echo "Building $(tool)";$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; ) |
| 140 | unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml |
| 141 | unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/coreinfo BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml |
| 142 | (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml) |
| 143 | # The tegra targets don't use the standard build system, so we need to provide an xcompile to them. |
| 144 | $(MAKE) xcompile=$(COREBOOT_BUILD_DIR)/xcompile $(COREBOOT_BUILD_DIR)/xcompile |
| 145 | $(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 |
| 146 | $(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 |
Alex Thiessen | 15aad88 | 2018-01-02 17:40:55 +0000 | [diff] [blame] | 147 | @echo "Running gitconfig tests" |
| 148 | @for test in $$(find util/gitconfig/test -maxdepth 1 \ |
| 149 | -type f -executable); do \ |
| 150 | echo "$${test}"; \ |
| 151 | "$${test}" || exit $${?}; \ |
| 152 | done |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 153 | |
| 154 | test-cleanup: |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 155 | rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default |
| 156 | rm -rf $(COREBOOT_BUILD_DIR)/chromeos-clang $(COREBOOT_BUILD_DIR)/default-clang |
Martin Roth | b5e9946 | 2022-11-19 16:41:18 -0700 | [diff] [blame] | 157 | rm -rf $(COREBOOT_BUILD_DIR)/scanbuild |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 158 | $(MAKE) clean |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 159 | $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 160 | $(MAKE) -C src/soc/nvidia/tegra124/lp0 clean |
| 161 | $(MAKE) -C src/soc/nvidia/tegra210/lp0 clean |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 162 | |
| 163 | .PHONY: test-basic test-lint test-abuild test-payloads |
| 164 | .PHONY: test-tools test-cleanup test-help |
| 165 | .PHONY: lint lint-stable what-jenkins-does |