Merge pull request #2972 from ejohnstown/portability

Script Portability
This commit is contained in:
toddouska
2020-05-18 14:53:27 -07:00
committed by GitHub
3 changed files with 13 additions and 14 deletions

View File

@ -346,8 +346,9 @@ if [ "x$CAVP_SELFTEST_ONLY" == "xno" ];
then then
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p') NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
if [ -n "$NEWHASH" ]; then if [ -n "$NEWHASH" ]; then
sed -i.bak "s/^\".*\";/\"${NEWHASH}\";/" $CRYPT_SRC_PATH/fips_test.c cp $CRYPT_SRC_PATH/fips_test.c $CRYPT_SRC_PATH/fips_test.c.bak
$MAKE clean sed "s/^\".*\";/\"${NEWHASH}\";/" $CRYPT_SRC_PATH/fips_test.c.bak >$CRYPT_SRC_PATH/fips_test.c
make clean
fi fi
fi fi

View File

@ -15,6 +15,7 @@ fi
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p') NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
if test -n "$NEWHASH" if test -n "$NEWHASH"
then then
sed -i.bak "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak
sed "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c.bak >wolfcrypt/src/fips_test.c
fi fi

View File

@ -2,12 +2,16 @@
#openssl.test #openssl.test
if test -n "$WOLFSSL_OPENSSL_TEST"; then
echo "WOLFSSL_OPENSSL_TEST set, running test..."
else
echo "WOLFSSL_OPENSSL_TEST NOT set, won't run"
exit 0
fi
# need a unique port since may run the same time as testsuite # need a unique port since may run the same time as testsuite
generate_port() { generate_port() {
port=`LC_CTYPE=C tr -cd 0-9 </dev/urandom | head -c 7` port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512))
port=$((`LC_CTYPE=C tr -cd 1-9 </dev/urandom | head -c 1`$port))
port=$(($port % (65535-49512)))
port=$(($port + 49512))
} }
@ -68,13 +72,6 @@ do_trap() {
trap do_trap INT TERM trap do_trap INT TERM
if test -n "$WOLFSSL_OPENSSL_TEST"; then
echo "WOLFSSL_OPENSSL_TEST set, running test..."
else
echo "WOLFSSL_OPENSSL_TEST NOT set, won't run"
exit 0
fi
echo -e "\nTesting existence of openssl command...\n" echo -e "\nTesting existence of openssl command...\n"
command -v $OPENSSL >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but it's not installed. Ending."; exit 0; } command -v $OPENSSL >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but it's not installed. Ending."; exit 0; }