Updated script to stop dumping warnings to cout from cryptest-warn.txt. It was producing too mucgh output in some configurations due to -Wcast-align
parent
96c51ffb2c
commit
80134f2ef4
55
cryptest.sh
55
cryptest.sh
|
|
@ -3,13 +3,8 @@
|
||||||
# cryptest.sh - written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
|
# cryptest.sh - written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
|
||||||
# Copyright assigned to Crypto++ project.
|
# Copyright assigned to Crypto++ project.
|
||||||
|
|
||||||
# This is a test script that can be used on some Linux/Unix/Apple machines
|
# This is a test script that can be used on some Linux/Unix/Apple machines to automate building the
|
||||||
# to automate building the library and running the self test with various
|
# library and running the self test with various combinations of flags, options, and conditions.
|
||||||
# combinations of flags, options, and conditions.
|
|
||||||
|
|
||||||
# Everything is tee'd into cryptest-result.txt. Change it to suite your taste. You
|
|
||||||
# should be able to use `egrep -a "(Error|error|FAILED|Illegal)" cryptest-result.txt`
|
|
||||||
# to quickly find errors and failures.
|
|
||||||
|
|
||||||
# Set to suite your taste
|
# Set to suite your taste
|
||||||
TEST_RESULTS=cryptest-result.txt
|
TEST_RESULTS=cryptest-result.txt
|
||||||
|
|
@ -34,8 +29,7 @@ touch "$WARN_RESULTS"
|
||||||
# ADD_CXXFLAGS=""
|
# ADD_CXXFLAGS=""
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
# Avoid CRYPTOPP_DATA_DIR
|
# Avoid CRYPTOPP_DATA_DIR in this shell
|
||||||
OLD_CRYPTOPP_DATA_DIR="$CRYPTOPP_DATA_DIR"
|
|
||||||
unset CRYPTOPP_DATA_DIR
|
unset CRYPTOPP_DATA_DIR
|
||||||
|
|
||||||
# I can't seem to get the expression to work in sed on Apple. It returns the original CXXFLAGS.
|
# I can't seem to get the expression to work in sed on Apple. It returns the original CXXFLAGS.
|
||||||
|
|
@ -175,34 +169,38 @@ if [ "$IS_MINGW" -ne "0" ]; then
|
||||||
echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS"
|
echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "User CXXFLAGS: $CXXFLAGS" | tee -a "$TEST_RESULTS"
|
|
||||||
echo "Retained CXXFLAGS: $ADD_CXXFLAGS" | tee -a "$TEST_RESULTS"
|
|
||||||
echo "Compiler:" $($CXX --version | head -1) | tee -a "$TEST_RESULTS"
|
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
# CPU is core count, memory is in KB. Low resource boards have
|
# CPU is logical count, memory is in MB. Low resource boards have
|
||||||
# fewer than 4 cores and 1GB or less memory.
|
# fewer than 4 cores and 1GB or less memory. We use this to
|
||||||
|
# determine if we can build in parallel without a OOM kill.
|
||||||
CPU=1
|
CPU=1
|
||||||
MEM=1024
|
MEM=1024
|
||||||
|
|
||||||
if [ "$IS_DARWIN" -ne "0" ]; then
|
if [ "$IS_DARWIN" -ne "0" ]; then
|
||||||
CPU=$(sysctl -a | grep 'hw.availcpu' | head -1 | awk '{print $3}')
|
CPU=$(sysctl -a | grep 'hw.availcpu' | head -1 | awk '{print $3}')
|
||||||
MEM=$(sysctl -a | grep 'hw.memsize' | head -1 | awk '{print $3}')
|
MEM=$(sysctl -a | grep 'hw.memsize' | head -1 | awk '{print $3}')
|
||||||
MEM=$(($MEM/1024))
|
MEM=$(($MEM/1024/1024))
|
||||||
fi
|
fi
|
||||||
if [ "$IS_LINUX" -ne "0" ]; then
|
if [ "$IS_LINUX" -ne "0" ]; then
|
||||||
CPU=$(cat /proc/cpuinfo | grep -c '^processor')
|
CPU=$(cat /proc/cpuinfo | grep -c '^processor')
|
||||||
MEM=$(cat /proc/meminfo | grep "MemTotal" | awk '{print $2}')
|
MEM=$(cat /proc/meminfo | grep "MemTotal" | awk '{print $2}')
|
||||||
|
MEM=$(($MEM/1024))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "CPU: $CPU"
|
echo "CPU: $CPU logical, MEM: $MEM MB"
|
||||||
echo "MEM: $MEM"
|
|
||||||
|
|
||||||
if [ "$CPU" -ge "2" ] && [ "$MEM" -ge "2097152" ]; then
|
if [ "$CPU" -ge "2" ] && [ "$MEM" -ge "2048" ]; then
|
||||||
MAKEARGS=(-j "$CPU")
|
MAKEARGS=(-j "$CPU")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
############################################
|
||||||
|
|
||||||
|
echo | tee -a "$TEST_RESULTS"
|
||||||
|
echo "User CXXFLAGS: $CXXFLAGS" | tee -a "$TEST_RESULTS"
|
||||||
|
echo "Retained CXXFLAGS: $ADD_CXXFLAGS" | tee -a "$TEST_RESULTS"
|
||||||
|
echo "Compiler:" $($CXX --version | head -1) | tee -a "$TEST_RESULTS"
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
|
|
@ -1699,7 +1697,7 @@ echo "Testing started: $TEST_BEGIN" | tee -a "$TEST_RESULTS"
|
||||||
echo "Testing finished: $TEST_END" | tee -a "$TEST_RESULTS"
|
echo "Testing finished: $TEST_END" | tee -a "$TEST_RESULTS"
|
||||||
echo | tee -a "$TEST_RESULTS"
|
echo | tee -a "$TEST_RESULTS"
|
||||||
|
|
||||||
COUNT=$(grep -a "Testing: " cryptest-result.txt | wc -l)
|
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"
|
echo "No configurations tested" | tee -a "$TEST_RESULTS"
|
||||||
else
|
else
|
||||||
|
|
@ -1712,27 +1710,27 @@ echo | tee -a "$TEST_RESULTS"
|
||||||
# "Error" is from the GNU assembler
|
# "Error" is from the GNU assembler
|
||||||
# "error" is from the sanitizers
|
# "error" is from the sanitizers
|
||||||
# "Illegal", "0 errors" and "suppressed errors" are from Valgrind.
|
# "Illegal", "0 errors" and "suppressed errors" are from Valgrind.
|
||||||
ECOUNT=$(egrep -a '(Error|ERROR|error|FAILED|Illegal)' cryptest-result.txt | egrep -v '( 0 errors|suppressed errors|memory error detector)' | wc -l)
|
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"
|
echo "No failures detected" | tee -a "$TEST_RESULTS"
|
||||||
else
|
else
|
||||||
echo "$ECOUNT errors detected" | tee -a "$TEST_RESULTS"
|
echo "$ECOUNT errors detected. See $TEST_RESULTS for details" | tee -a "$TEST_RESULTS"
|
||||||
echo
|
echo
|
||||||
egrep -an '(Error|ERROR|error|FAILED|Illegal)' cryptest-result.txt | egrep -v '( 0 errors|suppressed errors|memory error detector)'
|
egrep -an '(Error|ERROR|error|FAILED|Illegal)' "$TEST_RESULTS" | egrep -v '( 0 errors|suppressed errors|error detector)'
|
||||||
fi
|
fi
|
||||||
echo | tee -a "$TEST_RESULTS"
|
echo | tee -a "$TEST_RESULTS"
|
||||||
|
|
||||||
# Write warnings to $TEST_RESULTS
|
# Write warnings to $TEST_RESULTS
|
||||||
WCOUNT=$(egrep -a '(warning:)' cryptest-warn.txt | grep -v 'deprecated-declarations' | wc -l)
|
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"
|
echo "No warnings detected" | tee -a "$TEST_RESULTS"
|
||||||
else
|
else
|
||||||
echo "$WCOUNT warnings detected" | tee -a "$TEST_RESULTS"
|
echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$TEST_RESULTS"
|
||||||
echo
|
echo
|
||||||
egrep -an '(warning:)' cryptest-warn.txt | grep -v 'deprecated-declarations'
|
# egrep -an '(warning:)' $WARN_RESULTS | grep -v 'deprecated-declarations'
|
||||||
fi
|
fi
|
||||||
echo | tee -a "$TEST_RESULTS"
|
echo | tee -a "$TEST_RESULTS"
|
||||||
|
|
||||||
echo "************************************************" | tee -a "$TEST_RESULTS"
|
echo "************************************************" | tee -a "$TEST_RESULTS"
|
||||||
echo "************************************************" | tee -a "$TEST_RESULTS"
|
echo "************************************************" | tee -a "$TEST_RESULTS"
|
||||||
|
|
||||||
|
|
@ -1742,6 +1740,3 @@ if [ "$ECOUNT" -eq "0" ]; then
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore
|
|
||||||
CRYPTOPP_DATA_DIR="$OLD_CRYPTOPP_DATA_DIR"
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue