Skip to content

Commit 3858c0f

Browse files
JuergenReppSITAndreasFuchsTPM
authored andcommitted
rc_decode.sh: Fix pattern matching for new tss2_tpm2_types.h.
The format of tss2_tpm2_types.h had bin changed with clang-format. The pattern related to the RC defines had to be adapted. Signed-off-by: Juergen Repp <juergen_repp@web.de>
1 parent 58691f2 commit 3858c0f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.ci/docker.run

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ if [[ "${TPM2_TSS_VERSION}" == "master" && "$CC" != clang* ]];then
115115
git checkout HEAD test/integration/tests/getcap.sh
116116
#
117117
# symlink is an irrelevant test for 4.X branch
118+
119+
# The file tss2_tpm2_types.h was changed by clang-formt
120+
# through extracting the error messages would not work.
121+
git checkout HEAD test/integration/tests/rc_decode.sh
118122
#
119123
rm test/integration/tests/symlink.sh
120124

test/integration/tests/rc_decode.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ fi
2424
declare -A codes
2525

2626
tss2_tpm2_types=''
27+
tss2_tpm2_types2=tss2_tpm2_types.h
2728
for dir in "$(pkg-config --variable includedir tss2-esys)" \
2829
/usr/local/include /usr/include; do
2930
if [ -f "$dir/tss2/tss2_tpm2_types.h" ]; then
@@ -37,19 +38,22 @@ if [ -z "$tss2_tpm2_types" ]; then
3738
exit 1
3839
fi
3940

41+
sed -z 's/\\\n//g; s/ */ /g' $tss2_tpm2_types > $tss2_tpm2_types2
42+
4043
# Populate the main TPM2_RC values
41-
eval $(grep -Po "^#define \K(TPM2_RC.*)" "$tss2_tpm2_types" \
44+
eval $(grep -Po "^#define \K(TPM2_RC.*)" "$tss2_tpm2_types2" \
4245
| grep -v '+' \
4346
| sed "s%/*[^/]*/$%%g" \
4447
| sed "s%[[:space:]]*((TPM2_RC)[[:space:]]*%=%g" \
4548
| sed "s%)%%g")
4649

4750
# Generate the TPM2_RC array based on TSS2 header
48-
varlist="$(sed -rn "s%^#define (TPM2_RC_[^[:space:]]*)[[:space:]]*\(\(TPM2_RC\) \((TPM2_RC[^\)]*)[^/]*/\* ([^\*]*) \*/%\1=\$\(\(\2\)\):\3%p" "$tss2_tpm2_types")"
51+
varlist="$(sed -rn "s%^#define (TPM2_RC_[^[:space:]]*)[[:space:]]*\(\(TPM2_RC\)\((TPM2_RC[^\)]*)[^/]*/\* ([^\*]*) \*/%\1=\$\(\(\2\)\):\3%p" "$tss2_tpm2_types2")"
4952
while IFS='=' read key value; do
5053
codes[${key}]="${value}"
5154
done <<< "${varlist}"
5255

56+
rm $tss2_tpm2_types2
5357
fail=0
5458

5559
for key in "${!codes[@]}"; do

0 commit comments

Comments
 (0)