mirror of
https://github.com/jiazhang0/meta-secure-core.git
synced 2026-07-27 06:18:51 +00:00
tpm2-tools: only support python3 in test scripts
The python2 is removed from oe-core and there is no python symblic link by default which will cause an error when running test scripts: $ ./test_tpm2_activecredential.sh: line 66: python: command not found So drop python2 support and only keep python3. Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
This commit is contained in:
@@ -0,0 +1,141 @@
|
|||||||
|
From 519e70785b56a10a6c326730cda90354ed48d2cb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yi Zhao <yi.zhao@windriver.com>
|
||||||
|
Date: Wed, 11 Mar 2020 16:31:01 +0800
|
||||||
|
Subject: [PATCH] test: only support python3
|
||||||
|
|
||||||
|
The python2 is EOL and in some distributions (e.g. CentOS 8/RHEL 8),
|
||||||
|
there is no python symbolic link by default which will cause an error
|
||||||
|
when running the test scripts:
|
||||||
|
$ ./test_tpm2_activecredential.sh: line 66: python: command not found
|
||||||
|
|
||||||
|
See: https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/
|
||||||
|
So drop python2 support and only keep python3.
|
||||||
|
|
||||||
|
Upstream-Status: Submitted [https://github.com/tpm2-software/tpm2-tools/pull/1952]
|
||||||
|
|
||||||
|
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
|
||||||
|
---
|
||||||
|
configure.ac | 19 ++++++++++---------
|
||||||
|
test/system/test_tpm2_activecredential.sh | 3 +--
|
||||||
|
test/system/test_tpm2_create.sh | 4 +---
|
||||||
|
test/system/test_tpm2_createprimary.sh | 4 +---
|
||||||
|
test/system/test_tpm2_nv.sh | 4 +---
|
||||||
|
test/system/test_tpm2_pcrevent.sh | 4 +---
|
||||||
|
6 files changed, 15 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 0bfd5196..129d37c6 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -121,24 +121,25 @@ AS_IF(
|
||||||
|
[],
|
||||||
|
[AC_MSG_WARN([Required executable bash not found, system tests require a bash shell!])])
|
||||||
|
|
||||||
|
-AC_CHECK_PROG([PYTHON],[python],[yes])
|
||||||
|
+AC_CHECK_PROG([PYTHON3],[python3],[yes])
|
||||||
|
AS_IF(
|
||||||
|
- [test "x${PYTHON}" = x"yes"],
|
||||||
|
+ [test "x${PYTHON3}" = x"yes"],
|
||||||
|
[],
|
||||||
|
- [AC_MSG_WARN([Required executable python not found, some system tests will fail!])])
|
||||||
|
+ [AC_MSG_WARN([Required executable python3 not found, some system tests will fail!])])
|
||||||
|
|
||||||
|
-dnl macro that checks for specific modules in python
|
||||||
|
-AC_DEFUN([AC_PYTHON_MODULE],
|
||||||
|
-[AC_MSG_CHECKING([for module $1 in python])
|
||||||
|
- echo "import $1" | python -
|
||||||
|
+dnl macro that checks for specific modules in python3
|
||||||
|
+AC_DEFUN([AC_PYTHON3_MODULE],
|
||||||
|
+[AC_MSG_CHECKING([for module $1 in python3])
|
||||||
|
+ echo "import $1" | python3 -
|
||||||
|
if test $? -ne 0 ; then
|
||||||
|
AC_MSG_RESULT([not found])
|
||||||
|
AC_MSG_WARN([System tests require pyyaml, some tests will fail!])
|
||||||
|
+ else
|
||||||
|
+ AC_MSG_RESULT(found)
|
||||||
|
fi
|
||||||
|
-AC_MSG_RESULT(found)
|
||||||
|
])
|
||||||
|
|
||||||
|
-AC_PYTHON_MODULE([yaml])
|
||||||
|
+AC_PYTHON3_MODULE([yaml])
|
||||||
|
|
||||||
|
AC_SUBST([EXTRA_CFLAGS])
|
||||||
|
AC_SUBST([EXTRA_LDFLAGS])
|
||||||
|
diff --git a/test/system/test_tpm2_activecredential.sh b/test/system/test_tpm2_activecredential.sh
|
||||||
|
index d8cadf53..f69576d1 100755
|
||||||
|
--- a/test/system/test_tpm2_activecredential.sh
|
||||||
|
+++ b/test/system/test_tpm2_activecredential.sh
|
||||||
|
@@ -56,8 +56,7 @@ tpm2_getpubek -Q -H 0x81010009 -g rsa -f ek.pub
|
||||||
|
tpm2_getpubak -E 0x81010009 -k 0x8101000a -g rsa -D sha256 -s rsassa -f ak.pub -n ak.name > ak.out
|
||||||
|
|
||||||
|
# Capture the yaml output and verify that its the same as the name output
|
||||||
|
-loaded_key_name_yaml=`python << pyscript
|
||||||
|
-from __future__ import print_function
|
||||||
|
+loaded_key_name_yaml=`python3 << pyscript
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
with open('ak.out', 'r') as f:
|
||||||
|
diff --git a/test/system/test_tpm2_create.sh b/test/system/test_tpm2_create.sh
|
||||||
|
index d0bf0317..f31d6486 100755
|
||||||
|
--- a/test/system/test_tpm2_create.sh
|
||||||
|
+++ b/test/system/test_tpm2_create.sh
|
||||||
|
@@ -51,9 +51,7 @@ trap cleanup EXIT
|
||||||
|
|
||||||
|
function yaml_get() {
|
||||||
|
|
||||||
|
-python << pyscript
|
||||||
|
-from __future__ import print_function
|
||||||
|
-
|
||||||
|
+python3 << pyscript
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
diff --git a/test/system/test_tpm2_createprimary.sh b/test/system/test_tpm2_createprimary.sh
|
||||||
|
index 83bdad44..a2590f68 100755
|
||||||
|
--- a/test/system/test_tpm2_createprimary.sh
|
||||||
|
+++ b/test/system/test_tpm2_createprimary.sh
|
||||||
|
@@ -65,9 +65,7 @@ done
|
||||||
|
|
||||||
|
function yaml_get() {
|
||||||
|
|
||||||
|
-python << pyscript
|
||||||
|
-from __future__ import print_function
|
||||||
|
-
|
||||||
|
+python3 << pyscript
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
diff --git a/test/system/test_tpm2_nv.sh b/test/system/test_tpm2_nv.sh
|
||||||
|
index 2db6522a..5f72f264 100755
|
||||||
|
--- a/test/system/test_tpm2_nv.sh
|
||||||
|
+++ b/test/system/test_tpm2_nv.sh
|
||||||
|
@@ -61,9 +61,7 @@ trap onerror ERR
|
||||||
|
|
||||||
|
function yaml_get() {
|
||||||
|
|
||||||
|
-python << pyscript
|
||||||
|
-from __future__ import print_function
|
||||||
|
-
|
||||||
|
+python3 << pyscript
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
diff --git a/test/system/test_tpm2_pcrevent.sh b/test/system/test_tpm2_pcrevent.sh
|
||||||
|
index 30ec9320..f382387d 100755
|
||||||
|
--- a/test/system/test_tpm2_pcrevent.sh
|
||||||
|
+++ b/test/system/test_tpm2_pcrevent.sh
|
||||||
|
@@ -50,9 +50,7 @@ trap cleanup EXIT
|
||||||
|
|
||||||
|
function yaml_get() {
|
||||||
|
|
||||||
|
-python << pyscript
|
||||||
|
-from __future__ import print_function
|
||||||
|
-
|
||||||
|
+python3 << pyscript
|
||||||
|
import sys
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@ include ${BPN}.inc
|
|||||||
SRC_URI = "\
|
SRC_URI = "\
|
||||||
https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \
|
https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \
|
||||||
file://0001-test-fix-yaml.load-warning.patch \
|
file://0001-test-fix-yaml.load-warning.patch \
|
||||||
|
file://0002-test-only-support-python3.patch \
|
||||||
"
|
"
|
||||||
SRC_URI[md5sum] = "17f22e9b47682f4601eb55324282ad6e"
|
SRC_URI[md5sum] = "17f22e9b47682f4601eb55324282ad6e"
|
||||||
SRC_URI[sha256sum] = "568ff32f99e0835db5d8cea2dce781b6cd6c1034026514240995dae5d9e728b0"
|
SRC_URI[sha256sum] = "568ff32f99e0835db5d8cea2dce781b6cd6c1034026514240995dae5d9e728b0"
|
||||||
|
|||||||
Reference in New Issue
Block a user