summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKangheui Won <khwon@chromium.org>2021-09-02 15:45:29 +1000
committerCommit Bot <commit-bot@chromium.org>2021-10-18 02:50:54 +0000
commit2ffa62d35c7be7217287151ab9de14266ee6df66 (patch)
treef0b0207ee189b903703a8c18bfcb9474baa440cc /Makefile
parent2d1ce45dc46b0dd5522edf1edabef35b90a66942 (diff)
downloadvboot-2ffa62d35c7be7217287151ab9de14266ee6df66.tar.gz
Makefile: add install_dut_test rule
Add new rule 'install_dut_test' to deploy dut-specific tests to the device. Any tests included in the rule will be installed into /usr/share/vboot/tests/. Especially vb2_sha256_x86_tests uses sha-ni extension, which might not be available on some platforms. So it needs to be deployed to the dut and run there. BUG=b:162551138 BRANCH=none TEST=build with modified ebuild on hana & guybrush Signed-off-by: Kangheui Won <khwon@chromium.org> Change-Id: I9c6e00c8a9aca192ae283560383417c1215c221f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3141250 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 24 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 82d6a44a..9e41123d 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,7 @@ DEV_DEBUG_FORCE=
# US_DIR = shared data directory (for static content like devkeys)
# DF_DIR = utility defaults directory
# VB_DIR = vboot binary directory for dev-mode-only scripts
+# DUT_TEST_DIR = vboot dut tests binary directory
UB_DIR=${DESTDIR}/usr/bin
UL_DIR=${DESTDIR}/usr/${LIBDIR}
ULP_DIR=${UL_DIR}/pkgconfig
@@ -63,6 +64,7 @@ UI_DIR=${DESTDIR}/usr/include/vboot
US_DIR=${DESTDIR}/usr/share/vboot
DF_DIR=${DESTDIR}/etc/default
VB_DIR=${US_DIR}/bin
+DUT_TEST_DIR=${US_DIR}/tests
# Where to install the (exportable) executables for testing?
TEST_INSTALL_DIR = ${BUILD}/install_for_test
@@ -768,10 +770,12 @@ TEST21_NAMES = \
TEST_NAMES += ${TEST2X_NAMES} ${TEST20_NAMES} ${TEST21_NAMES}
-# This is build-only test since we can't run this without
-# sha-ni extension on x86. To run this test, you have to
-# manually copy executable into compatible machine and run it.
-TEST_NAMES += tests/vb2_sha256_x86_tests
+# Tests which should be run on dut
+ifeq (${ARCH}, x86_64)
+DUT_TEST_NAMES += tests/vb2_sha256_x86_tests
+endif
+
+TEST_NAMES += ${DUT_TEST_NAMES}
# And a few more...
ifeq (${TPM2_MODE},)
@@ -1094,17 +1098,28 @@ ${TEST20_BINS}: ${FWLIB}
${TEST20_BINS}: LIBS += ${FWLIB}
${TEST20_BINS}: LDLIBS += ${CRYPTO_LIBS}
-# Special build for sha256_x86 test
-X86_SHA256_TEST = ${BUILD_RUN}/tests/vb2_sha256_x86_tests
-${X86_SHA256_TEST}: ${BUILD}/firmware/2lib/2sha256_x86.o
-${X86_SHA256_TEST}: LIBS += ${BUILD}/firmware/2lib/2sha256_x86.o
-
${TESTLIB}: ${TESTLIB_OBJS}
@${PRINTF} " RM $(subst ${BUILD}/,,$@)\n"
${Q}rm -f $@
@${PRINTF} " AR $(subst ${BUILD}/,,$@)\n"
${Q}ar qc $@ $^
+DUT_TEST_BINS = $(addprefix ${BUILD}/,${DUT_TEST_NAMES})
+
+# Special build for sha256_x86 test
+${BUILD}/tests/vb2_sha256_x86_tests: \
+ ${BUILD}/firmware/2lib/2sha256_x86.o
+${BUILD}/tests/vb2_sha256_x86_tests: \
+ LIBS += ${BUILD}/firmware/2lib/2sha256_x86.o
+
+.PHONY: install_dut_test
+install_dut_test: ${DUT_TEST_BINS}
+ifneq ($(strip ${DUT_TEST_BINS}),)
+ @${PRINTF} " INSTALL DUT TESTS\n"
+ ${Q}mkdir -p ${DUT_TEST_DIR}
+ ${Q}${INSTALL} -t ${DUT_TEST_DIR} $^
+endif
+
# ----------------------------------------------------------------------------
# Fuzzers