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 ***' |
| 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 Czapiga | 9482807 | 2021-05-17 12:22:48 +0200 | [diff] [blame] | 13 | @echo |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 14 | |
| 15 | # 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] | 16 | # BLD = The name of the build |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 17 | # BLD_DIR = Top path from coreboot to the build subdirectory |
| 18 | # MAKETARGET = target to build |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 19 | junit.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 Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 23 | -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 Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 50 | echo |
| 51 | |
| 52 | TOOLLIST= \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 53 | amdfwtool \ |
Martin Roth | e61e778 | 2022-02-25 18:12:02 -0700 | [diff] [blame] | 54 | cbfstool \ |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 55 | cbmem \ |
| 56 | ectool \ |
| 57 | futility \ |
Patrick Georgi | 19072dc | 2021-11-25 10:31:10 +0100 | [diff] [blame] | 58 | ifdtool \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 59 | intelmetool \ |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 60 | inteltool \ |
| 61 | intelvbttool \ |
| 62 | nvramtool \ |
Patrick Georgi | c9a9f83 | 2020-11-11 10:50:49 +0100 | [diff] [blame] | 63 | post \ |
Angel Pons | 446e4dc | 2020-02-12 22:59:40 +0100 | [diff] [blame] | 64 | superiotool |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 65 | |
| 66 | TEST_PAYLOADLIST_INTERNAL= \ |
| 67 | coreinfo \ |
| 68 | nvramcui |
| 69 | |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 70 | JENKINS_PAYLOAD?=none |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 71 | TEST_PAYLOAD?=$(JENKINS_PAYLOAD) |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 72 | CPUS?=4 |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 73 | |
Martin Roth | ea38367 | 2016-08-30 09:39:48 -0600 | [diff] [blame] | 74 | lint lint-stable lint-extended: |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 75 | util/lint/lint $@ |
| 76 | |
Patrick Georgi | 3beb108 | 2019-08-27 09:19:05 +0200 | [diff] [blame] | 77 | ABUILD_OPTIONS=-B -J -c $(CPUS) -Z -p $(JENKINS_PAYLOAD) |
Patrick Georgi | c199973 | 2019-07-25 12:24:32 +0200 | [diff] [blame] | 78 | ABUILD_OPTIONS+=$(if $(V),-v,) |
| 79 | ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,-y) |
Patrick Georgi | 99f0e0c | 2019-07-25 12:34:43 +0200 | [diff] [blame] | 80 | ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT) |
Patrick Georgi | c199973 | 2019-07-25 12:24:32 +0200 | [diff] [blame] | 81 | |
Patrick Georgi | 19e1d63 | 2019-08-26 17:45:52 +0200 | [diff] [blame] | 82 | COREBOOT_BUILD_DIR?=coreboot-builds |
| 83 | |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 84 | validate_sec_tools: |
Patrick Georgi | 673716d | 2021-09-09 13:42:29 +0200 | [diff] [blame] | 85 | if [ ! -f 3rdparty/intel-sec-tools/go.mod ]; then \ |
| 86 | echo "Please download 3rdparty/intel-sec-tools/:"; \ |
| 87 | echo "git submodule update --init 3rdparty/intel-sec-tools"; \ |
| 88 | exit 1; \ |
| 89 | fi |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 90 | |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 91 | what-jenkins-does: test-cleanup validate_sec_tools |
Martin Roth | b3f60a5 | 2022-11-19 15:53:11 -0700 | [diff] [blame] | 92 | ifneq ($(JENKINS_SKIP_LINT_TESTS),y) |
| 93 | JUNIT=--junit $(MAKE) test-lint |
Martin Roth | 1e0f132 | 2022-11-13 09:42:09 -0700 | [diff] [blame] | 94 | endif |
Arthur Heymans | c44ffc3 | 2021-06-17 13:01:58 +0200 | [diff] [blame] | 95 | cd 3rdparty/intel-sec-tools/ ; go mod vendor |
Maximilian Brune | 1d7a9de | 2022-04-14 14:54:16 +0200 | [diff] [blame] | 96 | cd util/goswid ; go mod vendor |
Martin Roth | dfafe79 | 2022-11-19 15:55:45 -0700 | [diff] [blame^] | 97 | $(MAKE) test-abuild |
Martin Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 98 | $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; ) |
| 99 | unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml |
| 100 | unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/coreinfo BLD=coreinfo MFLAGS= MAKEFLAGS= MAKETARGET=defaultbuild junit.xml |
Keith Short | 31af70d | 2019-07-11 17:54:57 -0600 | [diff] [blame] | 101 | (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml) |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 102 | # These targets don't use the standard build system, so we need to provide an xcompile to them. |
| 103 | $(MAKE) xcompile=$(COREBOOT_BUILD_DIR)/xcompile $(COREBOOT_BUILD_DIR)/xcompile |
| 104 | $(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 |
| 105 | $(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 Czapiga | a0e36d8 | 2022-09-06 10:42:16 +0200 | [diff] [blame] | 106 | +$(MAKE) junit.xml-unit-tests COV=1 |
| 107 | +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) junit.xml-unit-tests COV=1) |
| 108 | +(cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) coverage-report COV=1) |
| 109 | +$(MAKE) coverage-report JUNIT_OUTPUT=y COV=1 |
Paul Fagerburg | 18dd6b8 | 2021-12-07 09:52:41 -0700 | [diff] [blame] | 110 | find . -name 'tests.info' -exec cat {} + >$(COREBOOT_BUILD_DIR)/coverage.info |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 111 | |
| 112 | test-basic: test-lint test-tools test-abuild test-payloads test-cleanup |
| 113 | |
| 114 | test-lint: |
Martin Roth | b3f60a5 | 2022-11-19 15:53:11 -0700 | [diff] [blame] | 115 | util/lint/lint lint-stable $(JUNIT) |
| 116 | util/lint/lint lint-extended $(JUNIT) |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 117 | |
| 118 | test-abuild: |
Martin Roth | dfafe79 | 2022-11-19 15:55:45 -0700 | [diff] [blame^] | 119 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos.xml |
| 120 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default $(ABUILD_OPTIONS) |
| 121 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos-clang $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos_clang.xml -L |
| 122 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default-clang $(ABUILD_OPTIONS) -L |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 123 | |
| 124 | test-payloads: |
| 125 | $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y) |
| 126 | export MFLAGS=;export MAKEFLAGS=; \ |
| 127 | $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \ |
| 128 | echo "*** Making payload $(payload) ***"; \ |
| 129 | $(MAKE) -C payloads/$(payload) distclean ;\ |
| 130 | $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\ |
| 131 | || exit 1; ) |
| 132 | |
| 133 | test-tools: |
| 134 | @echo "Build testing $(TOOLLIST)" |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 135 | $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; ) |
Alex Thiessen | 15aad88 | 2018-01-02 17:40:55 +0000 | [diff] [blame] | 136 | @echo "Running gitconfig tests" |
| 137 | @for test in $$(find util/gitconfig/test -maxdepth 1 \ |
| 138 | -type f -executable); do \ |
| 139 | echo "$${test}"; \ |
| 140 | "$${test}" || exit $${?}; \ |
| 141 | done |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 142 | |
| 143 | test-cleanup: |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 144 | rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default |
| 145 | rm -rf $(COREBOOT_BUILD_DIR)/chromeos-clang $(COREBOOT_BUILD_DIR)/default-clang |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 146 | $(MAKE) clean |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 147 | $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) |
Martin Roth | 2852cd2 | 2022-11-19 15:49:39 -0700 | [diff] [blame] | 148 | $(MAKE) -C src/soc/nvidia/tegra124/lp0 clean |
| 149 | $(MAKE) -C src/soc/nvidia/tegra210/lp0 clean |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 150 | |
| 151 | .PHONY: test-basic test-lint test-abuild test-payloads |
| 152 | .PHONY: test-tools test-cleanup test-help |
| 153 | .PHONY: lint lint-stable what-jenkins-does |