summaryrefslogtreecommitdiff
path: root/TestScripts
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-19 21:08:37 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-19 21:08:37 -0400
commit6102333fc3c1c73c8c5b05e7cd568ac681741c9d (patch)
tree1a54b40f518230ac1727380ea431b85cf7d87495 /TestScripts
parent6440921723695913cfcfffdf2c59f0cf01e59c89 (diff)
downloadcryptopp-git-6102333fc3c1c73c8c5b05e7cd568ac681741c9d.tar.gz
Add CRYPTOPP_NO_CPU_FEATURE_PROBES (GH #511)
We determine machine capabilities by performing an os/platform *query* first, like getauxv(). If the *query* fails, we move onto a cpu *probe*. The cpu *probe* tries to exeute an instruction and then catches a SIGILL on Linux or the exception EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes fail to hangle a SIGILL gracefully, like Apple OSes. Apple machines corrupt memory and variables around the probe.
Diffstat (limited to 'TestScripts')
-rwxr-xr-xTestScripts/cryptest.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/TestScripts/cryptest.sh b/TestScripts/cryptest.sh
index 6343f724..65d2b2fa 100755
--- a/TestScripts/cryptest.sh
+++ b/TestScripts/cryptest.sh
@@ -2159,6 +2159,63 @@ if true; then
fi
############################################
+# Debug build, NO_CPU_FEATURE_PROBES
+if true; then
+
+ ############################################
+ # Debug build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Debug, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1"
+ CXX="$CXX" CXXFLAGS="$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
+
+ ############################################
+ # Release build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Release, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1"
+ CXX="$CXX" CXXFLAGS="$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
+
+############################################
# c++03 debug and release build
if [[ "$HAVE_CXX03" -ne "0" ]]; then