Skip to contentSkip to conversation

arm: Enable ptest for optee xtest

PATCH In review Jack Davison 3 participants 4 messages Mar 30, 2021 – Mar 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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
---
 .../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
meta-arm/recipes-security/optee/optee-test.inc +2 -1
index 969d5e2..877bdeb 100644
@@ -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"
meta-arm/recipes-security/optee/optee-test/run-ptest new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · Jack Davison

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.

I think I see this same patch for the third time on the list - is it v3 or a re-send?

Quoted 90 lines
Change-Id I7c981422034b39701ddd74e176f2f5134ae607e6
---
 .../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
meta-arm/recipes-security/optee/optee-test.inc +2 -1
index 969d5e2..877bdeb 100644
@@ -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"
meta-arm/recipes-security/optee/optee-test/run-ptest new file +52 -0
new file mode 100755
index 0000000..ba88c14
@@ -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))) }
+
+'
Signature · 1 line
2.17.1
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#2 lore raw
Quoted 7 lines · Denys Dmytriyenko
Quoted 3 lines · Jack Davison

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.

I think I see this same patch for the third time on the list - is it v3 or a re-send?

Same patch, but Outlook was corrupting the first two. He used something else the third time and it applied cleanly. He knows what he did wrong and won't do it again.

Thanks,
Jon

Quoted 102 lines
Quoted 92 lines
Change-Id I7c981422034b39701ddd74e176f2f5134ae607e6
---
 .../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
meta-arm/recipes-security/optee/optee-test.inc +2 -1
index 969d5e2..877bdeb 100644
@@ -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"
meta-arm/recipes-security/optee/optee-test/run-ptest new file +52 -0
new file mode 100755
index 0000000..ba88c14
@@ -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))) }
+
+'
Signature · 1 line
2.17.1
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
#3 lore raw
In reply to Jack Davison
Quoted 7 lines · Jack Davison

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

---

Patch included into the master branch.

Thanks,
Jon

Quoted 91 lines
 .../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
meta-arm/recipes-security/optee/optee-test.inc +2 -1
index 969d5e2..877bdeb 100644
@@ -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"
meta-arm/recipes-security/optee/optee-test/run-ptest new file +52 -0
new file mode 100755
index 0000000..ba88c14
@@ -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))) }
+
+'
Signature · 1 line
2.17.1