summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2018-09-04 09:34:56 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2018-09-04 09:34:56 +0900
commit129e75fabd4a97832296ad2677de79bc61fb1ce0 (patch)
tree329ebaae606ddef32a60ba31007f2245d1ebd085
parenta2cb8c2451d9df5bded10d767eec263cd2739e0a (diff)
downloadlibgpg-error-129e75fabd4a97832296ad2677de79bc61fb1ce0.tar.gz
Extend gpg-error-config-test.sh to test against pkg-config.
-rw-r--r--src/Makefile.am12
-rwxr-xr-xsrc/gpg-error-config-test.sh77
2 files changed, 67 insertions, 22 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 69cc487..81be641 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,6 +102,7 @@ EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \
gpg-error.m4 gpgrt.m4 \
gpg-error.vers gpg-error.def.in \
versioninfo.rc.in gpg-error.w32-manifest.in \
+ gpg-error-config-test.sh \
$(lock_obj_pub)
BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
@@ -114,7 +115,11 @@ CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
gpg-error.h gpgrt.h gpgrt-config \
mkerrcodes$(EXEEXT_FOR_BUILD) mkerrcodes.h gpg-error.def mkw32errmap.tab.h \
mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h \
- gpg-extra/errno.h mkheader$(EXEEXT_FOR_BUILD) $(tmp_files) lock-obj-pub.native.h
+ gpg-extra/errno.h mkheader$(EXEEXT_FOR_BUILD) \
+ gpg-error-config-test.log \
+ $(tmp_files) lock-obj-pub.native.h
+
+TESTS = gpg-error-config-test.sh
#
# {{{ Begin Windows part
@@ -331,10 +336,11 @@ gpgrt-config: gpg-error-config
cp gpg-error-config gpgrt-config
gpg-error-config: gpg-error-config-new gpg-error-config-old
- if $(srcdir)/gpg-error-config-test.sh; then \
+ @echo "Confirm gpg-error-config works"
+ @if $(srcdir)/gpg-error-config-test.sh --old-new; then \
cp gpg-error-config-new $@; \
else \
- echo "New gpg-error-config doesn't work on this machine, please report to <https://bugs.gnupg.org>" \
+ echo "*** New gpg-error-config doesn't work on this machine, please report to <https://bugs.gnupg.org>"; \
cp gpg-error-config-old $@; \
fi
diff --git a/src/gpg-error-config-test.sh b/src/gpg-error-config-test.sh
index 9d8c2ce..a9a6b8d 100755
--- a/src/gpg-error-config-test.sh
+++ b/src/gpg-error-config-test.sh
@@ -4,32 +4,71 @@ PKG_CONFIG_PATH="."
export PKG_CONFIG_PATH
-OUTPUT_OLD=$(./gpg-error-config-old --version)
-OUTPUT_NEW=$(./gpg-error-config-new --version)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+if [ "$1" = --old-new ]; then
+ PKG_CONFIG_CMD=./gpg-error-config-old
+else
+ PKG_CONFIG_CMD="pkg-config gpg-error"
+ if ! $PKG_CONFIG_CMD --exists >/dev/null; then
+ exit 77 # Skip tests
+ fi
+fi
-OUTPUT_OLD=$(./gpg-error-config-old --libs)
+test_failed=""
+
+failure () {
+ (
+ echo "Test result: $*"
+ echo "====================: $PKG_CONFIG_CMD"
+ echo "$OUTPUT_OLD"
+ echo "====================: gpg-error-config-new"
+ echo "$OUTPUT_NEW"
+ echo "===================="
+ ) >> gpg-error-config-test.log
+ test_failed=yes
+}
+
+rm -f gpg-error-config-test.log
+
+OUTPUT_OLD=$($PKG_CONFIG_CMD --libs)
OUTPUT_NEW=$(./gpg-error-config-new --libs)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --libs
-OUTPUT_OLD=$(./gpg-error-config-old --cflags)
+OUTPUT_OLD=$($PKG_CONFIG_CMD --cflags)
OUTPUT_NEW=$(./gpg-error-config-new --cflags)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags
-OUTPUT_OLD=$(./gpg-error-config-old --mt --libs)
-OUTPUT_NEW=$(./gpg-error-config-new --mt --libs)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+OUTPUT_OLD=$($PKG_CONFIG_CMD --cflags --libs)
+OUTPUT_NEW=$(./gpg-error-config-new --cflags --libs)
+[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags --libs
-OUTPUT_OLD=$(./gpg-error-config-old --mt --cflags)
-OUTPUT_NEW=$(./gpg-error-config-new --mt --cflags)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+if [ "$PKG_CONFIG_CMD" = ./gpg-error-config-old ]; then
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --version)
+ OUTPUT_NEW=$(./gpg-error-config-new --version)
+ [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --version
-OUTPUT_OLD=$(./gpg-error-config-old --cflags --libs)
-OUTPUT_NEW=$(./gpg-error-config-new --cflags --libs)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --mt --libs)
+ OUTPUT_NEW=$(./gpg-error-config-new --mt --libs)
+ [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --libs
+
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --mt --cflags)
+ OUTPUT_NEW=$(./gpg-error-config-new --mt --cflags)
+ [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --cflags
+
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --cflags --libs)
+ OUTPUT_NEW=$(./gpg-error-config-new --cflags --libs)
+ [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags --libs
+
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --mt --cflags --libs)
+ OUTPUT_NEW=$(./gpg-error-config-new --mt --cflags --libs)
+ [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --cflags --libs
+fi
+
+if [ -n "$test_failed" ]; then
+ OUTPUT_OLD=$($PKG_CONFIG_CMD --version)
+ OUTPUT_NEW=$(./gpg-error-config-new --version)
+ failure --version
-OUTPUT_OLD=$(./gpg-error-config-old --mt --cflags --libs)
-OUTPUT_NEW=$(./gpg-error-config-new --mt --cflags --libs)
-[ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || exit 99
+ exit 99
+fi
exit 0