diff options
Diffstat (limited to 'meta-tpm2/recipes-tpm/tpm2-tools/files/0001-tests-switch-to-python3.patch')
-rw-r--r-- | meta-tpm2/recipes-tpm/tpm2-tools/files/0001-tests-switch-to-python3.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-tests-switch-to-python3.patch b/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-tests-switch-to-python3.patch new file mode 100644 index 0000000..cf2a25d --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-tests-switch-to-python3.patch | |||
@@ -0,0 +1,106 @@ | |||
1 | From 46280adf87a6f2b66a89c9445cc45f7595a09ea1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
3 | Date: Wed, 22 Jul 2020 13:45:44 +0800 | ||
4 | Subject: [PATCH] tests: switch to python3 | ||
5 | |||
6 | The python2 is EOL and in some distributions (e.g. CentOS 8/RHEL 8), | ||
7 | there is no python symbolic link by default. | ||
8 | See: https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/ | ||
9 | |||
10 | Update the scripts to switch to python3. | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
15 | --- | ||
16 | test/integration/helpers.sh | 12 +++--------- | ||
17 | test/integration/tests/activecredential.sh | 4 +--- | ||
18 | test/integration/tests/getcap.sh | 4 +--- | ||
19 | test/integration/tests/print.sh | 4 +--- | ||
20 | 4 files changed, 6 insertions(+), 18 deletions(-) | ||
21 | |||
22 | diff --git a/test/integration/helpers.sh b/test/integration/helpers.sh | ||
23 | index 10dfc67..f6ee0e3 100644 | ||
24 | --- a/test/integration/helpers.sh | ||
25 | +++ b/test/integration/helpers.sh | ||
26 | @@ -4,9 +4,7 @@ set -E | ||
27 | |||
28 | function filter_algs_by() { | ||
29 | |||
30 | -python << pyscript | ||
31 | -from __future__ import print_function | ||
32 | - | ||
33 | +python3 << pyscript | ||
34 | import sys | ||
35 | import yaml | ||
36 | |||
37 | @@ -71,9 +69,7 @@ hash_alg_supported() { | ||
38 | # as the first argument loads as a YAML file. | ||
39 | # | ||
40 | function yaml_verify() { | ||
41 | -python << pyscript | ||
42 | -from __future__ import print_function | ||
43 | - | ||
44 | +python3 << pyscript | ||
45 | import sys | ||
46 | import yaml | ||
47 | |||
48 | @@ -97,9 +93,7 @@ function yaml_get_kv() { | ||
49 | third_arg=$3 | ||
50 | fi | ||
51 | |||
52 | -python << pyscript | ||
53 | -from __future__ import print_function | ||
54 | - | ||
55 | +python3 << pyscript | ||
56 | import sys | ||
57 | import yaml | ||
58 | |||
59 | diff --git a/test/integration/tests/activecredential.sh b/test/integration/tests/activecredential.sh | ||
60 | index 8adf6c1..027a42f 100755 | ||
61 | --- a/test/integration/tests/activecredential.sh | ||
62 | +++ b/test/integration/tests/activecredential.sh | ||
63 | @@ -28,9 +28,7 @@ tpm2_createak -C 0x81010009 -c ak.ctx -G rsa -g sha256 -s rsassa -u ak.pub \ | ||
64 | -n ak.name -p akpass> ak.out | ||
65 | |||
66 | # Capture the yaml output and verify that its the same as the name output | ||
67 | -loaded_key_name_yaml=`python << pyscript | ||
68 | -from __future__ import print_function | ||
69 | - | ||
70 | +loaded_key_name_yaml=`python3 << pyscript | ||
71 | import yaml | ||
72 | |||
73 | with open('ak.out', 'r') as f: | ||
74 | diff --git a/test/integration/tests/getcap.sh b/test/integration/tests/getcap.sh | ||
75 | index 92726a9..cde38ab 100755 | ||
76 | --- a/test/integration/tests/getcap.sh | ||
77 | +++ b/test/integration/tests/getcap.sh | ||
78 | @@ -15,9 +15,7 @@ trap cleanup EXIT | ||
79 | |||
80 | function yaml_to_list() { | ||
81 | |||
82 | -python << pyscript | ||
83 | -from __future__ import print_function | ||
84 | - | ||
85 | +python3 << pyscript | ||
86 | import sys | ||
87 | import yaml | ||
88 | |||
89 | diff --git a/test/integration/tests/print.sh b/test/integration/tests/print.sh | ||
90 | index 44ec1f1..d7c2e93 100755 | ||
91 | --- a/test/integration/tests/print.sh | ||
92 | +++ b/test/integration/tests/print.sh | ||
93 | @@ -41,9 +41,7 @@ tpm2_quote -Q -c $ak_ctx -l "sha256:0,2,4,9,10,11,12,17" -q "0f8beb45ac" \ | ||
94 | tpm2_print -t TPMS_ATTEST $quote_file > $print_file | ||
95 | |||
96 | # Check printed yaml | ||
97 | -python << pyscript | ||
98 | -from __future__ import print_function | ||
99 | - | ||
100 | +python3 << pyscript | ||
101 | import sys | ||
102 | import re | ||
103 | import yaml | ||
104 | -- | ||
105 | 2.17.1 | ||
106 | |||