summaryrefslogtreecommitdiff
path: root/TestScripts
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-12 20:32:41 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-12 20:32:41 -0500
commit6fa0d8429d8fea06c04dcf3acedae721d02c11a0 (patch)
treeb4a44839b2f70e26ba1a3097576202a7c0fb1a7a /TestScripts
parentb40ca9755094a33f9d438aee3b2cc476cfc04e07 (diff)
downloadcryptopp-git-6fa0d8429d8fea06c04dcf3acedae721d02c11a0.tar.gz
Add shared object and dynamic library tests (GH #533)
Diffstat (limited to 'TestScripts')
-rwxr-xr-xTestScripts/cryptest.sh137
1 files changed, 137 insertions, 0 deletions
diff --git a/TestScripts/cryptest.sh b/TestScripts/cryptest.sh
index 705e947a..2463e67e 100755
--- a/TestScripts/cryptest.sh
+++ b/TestScripts/cryptest.sh
@@ -107,6 +107,7 @@ IS_DRAGONFLY=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c dragonfly)
IS_FREEBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c freebsd)
IS_NETBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c netbsd)
IS_SOLARIS=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c sunos)
+IS_BSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c bsd)
IS_DEBIAN=$(lsb_release -a 2>&1 | "$GREP" -i -c debian)
IS_FEDORA=$(lsb_release -a 2>&1 | "$GREP" -i -c fedora)
@@ -692,6 +693,14 @@ if [[ (-z "$HAVE_DISASS") ]]; then
fi
fi
+# LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
+if [[ "$IS_LINUX" -ne "0" || "$IS_SOLARIS" -ne "0" || "$IS_BSD" -ne "0" ]]; then
+ HAVE_LD_LIBRARY_PATH=1
+fi
+if [[ "$IS_DARWIN" -ne "0" ]]; then
+ HAVE_DYLD_LIBRARY_PATH=1
+fi
+
# Fixup... GCC 4.8 ASAN produces false positives under ARM
if [[ ( ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") && "$GCC_48_COMPILER" -ne "0") ]]; then
HAVE_ASAN=0
@@ -1777,6 +1786,134 @@ if true; then
fi
############################################
+# Shared Objects
+if [[ "$HAVE_LD_LIBRARY_PATH" -ne "0" ]]; then
+ ############################################
+ # Debug build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Debug, shared object" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ # Create a new makefile based on the old one
+ "$SED" -e 's|\./libcryptopp.a|\./libcryptopp.so|g' -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.so $(TESTOBJS)|g' GNUmakefile > GNUmakefile.shared
+
+ CXXFLAGS="$DEBUG_CXXFLAGS"
+ DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}")
+ CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
+
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
+ else
+ LD_LIBRARY_PATH="." ./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
+ LD_LIBRARY_PATH="." ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
+ fi
+ fi
+
+ ############################################
+ # Release build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Release, shared object" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ CXXFLAGS="$RELEASE_CXXFLAGS"
+ DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}")
+ CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
+
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
+ else
+ LD_LIBRARY_PATH="." ./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
+ LD_LIBRARY_PATH="." ./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
+ echo
+ fi
+
+ rm -f GNUmakefile.shared > /dev/null 2>&1
+fi
+
+############################################
+# Dynamic Objects on Darwin
+if [[ "$HAVE_DYLD_LIBRARY_PATH" -ne "0" ]]; then
+ ############################################
+ # Debug build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Debug, dynamic library" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ # Create a new makefile based on the old one
+ "$SED" -e 's|\./libcryptopp.a|\./libcryptopp.dylib|g' -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.dylib $(TESTOBJS)|g' GNUmakefile > GNUmakefile.shared
+
+ CXXFLAGS="$DEBUG_CXXFLAGS"
+ DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}")
+ CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
+
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
+ else
+ DYLD_LIBRARY_PATH="." ./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
+ DYLD_LIBRARY_PATH="." ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
+ fi
+ fi
+
+ ############################################
+ # Release build
+ echo
+ echo "************************************" | tee -a "$TEST_RESULTS"
+ echo "Testing: Release, dynamic library" | tee -a "$TEST_RESULTS"
+ echo
+
+ "$MAKE" clean > /dev/null 2>&1
+ rm -f adhoc.cpp > /dev/null 2>&1
+
+ CXXFLAGS="$RELEASE_CXXFLAGS"
+ DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}")
+ CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
+
+ if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then
+ echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
+ else
+ DYLD_LIBRARY_PATH="." ./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
+ DYLD_LIBRARY_PATH="." ./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
+ echo
+ fi
+
+ rm -f GNUmakefile.shared > /dev/null 2>&1
+fi
+
+############################################
# Debian specific.
if [[ ("$IS_DEBIAN" -ne "0" || "$IS_UBUNTU" -ne "0") ]]; then