tests: Squeeze spaces in case od print two space between hexbytes (OpenBSD)

The OpenBSD implementation of 'od -tx1' prints two spaces between
hexbytes, thus the grep for "00 00 00 00" fails and we report an
invalid error. This patch fixes this by squeezing the two consecutive
spaces.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2020-08-26 18:23:21 -04:00 committed by Stefan Berger
parent 4f56102e96
commit 2f86b62722

View File

@ -131,7 +131,7 @@ for (( i=0; i<${#PARAMETERS[*]}; i++)); do
# We expect sequences of 4 0-bytes in unencrypted state
# and no such sequences in encrypted state.
nullseq="$(cat $TPMDIR/tpm-00.permall | \
od -t x1 -A n | tr -d '\n' |
od -t x1 -A n | tr -d '\n' | tr -s ' ' |
grep "00 00 00 00")"
if [[ "${PARAMETERS[$i]}" =~ (keyfile|pwdfile) ]]; then
if [ -n "${nullseq}" ]; then