1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-07 04:58:57 +00:00

arm: Enable ptest for optee xtest

Provides a run-ptest script for running xtest under ptest-runner. This
script parses the output of xtest and converts it to Automake's test
format.

Change-Id: I7c981422034b39701ddd74e176f2f5134ae607e6
Signed-off-by: Jack Davison <jack.davison@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Jack Davison
2021-03-30 14:02:15 +01:00
committed by Jon Mason
parent de5dc9be14
commit e45cfb9e8f
2 changed files with 54 additions and 1 deletions
@@ -5,7 +5,7 @@ HOMEPAGE = "https://www.op-tee.org/"
LICENSE = "BSD & GPLv2"
LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
inherit python3native
inherit python3native ptest
require optee.inc
# Linking fails on musl due to C++/threads
@@ -19,6 +19,7 @@ SRC_URI = "git://github.com/OP-TEE/optee_test.git \
file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \
file://0003-make-remove-Wmissing-noreturn-for-clang.patch \
file://run-ptest \
"
S = "${WORKDIR}/git"
+52
View File
@@ -0,0 +1,52 @@
#!/bin/sh
xtest | awk '
# Escapes the special characters in a string so that, when
# included in a regex, it represents a literal match
function regx_escape_literal(str, ret) {
ret = str
gsub(/[\[\]\^\$\.\*\?\+\{\}\\\(\)\|]/ , "\\\\&", str)
return str
}
# Returns the simple test formatted name
function name(n, ret) {
ret = n
gsub(/\./, " ", ret)
return ret
}
# Returns the simple test formatted result
function result(res) {
if(res ~ /OK/) {
return "PASS"
} else if(res ~ /FAILED/) {
return "FAIL"
}
}
function parse(name, description, has_subtests, result_line) {
has_subtests = 0
# Consume every line up to the result line
result_line = " " regx_escape_literal(name) " (OK|FAILED)"
do {
getline
# If this is a subtest (denoted by an "o" bullet) then subparse
if($0 ~ /^o /) {
parse($2, description " : " substr($0, index($0, $3)))
has_subtests = 1
}
} while ($0 !~ result_line)
# Only print the results for the deepest nested subtests
if(!has_subtests) {
print result($2) ": " name(name) " - " description
}
}
# Start parsing at the beginning of every test (denoted by a "*" bullet)
/^\* / { parse($2, substr($0, index($0, $3))) }
'