From 5a2c92d6fe3d63a5fc201d60bdf0efc5665fd4d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 26 Jan 2016 03:57:43 -0500 Subject: [PATCH] Added tests for X32 on multiarch systems --- cryptest.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/cryptest.sh b/cryptest.sh index 28a5f438..0afa2629 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -136,6 +136,14 @@ if [ "$?" -eq "0" ]; then fi fi +HAVE_X32=0 +if [ "$IS_X64" -ne "0" ]; then +$CXX -x c++ -mx32 -c adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1 +if [ "$?" -eq "0" ]; then + HAVE_X32=1 +fi +fi + # Set to 0 if you don't have Valgrind. Valgrind tests take a long time... HAVE_VALGRIND=$(which valgrind 2>&1 | grep -v "no valgrind" | grep -i -c valgrind) @@ -432,6 +440,64 @@ if [ "$HAVE_CXX11" -ne "0" ]; then fi fi +############################################ +# X32 debug build +if [ "$HAVE_X32" -ne "0" ]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: debug, X32" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="-DDEBUG -g2 -O2 -mx32 $ADD_CXXFLAGS" + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + fi + ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi +fi + +############################################ +# X32 release build +if [ "$HAVE_X32" -ne "0" ]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: release, X32" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="-DNDEBUG -g2 -O2 -mx32 $ADD_CXXFLAGS" + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + fi + ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [ "${PIPESTATUS[0]}" -ne "0" ]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi +fi + ############################################ # Debug build, all backwards compatibility. echo