diff --git a/cryptest.sh b/cryptest.sh index 1d7ec1fe..c28f80c7 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -128,6 +128,8 @@ fi SUN_COMPILER=$("$CXX" -V 2>&1 | "$EGREP" -i -c "CC: Sun") GCC_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "(gcc|g\+\+)") +INTEL_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "\(ICC\)") +MACPORTS_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "MacPorts") CLANG_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "clang") if [[ ($("$CXX" -dM -E - /dev/null | "$EGREP" -c '(__x64_64__|__amd64__)') -ne "0") && ($("$CXX" -dM -E -/dev/null | "$EGREP" -c '(__ILP32|__ILP32)') -ne "0") ]]; then @@ -3888,6 +3890,75 @@ if [[ ("$INTEL_COMPILER" -eq "0") ]]; then fi fi +############################################ +# Perform a quick check with MacPorts compilers, if available. +if [[ ("$MACPORTS_COMPILER" -eq "0") ]]; then + + MACPORTS_CXX=$(find /opt/local/bin -name 'g++*' 2>/dev/null | head -1) + if [[ (-z "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMP/adhoc.exe" > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + + ############################################ + # GCC build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts GCC compiler" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + "$MAKE" "${MAKEARGS[@]}" CXX="$MACPORTS_CXX" 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 + fi + + MACPORTS_CXX=$(find /opt/local/bin -name 'clang++*' 2>/dev/null | head -1) + if [[ (-z "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMP/adhoc.exe" > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + + ############################################ + # Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts Clang compiler" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + "$MAKE" "${MAKEARGS[@]}" CXX="$MACPORTS_CXX" 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 + fi +fi + ############################################ # Perform a quick check with Xcode compiler, if available. if [[ "$IS_DARWIN" -ne "0" ]]; then @@ -4094,14 +4165,14 @@ fi # Report warnings echo -echo "************************************************" | tee -a "$WARN_RESULTS" -echo | tee -a "$WARN_RESULTS" +echo "************************************************" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" +echo | tee -a "$TEST_RESULTS" "$WARN_RESULTS" WCOUNT=$("$EGREP" -a '(warning:)' $WARN_RESULTS | "$GREP" -v 'deprecated-declarations' | wc -l | "$AWK" '{print $1}') if (( "$WCOUNT" == "0" )); then - echo "No warnings detected" | tee -a "$WARN_RESULTS" | tee -a "$WARN_RESULTS" + echo "No warnings detected" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" else - echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$WARN_RESULTS" + echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" # "$EGREP" -an '(warning:)' $WARN_RESULTS | "$GREP" -v 'deprecated-declarations' fi @@ -4110,8 +4181,8 @@ fi echo echo "************************************************" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" +echo | tee -a "$TEST_RESULTS" "$WARN_RESULTS" -echo echo "Testing started: $TEST_BEGIN" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" echo "Testing finished: $TEST_END" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" echo