meta-arm.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
* Fw: [PATCH] arm: Enable ptest for optee xtest
       [not found] <AM6PR08MB49679C64E58B7ADC3664EF5A8E619@AM6PR08MB4967.eurprd08.prod.outlook.com>
@ 2021-03-26 17:14 ` jack.davison
  2021-03-29 16:03   ` [meta-arm] " Jon Mason
  0 siblings, 1 reply; 2+ messages in thread
From: jack.davison @ 2021-03-26 17:14 UTC (permalink / raw)
  To: meta-arm

[-- Attachment #1: Type: text/plain, Size: 3266 bytes --]

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>
---
 .../recipes-security/optee/optee-test.inc     |  3 +-
 .../optee/optee-test/run-ptest                | 52 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100755 meta-arm/recipes-security/optee/optee-test/run-ptest

diff --git a/meta-arm/recipes-security/optee/optee-test.inc b/meta-arm/recipes-security/optee/optee-test.inc
index 969d5e2..877bdeb 100644
--- a/meta-arm/recipes-security/optee/optee-test.inc
+++ b/meta-arm/recipes-security/optee/optee-test.inc
@@ -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"
diff --git a/meta-arm/recipes-security/optee/optee-test/run-ptest b/meta-arm/recipes-security/optee/optee-test/run-ptest
new file mode 100755
index 0000000..ba88c14
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-test/run-ptest
@@ -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))) }
+
+'
--
2.17.1


[-- Attachment #2: Type: text/html, Size: 6416 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [meta-arm] Fw: [PATCH] arm: Enable ptest for optee xtest
  2021-03-26 17:14 ` Fw: [PATCH] arm: Enable ptest for optee xtest jack.davison
@ 2021-03-29 16:03   ` Jon Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Mason @ 2021-03-29 16:03 UTC (permalink / raw)
  To: Jack Davison; +Cc: meta-arm

Patch does not apply cleanly to my tree.  Please rebase and resend.

Thanks,
Jon

On Fri, Mar 26, 2021 at 05:14:09PM +0000, Jack Davison wrote:
> 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>
> ---
>  .../recipes-security/optee/optee-test.inc     |  3 +-
>  .../optee/optee-test/run-ptest                | 52 +++++++++++++++++++
>  2 files changed, 54 insertions(+), 1 deletion(-)
>  create mode 100755 meta-arm/recipes-security/optee/optee-test/run-ptest
> 
> diff --git a/meta-arm/recipes-security/optee/optee-test.inc b/meta-arm/recipes-security/optee/optee-test.inc
> index 969d5e2..877bdeb 100644
> --- a/meta-arm/recipes-security/optee/optee-test.inc
> +++ b/meta-arm/recipes-security/optee/optee-test.inc
> @@ -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"
> diff --git a/meta-arm/recipes-security/optee/optee-test/run-ptest b/meta-arm/recipes-security/optee/optee-test/run-ptest
> new file mode 100755
> index 0000000..ba88c14
> --- /dev/null
> +++ b/meta-arm/recipes-security/optee/optee-test/run-ptest
> @@ -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))) }
> +
> +'
> --
> 2.17.1
> 

> 
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-29 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AM6PR08MB49679C64E58B7ADC3664EF5A8E619@AM6PR08MB4967.eurprd08.prod.outlook.com>
2021-03-26 17:14 ` Fw: [PATCH] arm: Enable ptest for optee xtest jack.davison
2021-03-29 16:03   ` [meta-arm] " Jon Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).