Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 1 | ## |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 2 | ## |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | ## SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 4 | |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 5 | test-help help:: |
| 6 | @echo '*** coreboot test targets ***' |
| 7 | @echo ' what-jenkins-does - Run platform build tests with junit output' |
| 8 | @echo ' lint / lint-stable - run coreboot lint tools (all / minimal)' |
| 9 | @echo ' test-basic - Run stardard 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' |
| 15 | |
| 16 | # 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] | 17 | # BLD = The name of the build |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 18 | # BLD_DIR = Top path from coreboot to the build subdirectory |
| 19 | # MAKETARGET = target to build |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 20 | junit.xml: |
| 21 | echo "Building $(BLD)" |
| 22 | echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp |
| 23 | echo "<testcase classname='$(BLD)' name='$(BLD)'>" >> $@.tmp |
Martin Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 24 | -if [ -z "$(BLD_DIR)" ]; then \ |
| 25 | projdir=""; \ |
| 26 | xmlfile=junit_$(BLD).xml; \ |
| 27 | else \ |
| 28 | projdir="-C $(BLD_DIR)"; \ |
| 29 | xmlfile="$(BLD_DIR)/$@"; \ |
| 30 | fi; \ |
| 31 | if [ -z "$(SKIP_DISTCLEAN)" ]; then \ |
| 32 | $(MAKE) -j $(CPUS) $$projdir clean distclean > $@.tmp.2 2>&1 ; \ |
| 33 | fi; \ |
| 34 | if $(MAKE) -j $(CPUS) $$projdir $(MAKETARGET) >> $@.tmp.2 2>&1; then \ |
| 35 | type="system-out"; \ |
| 36 | echo "<$$type>" >> $@.tmp; \ |
| 37 | echo "Building $(BLD) Succeeded"; \ |
| 38 | else \ |
| 39 | type="failure"; \ |
| 40 | echo "<failure type='buildFailed'>" >> $@.tmp; \ |
| 41 | echo "Building $(BLD) Failed"; \ |
| 42 | fi; \ |
| 43 | cat $@.tmp.2; \ |
| 44 | echo '<![CDATA[' >> $@.tmp; \ |
| 45 | cat $@.tmp.2 >> $@.tmp; \ |
| 46 | echo "]]></$$type>" >>$@.tmp; \ |
| 47 | rm -f $@.tmp.2; \ |
| 48 | echo "</testcase>" >> $@.tmp; \ |
| 49 | echo "</testsuite>" >> $@.tmp; \ |
| 50 | mv $@.tmp "$$xmlfile" |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 51 | echo |
| 52 | |
| 53 | TOOLLIST= \ |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 54 | cbmem \ |
| 55 | ectool \ |
| 56 | futility \ |
| 57 | inteltool \ |
| 58 | intelvbttool \ |
| 59 | nvramtool \ |
Angel Pons | 446e4dc | 2020-02-12 22:59:40 +0100 | [diff] [blame] | 60 | superiotool |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 61 | |
| 62 | TEST_PAYLOADLIST_INTERNAL= \ |
| 63 | coreinfo \ |
| 64 | nvramcui |
| 65 | |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 66 | JENKINS_PAYLOAD?=none |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 67 | TEST_PAYLOAD?=$(JENKINS_PAYLOAD) |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 68 | CPUS?=4 |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 69 | |
Martin Roth | ea38367 | 2016-08-30 09:39:48 -0600 | [diff] [blame] | 70 | lint lint-stable lint-extended: |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 71 | util/lint/lint $@ |
| 72 | |
Patrick Georgi | 3beb108 | 2019-08-27 09:19:05 +0200 | [diff] [blame] | 73 | ABUILD_OPTIONS=-B -J -c $(CPUS) -Z -p $(JENKINS_PAYLOAD) |
Patrick Georgi | c199973 | 2019-07-25 12:24:32 +0200 | [diff] [blame] | 74 | ABUILD_OPTIONS+=$(if $(V),-v,) |
| 75 | ABUILD_OPTIONS+=$(if $(JENKINS_NOCCACHE),,-y) |
Patrick Georgi | 99f0e0c | 2019-07-25 12:34:43 +0200 | [diff] [blame] | 76 | ABUILD_OPTIONS+=$(JENKINS_ABUILD_OPT) |
Patrick Georgi | c199973 | 2019-07-25 12:24:32 +0200 | [diff] [blame] | 77 | |
Patrick Georgi | 19e1d63 | 2019-08-26 17:45:52 +0200 | [diff] [blame] | 78 | COREBOOT_BUILD_DIR?=coreboot-builds |
| 79 | |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 80 | what-jenkins-does: |
Patrick Georgi | 19e1d63 | 2019-08-26 17:45:52 +0200 | [diff] [blame] | 81 | rm -rf $(COREBOOT_BUILD_DIR)/chromeos $(COREBOOT_BUILD_DIR)/default |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 82 | util/lint/lint lint-stable --junit |
Martin Roth | ea38367 | 2016-08-30 09:39:48 -0600 | [diff] [blame] | 83 | util/lint/lint lint-extended --junit |
Patrick Georgi | 19e1d63 | 2019-08-26 17:45:52 +0200 | [diff] [blame] | 84 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/chromeos $(ABUILD_OPTIONS) -x -X $(top)/abuild-chromeos.xml |
| 85 | util/abuild/abuild -o $(COREBOOT_BUILD_DIR)/default $(ABUILD_OPTIONS) |
Martin Roth | c32c054 | 2018-05-19 17:51:20 -0600 | [diff] [blame] | 86 | $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR="util/$(tool)" BLD="$(tool)" MFLAGS= MAKEFLAGS= MAKETARGET= junit.xml; ) |
| 87 | unset COREBOOT_BUILD_DIR;$(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=payloads/nvramcui BLD=nvramcui MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml |
| 88 | 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] | 89 | (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml) |
Martin Roth | 1613e25 | 2018-05-19 17:59:10 -0600 | [diff] [blame] | 90 | $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra124/lp0 BLD=tegra124_lp0 MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml |
| 91 | $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) BLD_DIR=src/soc/nvidia/tegra210/lp0 BLD=tegra120_lp0 MFLAGS= MAKEFLAGS= MAKETARGET=all junit.xml |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 92 | |
| 93 | test-basic: test-lint test-tools test-abuild test-payloads test-cleanup |
| 94 | |
| 95 | test-lint: |
| 96 | util/lint/lint lint-stable |
Martin Roth | ea38367 | 2016-08-30 09:39:48 -0600 | [diff] [blame] | 97 | util/lint/lint lint-extended |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 98 | |
| 99 | test-abuild: |
| 100 | rm -rf coreboot-builds-chromeos coreboot-builds |
| 101 | export COREBOOT_BUILD_DIR=coreboot-builds-chromeos; util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) -x |
| 102 | util/abuild/abuild -B -e $(if $(TEST_NOCCACHE),,-y) -c $(CPUS) -p $(TEST_PAYLOAD) |
| 103 | |
| 104 | test-payloads: |
| 105 | $(MAKE) -C payloads/libpayload test-configs -j $(CPUS) V=$(V) Q=$(Q) MFLAGS= MAKEFLAGS= $(if $(TEST_NOCCACHE),,CONFIG_LP_CCACHE=y) |
| 106 | export MFLAGS=;export MAKEFLAGS=; \ |
| 107 | $(foreach payload, $(TEST_PAYLOADLIST_INTERNAL), \ |
| 108 | echo "*** Making payload $(payload) ***"; \ |
| 109 | $(MAKE) -C payloads/$(payload) distclean ;\ |
| 110 | $(MAKE) $(payload) -j $(CPUS) V=$(V) Q=$(Q)\ |
| 111 | || exit 1; ) |
| 112 | |
| 113 | test-tools: |
| 114 | @echo "Build testing $(TOOLLIST)" |
| 115 | $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 116 | $(foreach tool, $(TOOLLIST), echo "Building $(tool)";export MFLAGS= ;export MAKEFLAGS= ;$(MAKE) -C util/$(tool) all V=$(V) Q=$(Q) || exit 1; ) |
Alex Thiessen | 457d1c8 | 2018-01-03 19:09:50 +0000 | [diff] [blame] | 117 | echo "Testing broadcom/secimage" |
| 118 | $(MAKE) -C util/broadcom/secimage test |
Alex Thiessen | 15aad88 | 2018-01-02 17:40:55 +0000 | [diff] [blame] | 119 | @echo "Running gitconfig tests" |
| 120 | @for test in $$(find util/gitconfig/test -maxdepth 1 \ |
| 121 | -type f -executable); do \ |
| 122 | echo "$${test}"; \ |
| 123 | "$${test}" || exit $${?}; \ |
| 124 | done |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 125 | |
| 126 | test-cleanup: |
| 127 | rm -rf coreboot-builds coreboot-builds-chromeos |
| 128 | $(MAKE) clean |
| 129 | $(MAKE) distclean |
| 130 | $(foreach tool, $(TOOLLIST), $(MAKE) -C util/$(tool) clean ; ) |
Martin Roth | 6c9c196 | 2017-08-03 09:25:43 -0600 | [diff] [blame] | 131 | |
| 132 | .PHONY: test-basic test-lint test-abuild test-payloads |
| 133 | .PHONY: test-tools test-cleanup test-help |
| 134 | .PHONY: lint lint-stable what-jenkins-does |