package/optee-test: new package

OP-TEE test package provide test materials as part of the OP-TEE
project helping platforms to verify their OP-TEE components
against a set of regression and performance tests.

Package is added in the BR package configuration next to the
OP-TEE client package.

This change references in Buildroot the today's latest OP-TEE
revision release tagged 3.4.0 with an added patch to fix an issue
reported by recent GCC toolchains.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
[Thomas:
 - drop version selection
 - propagate !BR2_STATIC_LIBS dependency of optee-client
 - make sure BR2_TARGET_OPTEE_OS_SDK is selected
 - use a patch generated by git format-patch
 - simplify the construct to build the examples]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Etienne Carriere 2019-01-30 11:47:26 +01:00 committed by Thomas Petazzoni
parent bd64fdb32c
commit 7d1080a1b4
6 changed files with 143 additions and 0 deletions

View file

@ -691,6 +691,7 @@ N: Etienne Carriere <etienne.carriere@linaro.org>
F: boot/optee-os/
F: package/optee-client/
F: package/optee-examples/
F: package/optee-test/
N: Eugene Tarassov <eugene@largest.net>
F: package/tcf-agent/

View file

@ -2081,6 +2081,7 @@ menu "Security"
source "package/checkpolicy/Config.in"
source "package/optee-client/Config.in"
source "package/optee-examples/Config.in"
source "package/optee-test/Config.in"
source "package/paxtest/Config.in"
source "package/policycoreutils/Config.in"
source "package/refpolicy/Config.in"

View file

@ -0,0 +1,72 @@
From 88714fc174b91950c9e1c53a9832fc6d4ffa6e2a Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Sun, 17 Feb 2019 22:44:44 +0100
Subject: [PATCH] regression 4100: update string conversion loop
Change the loop used to convert string into numerical value.
The original loop was fine but its implementation hits toolchain
unsafe-loop-optimizations feature. The new implementation
proposed here simplifies a bit the loop and prevents toolchain
from complaining when directive -Werror=unsafe-loop-optimizations
is enabled.
Issue reported by the Buildroot cross toolchain [1] with the
following error traces:
build/armv7/build/optee-test-3.4.0/host/xtest/regression_4100.c:447:8: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
while (spos) {
^
build/optee-test-3.4.0/host/xtest/regression_4100.c:454:6: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
if (!spos)
^
[1] arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2019.02-git-00933-gb75e93c) 7.4.0
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
host/xtest/regression_4100.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/host/xtest/regression_4100.c b/host/xtest/regression_4100.c
index b477f38..88346d4 100644
--- a/host/xtest/regression_4100.c
+++ b/host/xtest/regression_4100.c
@@ -445,21 +445,24 @@ static TEEC_Result convert_from_string(ADBG_Case_t *c, TEEC_Session *s,
return TEEC_ERROR_OUT_OF_MEMORY;
while (spos) {
- spos--;
- nibble = digit_value(str[spos]);
- if (nibble == -1)
+ nibble = digit_value(str[spos - 1]);
+ if (nibble == -1) {
+ spos--;
break;
+ }
os[ospos] = nibble;
- if (!spos)
- break;
+ if (spos > 1) {
+ nibble = digit_value(str[spos - 2]);
+ if (nibble == -1) {
+ spos -= 2;
+ break;
+ }
+ os[ospos] |= nibble << 4;
+ ospos--;
+ spos--;
+ }
spos--;
- nibble = digit_value(str[spos]);
- if (nibble == -1)
- break;
-
- os[ospos] |= nibble << 4;
- ospos--;
}
if (spos)
--
2.20.1

View file

@ -0,0 +1,27 @@
config BR2_PACKAGE_OPTEE_TEST
bool "optee-test"
depends on BR2_TARGET_OPTEE_OS
depends on !BR2_STATIC_LIBS # optee-client
select BR2_PACKAGE_OPTEE_CLIENT
select BR2_TARGET_OPTEE_OS_SDK
help
This build option enables OP-TEE test package from the
OP-TEE project. It helps platforms to verify the OP-TEE
installation against a set of regression and performance
tests.
The package generates userspace test applications and
data files for the Linux userland. It also generates
OP-TEE trusted applications.
Trusted application binary files are installed in the target
directory /lib/optee_armtz as other trusted applications.
At runtime OP-TEE OS can load trusted applications from this
non-secure filesystem/directory into the secure world for
execution.
http://github.com/OP-TEE/optee_test
comment "optee-test needs a toolchain w/ dynamic library"
depends on BR2_TARGET_OPTEE_OS
depends on BR2_STATIC_LIBS

View file

@ -0,0 +1,4 @@
# From https://github.com/OP-TEE/optee_test/archive/3.4.0.tar.gz
sha256 755904c5b845763a2460c32c21100a57c713009b6b88cc3fc21f0e5be8645e2b optee-test-3.4.0.tar.gz
# Locally computed
sha256 6e6810981f0ddab9e0d44399d0700a15d9f760a3c2843cc866659c2074139ae7 LICENSE.md

View file

@ -0,0 +1,38 @@
################################################################################
#
# optee-test
#
################################################################################
OPTEE_TEST_VERSION = 3.4.0
OPTEE_TEST_SITE = $(call github,OP-TEE,optee_test,$(OPTEE_TEST_VERSION))
OPTEE_TEST_LICENSE = GPL-2.0, BSD-2-Clause,
OPTEE_TEST_LICENSE_FILES = LICENSE.md
OPTEE_TEST_DEPENDENCIES = optee-client optee-os
ifeq ($(BR2_aarch64),y)
OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
else ifeq ($(BR2_arm),y)
OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
endif
OPTEE_TEST_CONF_OPTS = -DOPTEE_TEST_SDK=$(OPTEE_TEST_SDK)
# Trusted Application are not built from CMake due to ta_dev_kit
# dependencies. We must build and install them on target.
define OPTEE_TEST_BUILD_TAS
$(foreach f,$(wildcard $(@D)/ta/*/Makefile), \
$(TARGET_CONFIGURE_OPTS) \
$(MAKE) CROSS_COMPILE=$(TARGET_CROSS) \
TA_DEV_KIT_DIR=$(OPTEE_TEST_SDK) \
-C $(dir $f) all
)
endef
define OPTEE_TEST_INSTALL_TAS
@mkdir -p $(TARGET_DIR)/lib/optee_armtz
@$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz $(@D)/ta/*/*.ta
endef
OPTEE_TEST_POST_BUILD_HOOKS += OPTEE_TEST_BUILD_TAS
OPTEE_TEST_POST_INSTALL_TARGET_HOOKS += OPTEE_TEST_INSTALL_TAS
$(eval $(cmake-package))