diff --git a/cryptest.sh b/cryptest.sh index d2b9c28f..d83714dc 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -32,7 +32,7 @@ FILTERED_CXXFLAGS=("-DDEBUG" "-DNDEBUG" "-g" "-g0" "-g1" "-g2" "-g3" "-O0" "-O1" # Additional CXXFLAGS we did not filter RETAINED_CXXFLAGS=("") -if [ ! -z "CXXFLAGS" ]; then +if [[ !(-z "CXXFLAGS") ]]; then TEMP_CXXFLAGS=$(echo "$CXXFLAGS" | sed 's/\([[:blank:]]*=[[:blank:]]*\)/=/g') IFS=' ' read -r -a TEMP_ARRAY <<< "$TEMP_CXXFLAGS" @@ -41,11 +41,11 @@ if [ ! -z "CXXFLAGS" ]; then found=0 for filtered in "${FILTERED_CXXFLAGS[@]}" do - if [ "$flag" = "$filtered" ]; then + if [[ "$flag" = "$filtered" ]]; then found=1 fi done - if [ "$found" -eq "0" ]; then + if [[ "$found" -eq "0" ]]; then RETAINED_CXXFLAGS+=("$flag") fi done @@ -58,6 +58,7 @@ unset CRYPTOPP_DATA_DIR # We are OK with -i and -c, but we will eventually need more. GREP=grep EGREP=egrep +AWK=awk IS_DARWIN=$(uname -s | $GREP -i -c darwin) IS_LINUX=$(uname -s | $GREP -i -c linux) @@ -73,23 +74,24 @@ IS_ARM32=$(uname -m | $EGREP -i -c "arm|aarch32") IS_ARM64=$(uname -m | $EGREP -i -c "arm64|aarch64") # Fixup -if [ "$IS_SOLARIS" -ne "0" ]; then +if [[ "$IS_SOLARIS" -ne "0" ]]; then IS_X64=$(isainfo 2>/dev/null | $GREP -i -c "amd64") - if [ "$IS_X64" -ne "0" ]; then + if [[ "$IS_X64" -ne "0" ]]; then IS_X86=0 fi # Need something more powerful than the non-Posix versions - if [ -e "/usr/gnu/bin/grep" ]; then GREP=/usr/gnu/bin/grep; fi - if [ -e "/usr/gnu/bin/egrep" ]; then EGREP=/usr/gnu/bin/egrep; fi + if [[ (-e "/usr/gnu/bin/grep") ]]; then GREP=/usr/gnu/bin/grep; fi + if [[ (-e "/usr/gnu/bin/egrep") ]]; then EGREP=/usr/gnu/bin/egrep; fi + if [[ (-e "/usr/gnu/bin/awk") ]]; then AWK=/usr/gnu/bin/awk; else AWK=nawk; fi fi # We need to use the C++ compiler to determine if c++11 is available. Otherwise # a mis-detection occurs on Mac OS X 10.9 and above. Below, we use the same # Implicit Variables as make. Also see # https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html -if [ -z "$CXX" ]; then - if [ "$IS_DARWIN" -ne "0" ]; then +if [[ -z "$CXX" ]]; then + if [[ "$IS_DARWIN" -ne "0" ]]; then CXX=c++ else # Linux, MinGW, Cygwin and fallback ... @@ -98,34 +100,40 @@ if [ -z "$CXX" ]; then fi # Fixup -if [ "$CXX" == "gcc" ]; then +if [[ "$CXX" == "gcc" ]]; then CXX=g++ fi -# Fixup. See if the user already set it to CC -if [ "$IS_SOLARIS" -ne "0" ] && [ $(echo $CXX | grep -c "CC" 2>/dev/null) -ne "0" ]; then - if [ -e "/opt/solarisstudio12.4/bin/CC" ]; then +# See if the user already set CC. If not, select the latest Sun Studio we can find. +if [[ ("$IS_SOLARIS" -ne "0") ]] && [[ $(echo $CXX | $GREP -c "CC" 2>/dev/null) -ne "0" ]]; then + if [[ (-e "/opt/solarisstudio12.5/bin/CC") ]]; then + CXX=/opt/solarisstudio12.5/bin/CC + elif [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then CXX=/opt/solarisstudio12.4/bin/CC - elif [ -e "/opt/solarisstudio12.3/bin/CC" ]; then + elif [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then CXX=/opt/solarisstudio12.3/bin/CC + elif [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then + CXX=/opt/solstudio12.2/bin/CC fi fi + SUN_COMPILER=$($CXX -V 2>&1 | $EGREP -i -c "CC: Sun") +GCC_COMPILER=$($CXX --version 2>&1 | $EGREP -i -c "(gcc|g\+\+)") +CLANG_COMPILER=$($CXX --version 2>&1 | $EGREP -i -c "clang") # Now that the compiler is fixed, see if its GCC 5.1 or above with -Wabi, -Wabi-tag and -Wodr -GCC_51_OR_ABOVE=$(g++ -v 2>&1 | $EGREP -i -c 'gcc version (5\.[1-9]|[6-9])') - -# Now that the compiler is fixed, see if its GCC 5.1 or above with -Wabi, -Wabi-tag and -Wodr -GCC_51_OR_ABOVE=$(g++ -v 2>&1 | egrep -i -c 'gcc version (5\.[1-9]|[6-9])') +GCC_51_OR_ABOVE=$($CXX -v 2>&1 | $EGREP -i -c 'gcc version (5\.[1-9]|[6-9])') +# SunCC 12.2 and below needs one set of CXXFLAGS; SunCC 12.3 and above needs another set of CXXFLAGS +SUNCC_123_OR_ABOVE=$("$CXX" -E -xdumpmacros /dev/null 2>&1 | $GREP " __SUNPRO_CC " 2>/dev/null | $AWK '{print ($2 >= 0x5120) ? "1" : "0"}' ) # Fixup -if [ "$IS_OPENBSD" -ne "0" ] || [ "$IS_NETBSD" -ne "0" ] || [ "$IS_SOLARIS" -ne "0" ]; then +if [[ ("$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0" || "$IS_SOLARIS" -ne "0") ]]; then MAKE=gmake else MAKE=make fi -if [ -z "$TMP" ]; then +if [[ -z "$TMP" ]]; then TMP=/tmp fi @@ -136,77 +144,77 @@ cp adhoc.cpp.proto adhoc.cpp # Hit or miss, only latest compilers. HAVE_CXX17=0 $CXX -DCRYPTOPP_ADHOC_MAIN -std=c++17 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ]; then +if [[ "$?" -eq "0" ]]; then HAVE_CXX17=1 fi # Hit or miss, mostly miss. HAVE_CXX14=0 $CXX -DCRYPTOPP_ADHOC_MAIN -std=c++14 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ]; then +if [[ "$?" -eq "0" ]]; then HAVE_CXX14=1 fi # Hit or miss, mostly hit. HAVE_CXX11=0 $CXX -DCRYPTOPP_ADHOC_MAIN -std=c++11 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ]; then +if [[ "$?" -eq "0" ]]; then HAVE_CXX11=1 fi # OpenBSD 5.7 and OS X 10.5 cannot consume -std=c++03 HAVE_CXX03=0 $CXX -DCRYPTOPP_ADHOC_MAIN -std=c++03 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ]; then +if [[ "$?" -eq "0" ]]; then HAVE_CXX03=1 fi # Undefined Behavior sanitizer HAVE_UBSAN=0 $CXX -DCRYPTOPP_ADHOC_MAIN -fsanitize=undefined adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then +if [[ ("$?" -eq "0") && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0") ]]; then HAVE_UBSAN=1 fi # Address sanitizer HAVE_ASAN=0 $CXX -DCRYPTOPP_ADHOC_MAIN -fsanitize=address adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then +if [[ ("$?" -eq "0") && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0") ]]; then HAVE_ASAN=1 fi # Darwin and Intel multiarch HAVE_INTEL_MULTIARCH=0 -if [ "$IS_DARWIN" -ne "0" ] && [ "$IS_X86" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0") && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0") ]]; then $CXX -DCRYPTOPP_ADHOC_MAIN -arch i386 -arch x86_64 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then HAVE_INTEL_MULTIARCH=1 fi fi # Darwin and PowerPC multiarch HAVE_PPC_MULTIARCH=0 -if [ "$IS_DARWIN" -ne "0" ] && [ "$IS_PPC" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0") && ("$IS_PPC" -ne "0") ]]; then $CXX -DCRYPTOPP_ADHOC_MAIN -arch ppc -arch ppc64 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then HAVE_PPC_MULTIARCH=1 fi fi # Debian and a couple of others HAVE_X32=0 -if [ "$IS_X64" -ne "0" ]; then +if [[ "$IS_X64" -ne "0" ]]; then $CXX -DCRYPTOPP_ADHOC_MAIN -mx32 adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then HAVE_X32=1 fi fi # ARMv7/Aarch32 HAVE_ARM_NEON=0 -if [ "$IS_ARM32" -ne "0" ] || [ "$IS_ARM64" -ne "0" ]; then +if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then # $CXX -DCRYPTOPP_ADHOC_MAIN -march=armv7a -mfpu=neon adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ $(cat /proc/cpuinfo 2>/dev/null | grep -i -c NEON) -ne "0" ]; then + if [[ $(cat /proc/cpuinfo 2>/dev/null | $GREP -i -c NEON) -ne "0" ]]; then HAVE_ARM_NEON=1 fi fi @@ -214,13 +222,13 @@ fi # ARMv8/Aarch64, CRC and Crypto HAVE_ARM_CRC=0 HAVE_ARM_CRYPTO=0 -if [ "$IS_ARM32" -ne "0" ] || [ "$IS_ARM64" -ne "0" ]; then +if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then $CXX -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crc adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then HAVE_ARM_CRC=1 fi $CXX -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crypto adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then HAVE_ARM_CRYPTO=1 fi fi @@ -230,24 +238,22 @@ HAVE_X86_AES=0 HAVE_X86_RDRAND=0 HAVE_X86_RDSEED=0 HAVE_X86_PCLMUL=0 -if [ "$IS_X86" -ne "0" ] || [ "$IS_X64" -ne "0" ]; then - if [ "$SUN_COMPILER" -eq "0" ]; then - $CXX -DCRYPTOPP_ADHOC_MAIN -maes adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then - HAVE_X86_AES=1 - fi - $CXX -DCRYPTOPP_ADHOC_MAIN -mrdrnd adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then - HAVE_X86_RDRAND=1 - fi - $CXX -DCRYPTOPP_ADHOC_MAIN -mrdseed adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then - HAVE_X86_RDSEED=1 - fi - $CXX -DCRYPTOPP_ADHOC_MAIN -mpclmul adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then - HAVE_X86_PCLMUL=1 - fi +if [[ (("$IS_X86" -ne "0") || ("$IS_X64" -ne "0")) && ("$SUN_COMPILER" -eq "0") ]]; then + $CXX -DCRYPTOPP_ADHOC_MAIN -maes adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + HAVE_X86_AES=1 + fi + $CXX -DCRYPTOPP_ADHOC_MAIN -mrdrnd adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + HAVE_X86_RDRAND=1 + fi + $CXX -DCRYPTOPP_ADHOC_MAIN -mrdseed adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + HAVE_X86_RDSEED=1 + fi + $CXX -DCRYPTOPP_ADHOC_MAIN -mpclmul adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 + if [[ "$?" -eq "0" ]]; then + HAVE_X86_PCLMUL=1 fi fi @@ -257,60 +263,62 @@ HAVE_LDGOLD=$(file `which ld.gold 2>&1` 2>/dev/null | $GREP -v "no ld.gold" | cu # 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) -# Echo back to ensure something is not missed. +############################################ + +# Systm information +echo | tee -a "$TEST_RESULTS" +if [[ "$IS_DARWIN" -ne "0" ]]; then + echo "IS_DARWIN: $IS_DARWIN" | tee -a "$TEST_RESULTS" + unset MallocScribble MallocPreScribble MallocGuardEdges +fi +if [[ "$IS_LINUX" -ne "0" ]]; then + echo "IS_LINUX: $IS_LINUX" | tee -a "$TEST_RESULTS" +fi +if [[ "$IS_CYGWIN" -ne "0" ]]; then + echo "IS_CYGWIN: $IS_CYGWIN" | tee -a "$TEST_RESULTS" +fi +if [[ "$IS_MINGW" -ne "0" ]]; then + echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS" +fi +if [[ "$IS_SOLARIS" -ne "0" ]]; then + echo "IS_SOLARIS: $IS_SOLARIS" | tee -a "$TEST_RESULTS" +fi + +if [[ "$IS_ARM64" -ne "0" ]]; then + echo "IS_ARM64: $IS_ARM64" | tee -a "$TEST_RESULTS" +elif [[ "$IS_ARM32" -ne "0" ]]; then + echo "IS_ARM32: $IS_ARM32" | tee -a "$TEST_RESULTS" +fi +if [[ "$IS_X64" -ne "0" ]]; then + echo "IS_X64: $IS_X64" | tee -a "$TEST_RESULTS" +elif [[ "$IS_X86" -ne "0" ]]; then + echo "IS_X86: $IS_X86" | tee -a "$TEST_RESULTS" +fi + +# C++03, C++11, C++14 and C++17 echo | tee -a "$TEST_RESULTS" echo "HAVE_CXX03: $HAVE_CXX03" | tee -a "$TEST_RESULTS" echo "HAVE_CXX11: $HAVE_CXX11" | tee -a "$TEST_RESULTS" -if [ "$HAVE_CXX14" -ne "0" ]; then +if [[ ("$HAVE_CXX14" -ne "0" || "$HAVE_CXX17" -ne "0") ]]; then echo "HAVE_CXX14: $HAVE_CXX14" | tee -a "$TEST_RESULTS" -fi -if [ "$HAVE_CXX17" -ne "0" ]; then echo "HAVE_CXX17: $HAVE_CXX17" | tee -a "$TEST_RESULTS" fi -if [ "$HAVE_LDGOLD" -ne "0" ]; then +if [[ "$HAVE_LDGOLD" -ne "0" ]]; then echo "HAVE_LDGOLD: $HAVE_LDGOLD" | tee -a "$TEST_RESULTS" fi -# Print these tools +# Tools available for testing echo "HAVE_ASAN: $HAVE_ASAN" | tee -a "$TEST_RESULTS" echo "HAVE_UBSAN: $HAVE_UBSAN" | tee -a "$TEST_RESULTS" echo "HAVE_VALGRIND: $HAVE_VALGRIND" | tee -a "$TEST_RESULTS" -if [ "$HAVE_INTEL_MULTIARCH" -ne "0" ]; then +if [[ "$HAVE_INTEL_MULTIARCH" -ne "0" ]]; then echo "HAVE_INTEL_MULTIARCH: $HAVE_INTEL_MULTIARCH" | tee -a "$TEST_RESULTS" fi -if [ "$HAVE_PPC_MULTIARCH" -ne "0" ]; then +if [[ "$HAVE_PPC_MULTIARCH" -ne "0" ]]; then echo "HAVE_PPC_MULTIARCH: $HAVE_PPC_MULTIARCH" | tee -a "$TEST_RESULTS" fi -if [ "$IS_DARWIN" -ne "0" ]; then - echo "IS_DARWIN: $IS_DARWIN" | tee -a "$TEST_RESULTS" - unset MallocScribble MallocPreScribble MallocGuardEdges -fi -if [ "$IS_LINUX" -ne "0" ]; then - echo "IS_LINUX: $IS_LINUX" | tee -a "$TEST_RESULTS" -fi -if [ "$IS_CYGWIN" -ne "0" ]; then - echo "IS_CYGWIN: $IS_CYGWIN" | tee -a "$TEST_RESULTS" -fi -if [ "$IS_MINGW" -ne "0" ]; then - echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS" -fi -if [ "$IS_SOLARIS" -ne "0" ]; then - echo "IS_SOLARIS: $IS_SOLARIS" | tee -a "$TEST_RESULTS" -fi - -if [ "$IS_ARM64" -ne "0" ]; then - echo "IS_ARM64: $IS_ARM64" | tee -a "$TEST_RESULTS" -elif [ "$IS_ARM32" -ne "0" ]; then - echo "IS_ARM32: $IS_ARM32" | tee -a "$TEST_RESULTS" -fi -if [ "$IS_X64" -ne "0" ]; then - echo "IS_X64: $IS_X64" | tee -a "$TEST_RESULTS" -elif [ "$IS_X86" -ne "0" ]; then - echo "IS_X86: $IS_X86" | tee -a "$TEST_RESULTS" -fi - ############################################ # CPU is logical count, memory is in MiB. Low resource boards have @@ -321,41 +329,41 @@ MEM_SIZE=512 if [[ (-e "/proc/cpuinfo") && (-e "/proc/meminfo") ]]; then CPU_COUNT=$(cat /proc/cpuinfo | $GREP -c '^processor') - MEM_SIZE=$(cat /proc/meminfo | $GREP "MemTotal" | awk '{print $2}') + MEM_SIZE=$(cat /proc/meminfo | $GREP "MemTotal" | $AWK '{print $2}') MEM_SIZE=$(($MEM_SIZE/1024)) elif [[ "$IS_DARWIN" -ne "0" ]]; then - CPU_COUNT=$(sysctl -a 2>/dev/null | $GREP 'hw.availcpu' | head -1 | awk '{print $3}') - MEM_SIZE=$(sysctl -a 2>/dev/null | $GREP 'hw.memsize' | head -1 | awk '{print $3}') + CPU_COUNT=$(sysctl -a 2>/dev/null | $GREP 'hw.availcpu' | head -1 | $AWK '{print $3}') + MEM_SIZE=$(sysctl -a 2>/dev/null | $GREP 'hw.memsize' | head -1 | $AWK '{print $3}') MEM_SIZE=$(($MEM_SIZE/1024/1024)) elif [[ "$IS_SOLARIS" -ne "0" ]]; then - CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | nawk '{print $1}') - MEM_SIZE=$(prtconf 2>/dev/null | $GREP Memory | nawk '{print $3}') + CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | $AWK '{print $1}') + MEM_SIZE=$(prtconf 2>/dev/null | $GREP Memory | $AWK '{print $3}') fi # Benchmarks expect frequency in GiHz. CPU_FREQ=0.5 if [[ (-e "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq") ]]; then CPU_FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) - CPU_FREQ=$(awk "BEGIN {print $CPU_FREQ/1024/1024}") + CPU_FREQ=$($AWK "BEGIN {print $CPU_FREQ/1024/1024}") elif [[ (-e "/proc/cpuinfo") ]]; then - CPU_FREQ=$(cat /proc/cpuinfo | grep 'MHz' | head -1 | awk '{print $4}') + CPU_FREQ=$(cat /proc/cpuinfo | $GREP 'MHz' | head -1 | $AWK '{print $4}') if [[ -z "$CPU_FREQ" ]]; then CPU_FREQ=512; fi - CPU_FREQ=$(awk "BEGIN {print $CPU_FREQ/1024}") + CPU_FREQ=$($AWK "BEGIN {print $CPU_FREQ/1024}") elif [[ "$IS_DARWIN" -ne "0" ]]; then - CPU_FREQ=$(sysctl -a 2>/dev/null | $GREP 'hw.cpufrequency' | head -1 | awk '{print $3}') - CPU_FREQ=$(awk "BEGIN {print $CPU_FREQ/1024/1024/1024}") + CPU_FREQ=$(sysctl -a 2>/dev/null | $GREP 'hw.cpufrequency' | head -1 | $AWK '{print $3}') + CPU_FREQ=$($AWK "BEGIN {print $CPU_FREQ/1024/1024/1024}") elif [[ "$IS_SOLARIS" -ne "0" ]]; then - CPU_FREQ=$(psrinfo -v 2>/dev/null | $GREP 'MHz' | head -1 | nawk '{print $6}') - CPU_FREQ=$(nawk "BEGIN {print $CPU_FREQ/1024}") + CPU_FREQ=$(psrinfo -v 2>/dev/null | $GREP 'MHz' | head -1 | $AWK '{print $6}') + CPU_FREQ=$($AWK "BEGIN {print $CPU_FREQ/1024}") fi # Some ARM devboards cannot use 'make -j N', even with multiple cores and RAM # An 8-core Cubietruck Plus with 2GB RAM experiences OOM kills with '-j 2'. HAVE_SWAP=1 -if [ "$IS_LINUX" -ne "0" ]; then - if [ -e "/proc/meminfo" ]; then - SWAP_SIZE=$(cat /proc/meminfo | $GREP "SwapTotal" | awk '{print $2}') - if [ "$SWAP_SIZE" -eq "0" ]; then +if [[ "$IS_LINUX" -ne "0" ]]; then + if [[ (-e "/proc/meminfo") ]]; then + SWAP_SIZE=$(cat /proc/meminfo | $GREP "SwapTotal" | $AWK '{print $2}') + if [[ "$SWAP_SIZE" -eq "0" ]]; then HAVE_SWAP=0 fi else @@ -368,7 +376,7 @@ echo "CPU: $CPU_COUNT logical" | tee -a "$TEST_RESULTS" echo "FREQ: $CPU_FREQ GHz" | tee -a "$TEST_RESULTS" echo "MEM: $MEM_SIZE MB" | tee -a "$TEST_RESULTS" -if [ "$CPU_COUNT" -ge "2" ] && [ "$MEM_SIZE" -ge "1280" ] && [ "$HAVE_SWAP" -ne "0" ]; then +if [[ ("$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0") ]]; then MAKEARGS=(-j "$CPU_COUNT") echo "Using $MAKE -j $CPU_COUNT" fi @@ -376,8 +384,8 @@ fi ############################################ GIT_REPO=$(git branch 2>&1 | $GREP -v "fatal" | wc -l) -if [ "$GIT_REPO" -ne "0" ]; then - GIT_BRANCH=$(git branch 2>/dev/null | grep '*' | cut -c 3-) +if [[ "$GIT_REPO" -ne "0" ]]; then + GIT_BRANCH=$(git branch 2>/dev/null | $GREP '*' | cut -c 3-) GIT_HASH=$(git rev-parse HEAD 2>/dev/null | cut -c 1-16) fi @@ -388,11 +396,11 @@ echo "User CXXFLAGS: $CXXFLAGS" | tee -a "$TEST_RESULTS" echo "Retained CXXFLAGS: ${RETAINED_CXXFLAGS[@]}" | tee -a "$TEST_RESULTS" echo | tee -a "$TEST_RESULTS" -if [ ! -z "$GIT_BRANCH" ]; then +if [[ ! -z "$GIT_BRANCH" ]]; then echo "Git branch: $GIT_BRANCH (commit $GIT_HASH)" | tee -a "$TEST_RESULTS" fi -if [ "$SUN_COMPILER" -ne "0" ]; then +if [[ "$SUN_COMPILER" -ne "0" ]]; then echo $($CXX -V 2>&1 | head -1 | sed 's|CC|Compiler|g') | tee -a "$TEST_RESULTS" else echo "Compiler:" $($CXX --version | head -1) | tee -a "$TEST_RESULTS" @@ -400,17 +408,53 @@ fi ############################################ -# Add to keep noise to a minimum +# Keep noise to a minimum $CXX -DCRYPTOPP_ADHOC_MAIN -Wno-deprecated-declarations adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 -if [ "$?" -eq "0" ]; then +if [[ "$?" -eq "0" ]]; then RETAINED_CXXFLAGS+=("-Wno-deprecated-declarations") fi # Add to exercise NEON more thoroughly -if [ "$IS_ARM32" -ne "0" ] && [ "$HAVE_ARM_NEON" -ne "0" ]; then +if [[ ("$IS_ARM32" -ne "0") && ("$HAVE_ARM_NEON" -ne "0") ]]; then RETAINED_CXXFLAGS+=("-mfpu=neon") fi +# Calcualte these once. They handle Clang, GCC, ICC, etc +DEBUG_CXXFLAGS="-DDEBUG -g3 -O0" +RELEASE_CXXFLAGS="-DNDEBUG -g2 -O2" +VALGRIND_CXXFLAGS="-DNDEBUG -g2 -O1" +ELEVATED_CXXFLAGS=() + +# SunCC is a special case +if [[ "$SUN_COMPILER" -ne "0" ]]; then + if [[ "$SUNCC_123_OR_ABOVE" -ne "0" ]]; then + DEBUG_CXXFLAGS="-DDEBUG -g3 -xO0" + RELEASE_CXXFLAGS="-DNDEBUG -g2 -xO2" + VALGRIND_CXXFLAGS="-DNDEBUG -g2 -xO1" + else + DEBUG_CXXFLAGS="-DDEBUG -g -xO0" + RELEASE_CXXFLAGS="-DNDEBUG -g -xO2" + VALGRIND_CXXFLAGS="-DNDEBUG -g -xO1" + fi +fi + +if [[ "$GCC_COMPILER" -ne "0" ]]; then + ELEVATED_CXXFLAGS+=("-DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562" "-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS" "-Wall" "-Wextra") + ELEVATED_CXXFLAGS+=("-Wno-unknown-pragmas" "-Wstrict-aliasing=3" "-Wstrict-overflow" "-Waggressive-loop-optimizations") + ELEVATED_CXXFLAGS+=("-Wcast-align" "-Wwrite-strings" "-Wformat=2" "-Wformat-security" "-Wtrampolines") + + if [[ ("$GCC_51_OR_ABOVE" -ne "0") ]]; then + ELEVATED_CXXFLAGS+=("-Wabi" "-Wodr") + fi +fi + +if [[ "$CLANG_COMPILER" -ne "0" ]]; then + ELEVATED_CXXFLAGS+=("-DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562" "-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS" "-Wall" "-Wextra") + ELEVATED_CXXFLAGS+=("-Wno-unknown-pragmas" "-Wstrict-overflow" "-Wcast-align" "-Wwrite-strings" "-Wformat=2" "-Wformat-security") +fi + +############################################ +############################################ ############################################ ############################################ @@ -420,7 +464,7 @@ echo "Start time: $TEST_BEGIN" | tee -a "$TEST_RESULTS" ############################################ # Basic NEON build -if [ "$IS_ARM32" -ne "0" ] && [ "$HAVE_ARM_NEON" -ne "0" ]; then +if [[ ("$IS_ARM32" -ne "0" && "$HAVE_ARM_NEON" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: NEON, default CXXFLAGS" | tee -a "$TEST_RESULTS" @@ -433,15 +477,15 @@ if [ "$IS_ARM32" -ne "0" ] && [ "$HAVE_ARM_NEON" -ne "0" ]; then export CXXFLAGS="-g2 -O2 -mfpu=neon" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -458,23 +502,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0" -else - export CXXFLAGS="-DDEBUG -g2 -O0" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -490,23 +529,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2" -else - export CXXFLAGS="-DNDEBUG -g2 -O2" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -522,23 +556,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0 -DCRYPTOPP_DISABLE_ASM" -else - export CXXFLAGS="-DDEBUG -g2 -O0 -DCRYPTOPP_DISABLE_ASM" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -554,30 +583,28 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_DISABLE_ASM" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_DISABLE_ASM" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi ############################################ -# c++03 debug build -if [ "$HAVE_CXX03" -ne "0" ]; then +# c++03 debug and build +if [[ "$HAVE_CXX03" -ne "0" ]]; then + + ############################################ + # c++03 debug build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++03" | tee -a "$TEST_RESULTS" @@ -587,31 +614,24 @@ if [ "$HAVE_CXX03" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DDEBUG -g3 -O2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi -fi -############################################ -# c++03 release build -if [ "$HAVE_CXX03" -ne "0" ]; then + ############################################ + # c++03 release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++03" | tee -a "$TEST_RESULTS" @@ -621,31 +641,29 @@ if [ "$HAVE_CXX03" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi fi ############################################ -# c++11 debug build -if [ "$HAVE_CXX11" -ne "0" ]; then +# c++11 debug and release build +if [[ "$HAVE_CXX11" -ne "0" ]]; then + + ############################################ + # c++11 debug and release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++11" | tee -a "$TEST_RESULTS" @@ -655,31 +673,24 @@ if [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DDEBUG -g2 -O0 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi -fi -############################################ -# c++11 release build -if [ "$HAVE_CXX11" -ne "0" ]; then + ############################################ + # c++11 release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++11" | tee -a "$TEST_RESULTS" @@ -689,31 +700,29 @@ if [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi fi ############################################ -# c++14 debug build -if [ "$HAVE_CXX14" -ne "0" ]; then +# c++14 debug and release build +if [[ "$HAVE_CXX14" -ne "0" ]]; then + + ############################################ + # c++14 debug build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++14" | tee -a "$TEST_RESULTS" @@ -723,31 +732,24 @@ if [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DDEBUG -g3 -O0 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi -fi -############################################ -# c++14 release build -if [ "$HAVE_CXX14" -ne "0" ]; then + ############################################ + # c++14 release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++14" | tee -a "$TEST_RESULTS" @@ -757,31 +759,29 @@ if [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g3 -O2 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi fi ############################################ -# c++17 debug build -if [ "$HAVE_CXX17" -ne "0" ]; then +# c++17 debug and release build +if [[ "$HAVE_CXX17" -ne "0" ]]; then + + ############################################ + # c++17 debug build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++17" | tee -a "$TEST_RESULTS" @@ -791,31 +791,24 @@ if [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DDEBUG -g2 -O0 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi -fi -############################################ -# c++17 release build -if [ "$HAVE_CXX17" -ne "0" ]; then + ############################################ + # c++17 release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++17" | tee -a "$TEST_RESULTS" @@ -825,31 +818,29 @@ if [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi fi ############################################ -# X32 debug build -if [ "$HAVE_X32" -ne "0" ]; then +# X32 debug and release build +if [[ "$HAVE_X32" -ne "0" ]]; then + + ############################################ + # X32 debug build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, X32" | tee -a "$TEST_RESULTS" @@ -859,26 +850,24 @@ if [ "$HAVE_X32" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g2 -O2 -mx32 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$DEBUG_CXXFLAGS -mx32 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + 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 + ############################################ + # X32 release build echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, X32" | tee -a "$TEST_RESULTS" @@ -888,18 +877,18 @@ if [ "$HAVE_X32" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -mx32 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -mx32 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -916,23 +905,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO0 -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DDEBUG -g3 -O0 -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -948,24 +932,19 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g3 -O2 -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS-DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" fi ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 +if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi @@ -980,23 +959,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO1 -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DDEBUG -g3 -O1 -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1012,23 +986,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=250 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1045,23 +1014,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1078,23 +1042,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1110,23 +1069,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO1 -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DDEBUG -g3 -O1 -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1142,23 +1096,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DNO_OS_DEPENDENCE ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1174,23 +1123,18 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO1 -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DDEBUG -g2 -O1 -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1206,30 +1150,25 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_USE_FIPS_202_SHA3 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi ############################################ # Build with LD-Gold -if [ "$HAVE_LDGOLD" -ne "0" ]; then +if [[ "$HAVE_LDGOLD" -ne "0" ]]; then ############################################ # Debug build with LD-Gold @@ -1242,23 +1181,18 @@ if [ "$HAVE_LDGOLD" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO3 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DDEBUG -g2 -O3 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$DEBUG_CXXFLAGS -g3 -xO0 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" LD="ld.gold" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1274,23 +1208,18 @@ if [ "$HAVE_LDGOLD" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO3 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g2 -O3 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" LD="ld.gold" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1307,23 +1236,23 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DDEBUG -g3 -xO3 ${RETAINED_CXXFLAGS[@]}" +if [[ "$SUN_COMPILER" -ne "0" ]]; then + export CXXFLAGS="-DDEBUG -g -xO3 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" else export CXXFLAGS="-DDEBUG -g2 -O3 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" fi -"$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1339,30 +1268,25 @@ unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 -if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO3 ${RETAINED_CXXFLAGS[@]}" -else - export CXXFLAGS="-DNDEBUG -g2 -O3 ${RETAINED_CXXFLAGS[@]}" -fi - +export CXXFLAGS="$RELEASE_CXXFLAGS ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" -if [ "${PIPESTATUS[0]}" -ne "0" ]; then +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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi ############################################ # Debug build at -Os -if [ "$SUN_COMPILER" -eq "0" ]; then +if [[ ("$SUN_COMPILER" -eq "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, -Os optimizations" | tee -a "$TEST_RESULTS" @@ -1375,15 +1299,15 @@ if [ "$SUN_COMPILER" -eq "0" ]; then export CXXFLAGS="-DDEBUG -g2 -Os ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1391,7 +1315,7 @@ fi ############################################ # Release build at -Os -if [ "$SUN_COMPILER" -eq "0" ]; then +if [[ ("$SUN_COMPILER" -eq "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, -Os optimizations" | tee -a "$TEST_RESULTS" @@ -1404,15 +1328,15 @@ if [ "$SUN_COMPILER" -eq "0" ]; then export CXXFLAGS="-DNDEBUG -g2 -Os ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1420,7 +1344,7 @@ fi ############################################ # Debug build, dead code strip -if [ "$SUN_COMPILER" -eq "0" ]; then +if [[ ("$SUN_COMPILER" -eq "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, dead code strip" | tee -a "$TEST_RESULTS" @@ -1429,18 +1353,18 @@ if [ "$SUN_COMPILER" -eq "0" ]; then unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g2 -O2 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$DEBUG_CXXFLAGS= ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" lean 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1448,7 +1372,7 @@ fi ############################################ # Release build, dead code strip -if [ "$SUN_COMPILER" -eq "0" ]; then +if [[ ("$SUN_COMPILER" -eq "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, dead code strip" | tee -a "$TEST_RESULTS" @@ -1458,18 +1382,18 @@ if [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" lean 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1477,7 +1401,7 @@ fi ############################################ # Debug build, UBSan, c++03 -if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++03, UBsan" | tee -a "$TEST_RESULTS" @@ -1487,18 +1411,18 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g2 -O1 -std=c++03 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1506,7 +1430,7 @@ fi ############################################ # Release build, UBSan, c++03 -if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++03, UBsan" | tee -a "$TEST_RESULTS" @@ -1516,18 +1440,18 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1535,7 +1459,7 @@ fi ############################################ # Debug build, Asan, c++03 -if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: debug, c++03, Asan" | tee -a "$TEST_RESULTS" @@ -1545,23 +1469,23 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g2 -O1 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - - if [ "$CXX" == "clang++" ]; then + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" else + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1569,7 +1493,7 @@ fi ############################################ # Release build, Asan, c++03 -if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: release, c++03, Asan" | tee -a "$TEST_RESULTS" @@ -1579,23 +1503,52 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - - if [ "$CXX" == "clang++" ]; then + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" else + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi +fi + +############################################ +# Debug build, UBSan, c++11 +if [[ "$HAVE_CXX11" -ne "0" ]] && [ "$HAVE_UBSAN" -ne "0" ]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: debug, c++11, UBsan" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | 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 @@ -1603,27 +1556,62 @@ fi ############################################ # Release build, UBSan, c++11 -if [ "$HAVE_CXX11" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then +if [[ "$HAVE_CXX11" -ne "0" ]] && [ "$HAVE_UBSAN" -ne "0" ]; then + echo echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: c++11, UBsan" | tee -a "$TEST_RESULTS" + echo "Testing: release, c++11, UBsan" | 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 -std=c++11 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi +fi + +############################################ +# Debug build, Asan, c++11 +if [[ "$HAVE_CXX11" -ne "0" ]] && [ "$HAVE_ASAN" -ne "0" ]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: debug, c++11, Asan" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" + else + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" + fi + + 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 @@ -1631,33 +1619,33 @@ fi ############################################ # Release build, Asan, c++11 -if [ "$HAVE_CXX11" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then +if [[ "$HAVE_CXX11" -ne "0" ]] && [ "$HAVE_ASAN" -ne "0" ]; then echo echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: c++11, Asan" | tee -a "$TEST_RESULTS" + echo "Testing: release, c++11, Asan" | 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 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - - if [ "$CXX" == "clang++" ]; then + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" else + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1665,7 +1653,7 @@ fi ############################################ # Release build, UBSan, c++14 -if [ "$HAVE_CXX14" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then +if [[ "$HAVE_CXX14" -ne "0" ]] && [ "$HAVE_UBSAN" -ne "0" ]; then echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: c++14, UBsan" | tee -a "$TEST_RESULTS" echo @@ -1674,18 +1662,18 @@ if [ "$HAVE_CXX14" -ne "0" ] && [ "$HAVE_UBSAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1693,7 +1681,7 @@ fi ############################################ # Release build, Asan, c++14 -if [ "$HAVE_CXX14" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then +if [[ "$HAVE_CXX14" -ne "0" ]] && [ "$HAVE_ASAN" -ne "0" ]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: c++14, Asan" | tee -a "$TEST_RESULTS" @@ -1703,34 +1691,96 @@ if [ "$HAVE_CXX14" -ne "0" ] && [ "$HAVE_ASAN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - - if [ "$CXX" == "clang++" ]; then + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" else + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi +fi + +############################################ +# Release build, UBSan, c++17 +if [[ "$HAVE_CXX17" -ne "0" ]] && [ "$HAVE_UBSAN" -ne "0" ]; then + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: c++17, UBsan" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" ubsan | 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 + +############################################ +# Release build, Asan, c++17 +if [[ "$HAVE_CXX17" -ne "0" ]] && [ "$HAVE_ASAN" -ne "0" ]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: c++17, Asan" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + if [[ "$CXX" == "clang++" ]]; then + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | asan_symbolize | tee -a "$TEST_RESULTS" + else + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" asan | tee -a "$TEST_RESULTS" + fi + + 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 # For Solaris, test under Sun Studio 12.2 - 12.5 -if [ "$IS_SOLARIS" -ne "0" ]; then +if [[ "$IS_SOLARIS" -ne "0" ]]; then ############################################ # Sun Studio 12.2 - if [ -e "/opt/solstudio12.2/bin/CC" ]; then + if [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then ############################################ # Basic debug build @@ -1743,18 +1793,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g -xO0" + export CXXFLAGS="$DEBUG_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solstudio12.2/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1770,18 +1820,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g -xO3" + export CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solstudio12.2/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1789,7 +1839,7 @@ if [ "$IS_SOLARIS" -ne "0" ]; then ############################################ # Sun Studio 12.3 - if [ -e "/opt/solarisstudio12.3/bin/CC" ]; then + if [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then ############################################ # Basic debug build @@ -1802,18 +1852,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g3 -xO0" + export CXXFLAGS="$DEBUG_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.3/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1829,18 +1879,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g3 -xO2" + export CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.3/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1848,7 +1898,7 @@ if [ "$IS_SOLARIS" -ne "0" ]; then ############################################ # Sun Studio 12.4 - if [ -e "/opt/solarisstudio12.4/bin/CC" ]; then + if [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then ############################################ # Basic debug build @@ -1861,18 +1911,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g3 -xO0" + export CXXFLAGS="$DEBUG_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.4/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1888,18 +1938,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g3 -xO2" + export CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.4/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1907,7 +1957,7 @@ if [ "$IS_SOLARIS" -ne "0" ]; then ############################################ # Sun Studio 12.5 - if [ -e "/opt/solarisstudio12.5/bin/CC" ]; then + if [[ (-e "/opt/solarisstudio12.5/bin/CC") ]]; then ############################################ # Basic debug build @@ -1920,18 +1970,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DDEBUG -g3 -xO0" + export CXXFLAGS="$DEBUG_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.5/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1947,18 +1997,18 @@ if [ "$IS_SOLARIS" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g3 -xO2" + export CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" CXX=/opt/solarisstudio12.5/bin/CC static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1970,7 +2020,7 @@ fi ############################################ # Darwin, c++03, libc++ -if [ "$HAVE_CXX03" -ne "0" ] && [ "$IS_DARWIN" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX03" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++03, libc++ (LLVM)" | tee -a "$TEST_RESULTS" @@ -1980,18 +2030,18 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$IS_DARWIN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -1999,7 +2049,7 @@ fi ############################################ # Darwin, c++03, libstdc++ -if [ "$HAVE_CXX03" -ne "0" ] && [ "$IS_DARWIN" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX03" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++03, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" @@ -2009,18 +2059,18 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$IS_DARWIN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++03 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2028,7 +2078,7 @@ fi ############################################ # Darwin, c++11, libc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++11, libc++ (LLVM)" | tee -a "$TEST_RESULTS" @@ -2038,18 +2088,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++11 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2057,7 +2107,7 @@ fi ############################################ # Darwin, c++11, libstdc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++11, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" @@ -2067,18 +2117,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++11 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2086,7 +2136,7 @@ fi ############################################ # Darwin, c++14, libc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++14, libc++ (LLVM)" | tee -a "$TEST_RESULTS" @@ -2096,18 +2146,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++14 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2115,7 +2165,7 @@ fi ############################################ # Darwin, c++14, libstdc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++14, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" @@ -2125,18 +2175,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++14 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2144,7 +2194,7 @@ fi ############################################ # Darwin, c++17, libc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++17, libc++ (LLVM)" | tee -a "$TEST_RESULTS" @@ -2154,18 +2204,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++17 -stdlib=libc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2173,7 +2223,7 @@ fi ############################################ # Darwin, c++17, libstdc++ -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++17, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" @@ -2183,18 +2233,18 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++17 -stdlib=libstdc++ ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2202,7 +2252,7 @@ fi ############################################ # Darwin, Intel multiarch, c++03 -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_CXX03" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [[ "$HAVE_CXX03" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, Intel multiarch, c++03" | tee -a "$TEST_RESULTS" @@ -2212,29 +2262,29 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_C "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -arch i386 -arch x86_64 -std=c++03 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -arch i386 -arch x86_64 -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "Running i386 version..." arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" fi arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" fi echo "Running x86_64 version..." arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" fi arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" fi fi @@ -2242,7 +2292,7 @@ fi ############################################ # Darwin, Intel multiarch, c++11 -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [[ "$HAVE_CXX11" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, Intel multiarch, c++11" | tee -a "$TEST_RESULTS" @@ -2252,29 +2302,29 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_C "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -arch i386 -arch x86_64 -std=c++11 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -arch i386 -arch x86_64 -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "Running i386 version..." arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" fi arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" fi echo "Running x86_64 version..." arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" fi arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" fi fi @@ -2282,7 +2332,7 @@ fi ############################################ # Darwin, Intel multiarch, c++14 -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [[ "$HAVE_CXX14" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, Intel multiarch, c++14" | tee -a "$TEST_RESULTS" @@ -2292,29 +2342,29 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_C "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -arch i386 -arch x86_64 -std=c++14 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -arch i386 -arch x86_64 -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "Running i386 version..." arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" fi arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" fi echo "Running x86_64 version..." arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" fi arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" fi fi @@ -2322,7 +2372,7 @@ fi ############################################ # Darwin, Intel multiarch, c++17 -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [[ "$HAVE_CXX17" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, Intel multiarch, c++17" | tee -a "$TEST_RESULTS" @@ -2332,29 +2382,29 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_INTEL_MULTIARCH" -ne "0" ] && [ "$HAVE_C "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -arch i386 -arch x86_64 -std=c++17 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -arch i386 -arch x86_64 -std=c++17 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "Running i386 version..." arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" fi arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" fi echo "Running x86_64 version..." arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" fi arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" fi fi @@ -2362,7 +2412,7 @@ fi ############################################ # Darwin, PowerPC multiarch -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_PPC_MULTIARCH" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]] && [ "$HAVE_PPC_MULTIARCH" -ne "0" ]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, PowerPC multiarch" | tee -a "$TEST_RESULTS" @@ -2372,29 +2422,29 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_PPC_MULTIARCH" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -arch ppc -arch ppc64 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -arch ppc -arch ppc64 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "Running PPC version..." arch -ppc ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (PPC)" | tee -a "$TEST_RESULTS" fi arch -ppc ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (PPC)" | tee -a "$TEST_RESULTS" fi echo "Running PPC64 version..." arch -ppc64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite (PPC64)" | tee -a "$TEST_RESULTS" fi arch -ppc64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors (PPC64)" | tee -a "$TEST_RESULTS" fi fi @@ -2402,7 +2452,7 @@ fi ############################################ # Darwin, c++03, Malloc Guards -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX03" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX03" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++03, Malloc Guards" | tee -a "$TEST_RESULTS" @@ -2412,10 +2462,10 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX03" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else export MallocScribble=1 @@ -2423,11 +2473,11 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX03" -ne "0" ]; then export MallocGuardEdges=1 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi @@ -2437,7 +2487,7 @@ fi ############################################ # Darwin, c++11, Malloc Guards -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++11, Malloc Guards" | tee -a "$TEST_RESULTS" @@ -2447,10 +2497,10 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else export MallocScribble=1 @@ -2458,11 +2508,11 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then export MallocGuardEdges=1 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi @@ -2472,7 +2522,7 @@ fi ############################################ # Darwin, c++14, Malloc Guards -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++14, Malloc Guards" | tee -a "$TEST_RESULTS" @@ -2482,10 +2532,10 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else export MallocScribble=1 @@ -2493,11 +2543,11 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then export MallocGuardEdges=1 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi @@ -2507,7 +2557,7 @@ fi ############################################ # Darwin, c++17, Malloc Guards -if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then +if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Darwin, c++17, Malloc Guards" | tee -a "$TEST_RESULTS" @@ -2517,10 +2567,10 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -std=c++17 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else export MallocScribble=1 @@ -2528,11 +2578,11 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then export MallocGuardEdges=1 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi @@ -2542,13 +2592,13 @@ fi ############################################ # Xcode compiler -if [ "$IS_DARWIN" -ne "0" ]; then +if [[ "$IS_DARWIN" -ne "0" ]]; then XCODE_COMPILER=$(find /Applications/Xcode*.app/Contents/Developer -name clang++ 2>/dev/null | head -1) - if [ -z "$XCODE_COMPILER" ]; then + if [[ (-z "$XCODE_COMPILER") ]]; then XCODE_COMPILER=$(find /Developer/Applications/Xcode.app -name clang++ 2>/dev/null | head -1) fi - if [ ! -z "$XCODE_COMPILER" ]; then + if [[ !(-z "$XCODE_COMPILER") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Xcode Clang compiler" | tee -a "$TEST_RESULTS" @@ -2558,18 +2608,18 @@ if [ "$IS_DARWIN" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$XCODE_COMPILER" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2578,7 +2628,7 @@ fi ############################################ # Modern compiler and old hardware, like PII, PIII or Core2 -if [ "$HAVE_X86_AES" -ne "0" ] || [ "$HAVE_X86_RDRAND" -ne "0" ] || [ "$HAVE_X86_RDSEED" -ne "0" ]; then +if [[ ("$HAVE_X86_AES" -ne "0" || "$HAVE_X86_RDRAND" -ne "0" || "$HAVE_X86_RDSEED" -ne "0") ]; then echo echo "************************************" | tee -a "$TEST_RESULTS" @@ -2586,16 +2636,16 @@ if [ "$HAVE_X86_AES" -ne "0" ] || [ "$HAVE_X86_RDRAND" -ne "0" ] || [ "$HAVE_X86 echo OPTS=("-march=native") - if [ "$HAVE_X86_AES" -ne "0" ]; then + if [[ "$HAVE_X86_AES" -ne "0" ]]; then OPTS+=("-maes") fi - if [ "$HAVE_X86_RDRAND" -ne "0" ]; then + if [[ "$HAVE_X86_RDRAND" -ne "0" ]]; then OPTS+=("-mrdrnd") fi - if [ "$HAVE_X86_RDSEED" -ne "0" ]; then + if [[ "$HAVE_X86_RDSEED" -ne "0" ]]; then OPTS+=("-mrdseed") fi - if [ "$HAVE_X86_PCLMUL" -ne "0" ]; then + if [[ "$HAVE_X86_PCLMUL" -ne "0" ]]; then OPTS+=("-mpclmul") fi @@ -2603,17 +2653,17 @@ if [ "$HAVE_X86_AES" -ne "0" ] || [ "$HAVE_X86_RDRAND" -ne "0" ] || [ "$HAVE_X86 "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 ${OPTS[@]} ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= ${OPTS[@]} ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2621,7 +2671,7 @@ fi ############################################ # Explicit ARMv7a NEON -if [ "$IS_ARM32" -ne "0" ] && [ "$HAVE_ARM_NEON" -ne "0" ]; then +if [[ ("$IS_ARM32" -ne "0" && "$HAVE_ARM_NEON" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: ARM ARMv7a NEON" | tee -a "$TEST_RESULTS" @@ -2631,18 +2681,18 @@ if [ "$IS_ARM32" -ne "0" ] && [ "$HAVE_ARM_NEON" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -march=armv7a -mfpu=neon ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -march=armv7a -mfpu=neon ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2650,7 +2700,7 @@ fi ############################################ # ARM CRC32 -if [ "$HAVE_ARM_CRC" -ne "0" ]; then +if [[ "$HAVE_ARM_CRC" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: ARM CRC32" | tee -a "$TEST_RESULTS" @@ -2660,18 +2710,18 @@ if [ "$HAVE_ARM_CRC" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -march=armv8-a+crc ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -march=armv8-a+crc ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2679,7 +2729,7 @@ fi ############################################ # ARM Crypto -if [ "$HAVE_ARM_CRYPTO" -ne "0" ]; then +if [[ "$HAVE_ARM_CRYPTO" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: ARM Crypto" | tee -a "$TEST_RESULTS" @@ -2689,18 +2739,18 @@ if [ "$HAVE_ARM_CRYPTO" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -march=armv8-a+crypto ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -march=armv8-a+crypto ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2708,7 +2758,7 @@ fi ############################################ # Benchmarks, c++03 -if [ "$HAVE_CXX03" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Benchmarks, c++03" | tee -a "$TEST_RESULTS" @@ -2717,19 +2767,15 @@ if [ "$HAVE_CXX03" -ne "0" ]; then unset CXXFLAGS "$MAKE" clean > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -xO3 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -O3 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -xO3 -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "**************************************" >> "$BENCHMARK_RESULTS" ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" fi fi @@ -2737,7 +2783,7 @@ fi ############################################ # Benchmarks, c++11 -if [ "$HAVE_CXX11" -ne "0" ]; then +if [[ "$HAVE_CXX11" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Benchmarks, c++11" | tee -a "$TEST_RESULTS" @@ -2747,20 +2793,15 @@ if [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -xO3 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -O3 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "**************************************" >> "$BENCHMARK_RESULTS" ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" fi fi @@ -2768,7 +2809,7 @@ fi ############################################ # Benchmarks, c++14 -if [ "$HAVE_CXX14" -ne "0" ]; then +if [[ "$HAVE_CXX14" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Benchmarks, c++14" | tee -a "$TEST_RESULTS" @@ -2778,20 +2819,15 @@ if [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -xO3 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -O3 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else echo "**************************************" >> "$BENCHMARK_RESULTS" ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" fi fi @@ -2802,7 +2838,7 @@ fi ############################################ # MinGW and PREFER_BERKELEY_STYLE_SOCKETS -if [ "$IS_MINGW" -ne "0" ]; then +if [[ "$IS_MINGW" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: MinGW, PREFER_BERKELEY_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" @@ -2812,18 +2848,18 @@ if [ "$IS_MINGW" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -DPREFER_BERKELEY_STYLE_SOCKETS -DNO_WINDOWS_STYLE_SOCKETS ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -DPREFER_BERKELEY_STYLE_SOCKETS -DNO_WINDOWS_STYLE_SOCKETS ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2831,7 +2867,7 @@ fi ############################################ # MinGW and PREFER_WINDOWS_STYLE_SOCKETS -if [ "$IS_MINGW" -ne "0" ]; then +if [[ "$IS_MINGW" -ne "0" ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: MinGW, PREFER_WINDOWS_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" @@ -2841,18 +2877,18 @@ if [ "$IS_MINGW" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="-DNDEBUG -g2 -O2 -DPREFER_WINDOWS_STYLE_SOCKETS -DNO_BERKELEY_STYLE_SOCKETS ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS= -DPREFER_WINDOWS_STYLE_SOCKETS -DNO_BERKELEY_STYLE_SOCKETS ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -2860,7 +2896,7 @@ fi ############################################ # Valgrind, c++03. Requires -O1 for accurate results -if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_VALGRIND" -ne "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" ]] && [ "$HAVE_VALGRIND" -ne "0" ]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Valgrind, c++03" | tee -a "$TEST_RESULTS" @@ -2870,15 +2906,10 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$HAVE_VALGRIND" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO1 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g3 -O1 -std=c++03 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++03 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else valgrind --track-origins=yes ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" @@ -2888,7 +2919,7 @@ fi ############################################ # Valgrind, c++11. Requires -O1 for accurate results -if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then +if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Valgrind, c++11" | tee -a "$TEST_RESULTS" @@ -2898,15 +2929,10 @@ if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO1 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g3 -O1 -std=c++11 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++11 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else valgrind --track-origins=yes ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" @@ -2916,7 +2942,7 @@ fi ############################################ # Valgrind, c++14. Requires -O1 for accurate results -if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then +if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Valgrind, c++14" | tee -a "$TEST_RESULTS" @@ -2926,15 +2952,10 @@ if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX14" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO1 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g3 -O1 -std=c++14 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++14 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else valgrind --track-origins=yes ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" @@ -2944,7 +2965,7 @@ fi ############################################ # Valgrind, c++17. Requires -O1 for accurate results -if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then +if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then echo echo "************************************" | tee -a "$TEST_RESULTS" echo "Testing: Valgrind, c++17" | tee -a "$TEST_RESULTS" @@ -2954,15 +2975,10 @@ if [ "$HAVE_VALGRIND" -ne "0" ] && [ "$HAVE_CXX17" -ne "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO1 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g3 -O1 -std=c++17 ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++17 ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" else valgrind --track-origins=yes ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" @@ -2972,7 +2988,7 @@ fi ############################################ # Build with elevated warnings -if [ "$HAVE_CXX03" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then +if [[ "$HAVE_CXX03" -ne "0" ]] && [ "$SUN_COMPILER" -eq "0" ]; then ############################################ # C++03 debug build @@ -2985,18 +3001,10 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi @@ -3011,25 +3019,16 @@ if [ "$HAVE_CXX03" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $RELEASE_CXXFLAGS_ELEVATED" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "$?" -ne "0" ]; then + if [[ "$?" -ne "0" ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi fi ############################################ # Build with elevated warnings -if [ "$HAVE_CXX11" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then +if [[ "$HAVE_CXX11" -ne "0" ]] && [ "$SUN_COMPILER" -eq "0" ]; then ############################################ # C++11 debug build @@ -3042,18 +3041,10 @@ if [ "$HAVE_CXX11" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi @@ -3068,25 +3059,16 @@ if [ "$HAVE_CXX11" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "$?" -ne "0" ]; then + if [[ "$?" -ne "0" ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi fi ############################################ # Build with elevated warnings -if [ "$HAVE_CXX14" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then +if [[ "$HAVE_CXX14" -ne "0" ]] && [ "$SUN_COMPILER" -eq "0" ]; then ############################################ # C++14 debug build @@ -3099,18 +3081,10 @@ if [ "$HAVE_CXX14" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++14 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++14 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi @@ -3125,25 +3099,16 @@ if [ "$HAVE_CXX14" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++14 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "$?" -ne "0" ]; then + if [[ "$?" -ne "0" ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi fi ############################################ # Build with elevated warnings -if [ "$HAVE_CXX17" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then +if [[ "$HAVE_CXX17" -ne "0" ]] && [ "$SUN_COMPILER" -eq "0" ]; then ############################################ # C++17 debug build @@ -3156,18 +3121,10 @@ if [ "$HAVE_CXX17" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++17 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DDEBUG -g2 -O2 -std=c++17 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi @@ -3182,18 +3139,10 @@ if [ "$HAVE_CXX17" -ne "0" ] && [ "$SUN_COMPILER" -eq "0" ]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - if [ "$CXX" == "g++" ]; then - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines " - if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then - CXXFLAGS+="-Wabi -Wodr" - fi - else - CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++17 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security " - fi - - export CXXFLAGS + export CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${ELEVATED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [ "$?" -ne "0" ]; then + + if [[ "$?" -ne "0" ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" fi fi @@ -3205,7 +3154,7 @@ if [[ ("$CXX" == "g++") && ("$SUN_COMPILER" -eq "0") ]]; then CLANG_COMPILER=$(which clang++ 2>/dev/null) "$CLANG_COMPILER" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp -o $TMP/adhoc.exe > /dev/null 2>&1 - if [ "$?" -eq "0" ]; then + if [[ "$?" -eq "0" ]]; then ############################################ # Basic Clang build @@ -3219,15 +3168,15 @@ if [[ ("$CXX" == "g++") && ("$SUN_COMPILER" -eq "0") ]]; then rm -f adhoc.cpp > /dev/null 2>&1 "$MAKE" "${MAKEARGS[@]}" CXX="$CLANG_COMPILER" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + 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 + 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 + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" fi fi @@ -3250,14 +3199,10 @@ if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then INSTALL_DIR="/tmp/cryptopp_test" rm -rf "$INSTALL_DIR" > /dev/null 2>&1 - if [ "$SUN_COMPILER" -ne "0" ]; then - export CXXFLAGS="-DNDEBUG -g3 -xO2 -DCRYPTOPP_DATA_DIR='\"$INSTALL_DIR/share/cryptopp/\"' ${RETAINED_CXXFLAGS[@]}" - else - export CXXFLAGS="-DNDEBUG -g2 -O2 -DCRYPTOPP_DATA_DIR='\"$INSTALL_DIR/share/cryptopp/\"' ${RETAINED_CXXFLAGS[@]}" - fi - + export CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DATA_DIR='\"$INSTALL_DIR/share/cryptopp/\"' ${RETAINED_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$INSTALL_RESULTS" else # Still need to manulally place TestData and TestVectors @@ -3270,7 +3215,7 @@ if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then echo "Testing: Install (validation suite)" | tee -a "$INSTALL_RESULTS" echo ./cryptest.exe v 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute validation suite" | tee -a "$INSTALL_RESULTS" fi @@ -3279,7 +3224,7 @@ if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then echo "Testing: Install (test vectors)" | tee -a "$INSTALL_RESULTS" echo ./cryptest.exe tv all 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute test vectors" | tee -a "$INSTALL_RESULTS" fi @@ -3288,7 +3233,7 @@ if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then echo "Testing: Install (benchmarks)" | tee -a "$INSTALL_RESULTS" echo ./cryptest.exe b 1 2.4+1e9 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to execute benchmarks" | tee -a "$INSTALL_RESULTS" fi @@ -3297,7 +3242,7 @@ if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then echo "Testing: Install (help file)" | tee -a "$INSTALL_RESULTS" echo ./cryptest.exe h 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "1" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "1") ]]; then echo "ERROR: failed to provide help" | tee -a "$INSTALL_RESULTS" fi @@ -3308,7 +3253,7 @@ fi ############################################ # Test a remove with CRYPTOPP_DATA_DIR -if [ "$IS_CYGWIN" -eq "0" ] && [ "$IS_MINGW" -eq "0" ]; then +if [[ ("$IS_CYGWIN" -eq "0" && "$IS_MINGW" -eq "0") ]]; then echo echo "************************************" | tee -a "$INSTALL_RESULTS" @@ -3316,31 +3261,31 @@ if [ "$IS_CYGWIN" -eq "0" ] && [ "$IS_MINGW" -eq "0" ]; then echo "$MAKE" "${MAKEARGS[@]}" remove PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$INSTALL_RESULTS" - if [ "${PIPESTATUS[0]}" -ne "0" ]; then + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then echo "ERROR: failed to make remove" | tee -a "$INSTALL_RESULTS" else # Test for complete removal - if [ -d "$INSTALL_DIR/include/cryptopp" ]; then + if [[ (-d "$INSTALL_DIR/include/cryptopp") ]]; then echo "ERROR: failed to remove cryptopp include directory" | tee -a "$INSTALL_RESULTS" fi - if [ -d "$INSTALL_DIR/share/cryptopp" ]; then + if [[ (-d "$INSTALL_DIR/share/cryptopp") ]]; then echo "ERROR: failed to remove cryptopp share directory" | tee -a "$INSTALL_RESULTS" fi - if [ -d "$INSTALL_DIR/share/cryptopp/TestData" ]; then + if [[ (-d "$INSTALL_DIR/share/cryptopp/TestData") ]]; then echo "ERROR: failed to remove cryptopp test data directory" | tee -a "$INSTALL_RESULTS" fi - if [ -d "$INSTALL_DIR/share/cryptopp/TestVector" ]; then + if [[ (-d "$INSTALL_DIR/share/cryptopp/TestVector") ]]; then echo "ERROR: failed to remove cryptopp test vector directory" | tee -a "$INSTALL_RESULTS" fi - if [ -e "$INSTALL_DIR/bin/cryptest.exe" ]; then + if [[ (-e "$INSTALL_DIR/bin/cryptest.exe") ]]; then echo "ERROR: failed to remove cryptest.exe program" | tee -a "$INSTALL_RESULTS" fi - if [ -e "$INSTALL_DIR/lib/libcryptopp.a" ]; then + if [[ (-e "$INSTALL_DIR/lib/libcryptopp.a") ]]; then echo "ERROR: failed to remove libcryptopp.a static library" | tee -a "$INSTALL_RESULTS" fi - if [ "$IS_DARWIN" -ne "0" ] && [ -e "$INSTALL_DIR/lib/libcryptopp.dylib" ]; then + if [[ "$IS_DARWIN" -ne "0" && (-e "$INSTALL_DIR/lib/libcryptopp.dylib") ]]; then echo "ERROR: failed to remove libcryptopp.dylib dynamic library" | tee -a "$INSTALL_RESULTS" - elif [ -e "$INSTALL_DIR/lib/libcryptopp.so" ]; then + elif [[ (-e "$INSTALL_DIR/lib/libcryptopp.so") ]]; then echo "ERROR: failed to remove libcryptopp.so dynamic library" | tee -a "$INSTALL_RESULTS" fi fi @@ -3367,7 +3312,7 @@ echo "Testing finished: $TEST_END" | tee -a "$TEST_RESULTS" echo | tee -a "$TEST_RESULTS" COUNT=$($GREP -a 'Testing:' "$TEST_RESULTS" | wc -l) -if [ "$COUNT" -eq "0" ]; then +if [[ "$COUNT" -eq "0" ]]; then echo "No configurations tested" | tee -a "$TEST_RESULTS" else echo "$COUNT configurations tested" | tee -a "$TEST_RESULTS" @@ -3380,7 +3325,7 @@ echo | tee -a "$TEST_RESULTS" # "error" is from the sanitizers # "Illegal", "0 errors" and "suppressed errors" are from Valgrind. ECOUNT=$($EGREP -a '(Error|ERROR|error|FAILED|Illegal)' $TEST_RESULTS | $EGREP -v '( 0 errors|suppressed errors|error detector)' | wc -l) -if [ "$ECOUNT" -eq "0" ]; then +if [[ "$ECOUNT" -eq "0" ]; then echo "No failures detected" | tee -a "$TEST_RESULTS" else echo "$ECOUNT errors detected. See $TEST_RESULTS for details" | tee -a "$TEST_RESULTS" @@ -3391,7 +3336,7 @@ echo | tee -a "$TEST_RESULTS" # Write warnings to $TEST_RESULTS WCOUNT=$($EGREP -a '(warning:)' $WARN_RESULTS | $GREP -v 'deprecated-declarations' | wc -l) -if [ "$WCOUNT" -eq "0" ]; then +if [[ "$WCOUNT" -eq "0" ]]; then echo "No warnings detected" | tee -a "$TEST_RESULTS" else echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$TEST_RESULTS" @@ -3404,8 +3349,8 @@ echo "************************************************" | tee -a "$TEST_RESULTS" echo "************************************************" | tee -a "$TEST_RESULTS" # http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF -if [ "$ECOUNT" -eq "0" ]; then - [ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 +if [[ "$ECOUNT" -eq "0" ]]; then + [[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 else - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 fi