summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-31 09:14:31 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-31 09:23:31 +0200
commitb1d7d6ece4e7d637c4a635477215a8a1de8cfdce (patch)
tree151260467224007004be8d7f853886e22726fba2
parent4bc67882e72929732b1d9cccc73e606f3a44f542 (diff)
downloadlibtasn1-tmp-soname-check2.tar.gz
tests: ensure that soname is not accidentally bumpedtmp-soname-check2
Based on patch by Andreas Metzler. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--tests/Makefile.am12
-rwxr-xr-xtests/soname24
2 files changed, 33 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index be10bbb..4079c8b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I../gl
AM_LDFLAGS = -no-install
LDADD = ../lib/libtasn1.la ../gl/libgnu.la
+DISTCLEANFILES =
+
EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c mscat.asn \
Test_encoding.asn pkix.asn TestIndef.p12 choice.asn coding-decoding2.asn \
TestIndef2.p12 TestIndef3.der TestCertOctetOverflow.der \
@@ -52,7 +54,7 @@ EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c mscat.asn \
# For crlf.
EXTRA_DIST += crlf.cer crl.der ocsp.der
dist_check_SCRIPTS = crlf benchmark threadsafety decoding decoding-invalid-x509 \
- decoding-invalid-pkcs7 coding
+ decoding-invalid-pkcs7 coding soname
MOSTLYCLEANFILES = Test_parser_ERROR.asn
@@ -67,7 +69,7 @@ TESTS = Test_parser Test_tree Test_encoding Test_indefinite \
Test_strings Test_choice Test_encdec copynode coding-decoding2 \
strict-der Test_choice_ocsp decoding decoding-invalid-x509 \
ocsp-basic-response octet-string coding-long-oid object-id-decoding \
- spc_pe_image_data decoding-invalid-pkcs7 coding
+ spc_pe_image_data decoding-invalid-pkcs7 coding soname
TESTS_ENVIRONMENT = \
ASN1PARSER=$(srcdir)/Test_parser.asn \
@@ -89,4 +91,8 @@ TESTS_ENVIRONMENT = \
THREADSAFETY_FILES=`find $(top_srcdir)/lib -name \*.c` \
EXEEXT=$(EXEEXT) \
LSAN_OPTIONS=suppressions=libtasn1.supp \
- $(VALGRIND)
+ build_triplet="$(build_triplet)" \
+ host_triplet="$(host_triplet)" \
+ builddir="$(builddir)" \
+ top_builddir="$(top_builddir)" \
+ srcdir="$(srcdir)"
diff --git a/tests/soname b/tests/soname
new file mode 100755
index 0000000..ccc75f6
--- /dev/null
+++ b/tests/soname
@@ -0,0 +1,24 @@
+#!/bin/sh
+set -e
+
+srcdir=${srcdir:-.}
+top_builddir=${top_builddir:-.}
+build_triplet=${build_triplet:-.}
+host_triplet=${host_triplet:-.}
+
+
+if [ "${build_triplet}" != "${host_triplet}" ]; then
+ echo "cross-compiling, not running soname check." 2>&1
+ exit 77
+fi
+if ! echo "${build_triplet}" | grep linux > /dev/null ; then
+ exit 77
+fi
+if ! [ -x "$(command -v objdump)" ]; then
+ echo "objdump not available" 1>&2
+ exit 77
+fi
+
+newsoname=$(objdump -p ${top_builddir}/lib/.libs/libtasn1.so | sed -n '/^ *SONAME /s/^ *SONAME *//p')
+
+[ "${newsoname}" = "libtasn1.so.6" ]