]> git.draconx.ca Git - liblbx.git/commitdiff
Improve portability of testcase MD5 generation.
authorNick Bowler <nbowler@draconx.ca>
Wed, 22 Sep 2021 00:44:32 +0000 (20:44 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 22 Sep 2021 00:44:32 +0000 (20:44 -0400)
GNU md5sum is not always available, but many systems have some form of
MD5 utility available in the base install.  Use the new DX_PROG_MD5
macro to locate such a utility and adjust the test suite to use it.

This will enable the original-data testcases to run on more systems.

Makefile.am
common
configure.ac
m4/md5sum.m4 [deleted file]
tests/moo2data.at

index 8096bb90b1eba2ace0e19d1bd3b1867d7c5fb5e9..e5c0d8b0b539ee110a8a8e079f5ade49ec76dc6e 100644 (file)
@@ -81,7 +81,7 @@ atlocal: config.status
          printf ': "$${%s=%s}"\n' \
            datadir '$(datadir)' \
            LN_S '$(LN_S)' \
-           MD5SUM '$(MD5SUM)' \
+           MD5 '$(MD5)' \
            PAMARITH '$(PAMARITH)' \
            PAMCHANNEL '$(PAMCHANNEL)' \
        ; } >$@.tmp
diff --git a/common b/common
index 843799dbec995b276a7d017bb32c053747b55400..57a2e9b84fe5ec89d919373dae66bb4924926d7a 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 843799dbec995b276a7d017bb32c053747b55400
+Subproject commit 57a2e9b84fe5ec89d919373dae66bb4924926d7a
index 34b1491a666468bf34c2149142b191a6bafd7b73..5be386e07ce4d690fd64aa6274328166b7fba9b2 100644 (file)
@@ -51,10 +51,7 @@ AS_CASE([$enable_lbxgui],
 AM_CONDITIONAL([BUILD_LBXGUI], [$have_gtk])
 
 # Check for utilities used by the test suite.
-DX_PROG_MD5SUM
-AS_IF([test x"$dx_cv_md5sum_works" = x"yes"],
-  [HAVE_MD5SUM=true], [HAVE_MD5SUM=false])
-AC_SUBST([HAVE_MD5SUM])
+DX_PROG_MD5
 
 AC_CHECK_PROGS([PAMARITH], [pamarith], [false])
 AC_CHECK_PROGS([PAMCHANNEL], [pamchannel], [false])
diff --git a/m4/md5sum.m4 b/m4/md5sum.m4
deleted file mode 100644 (file)
index d3926ba..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-AC_DEFUN([DX_PROG_MD5SUM], [dnl
-AC_CHECK_PROGS([MD5SUM], [md5sum], [false])
-AC_CACHE_CHECK([whether md5sum works], [dx_cv_md5sum_works], [dnl
-       dx_cv_md5sum_works=yes
-       # Positive test
-       cat >conftest.md5 <<'EOF'
-d41d8cd98f00b204e9800998ecf8427e  /dev/null
-EOF
-       if $MD5SUM -c conftest.md5 >/dev/null 2>&1; then :; else
-               dx_cv_md5sum_works=no
-       fi
-       # Negative test
-       cat >conftest.md5 <<'EOF'
-d41d8cd98f00b204e9810998ecf8427e  /dev/null
-EOF
-       if $MD5SUM -c conftest.md5 >/dev/null 2>&1; then
-               dx_cv_md5sum_works=no
-       fi
-       rm -f conftest.md5
-])])
index 240787c10d8425b6b480d97d308708b4bfb0ca59..e47ccf4e64b13dc3326519976f4f56f6fa66e39c 100644 (file)
@@ -24,13 +24,16 @@ AT_ARG_OPTION_ARG([moo2-datadir],
 m4_divert_push([PREPARE_TESTS])dnl
 # Compute MD5 hash of standard input.
 test_md5sum () {
-  set x `md5sum </dev/null`
-  case $2 in
-  d41d8cd98f00b204e9800998ecf8427e) set x `md5sum && echo $?` ;;
-  *) return 77 ;;
-  esac
-  echo $2
-  eval "return \$$#"
+  set x `$MD5 </dev/null 2>/dev/null`
+  for md5_pos in 2 $#; do
+    AS_VAR_COPY([md5_digest], [$md5_pos])
+    case $md5_digest in
+    d41d8cd98f00b204e9800998ecf8427e)
+      set x `$MD5 && echo $?`
+      eval "echo \$$md5_pos; return \$$#"
+    esac
+  done
+  return 77
 }
 m4_divert_pop([PREPARE_TESTS])