Add test for modern compiler and old hardware

pull/186/head
Jeffrey Walton 2016-06-05 18:15:47 -04:00
parent 5d9607613a
commit cdd88236af
1 changed files with 66 additions and 12 deletions

View File

@ -25,7 +25,7 @@ touch "$WARN_RESULTS"
# Respect user's preferred flags, but filter the stuff we expliclty test
FILTERED_CXXFLAGS=("-DDEBUG" "-DNDEBUG" "-g" "-g0" "-g1" "-g2" "-g3" "-O0" "-O1" "-O2" "-O3" "-Os" "-Og" "-std=c++03" "-std=c++11" "-std=c++14"
"-DCRYPTOPP_DISABLE_ASM" "-fsanitize=address" "-fsanitize=undefined" "-march=armv8-a+crypto" "-march=armv8-a+crc"
"-DDCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562" "-DDCRYPTOPP_NO_UNALIGNED_DATA_ACCESS")
"-DDCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562" "-DDCRYPTOPP_NO_UNALIGNED_DATA_ACCESS")
# Additional CXXFLAGS we did not filter
RETAINED_CXXFLAGS=("")
@ -182,6 +182,24 @@ if [ "$IS_ARM32" -ne "0" ] || [ "$IS_ARM64" -ne "0" ]; then
fi
fi
HAVE_X86_AES=0
HAVE_X86_RDRAND=0
HAVE_X86_RDSEED=0
if [ "$IS_X86" -ne "0" ] || [ "$IS_X64" -ne "0" ]; then
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -maes adhoc.cpp.proto -o $TMP/adhoc.exe > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_X86_AES=1
fi
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -mrdrnd adhoc.cpp.proto -o $TMP/adhoc.exe > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_X86_RDRAND=1
fi
$CXX -x c++ -DCRYPTOPP_ADHOC_MAIN -mrdseed adhoc.cpp.proto -o $TMP/adhoc.exe > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
HAVE_X86_RDSEED=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)
@ -1656,6 +1674,42 @@ if [ "$IS_DARWIN" -ne "0" ]; then
fi
fi
############################################
# Modern compiler and old hardware, like PII, PIII or Core2
if [ "$IS_X86" -ne "0" ] || [ "$IS_X64" -ne "0" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: AES, RDRAND and RDSEED" | tee -a "$TEST_RESULTS"
echo
OPTS=("")
if [ "$HAVE_X86_AES" -ne "0" ]; then
OPTS+=("-maes")
fi
if [ "$HAVE_X86_RDRAND" -ne "0" ]; then
OPTS+=("-mrdrnd")
fi
if [ "$HAVE_X86_RDSEED" -ne "0" ]; then
OPTS+=("-mrdseed")
fi
export CXXFLAGS="-DNDEBUG -g2 -O2 -march=native ${OPTS[@]} ${RETAINED_CXXFLAGS[@]}"
"$MAKE" "${MAKEARGS[@]}" static 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
############################################
# ARM CRC32
if [ "$HAVE_ARM_CRC" -ne "0" ]; then