From 75fc1240d8975c8513eadd6b9ccb7c6d7be618b0 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Tue, 21 Sep 2021 20:44:32 -0400 Subject: [PATCH] Improve portability of testcase MD5 generation. 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 | 2 +- common | 2 +- configure.ac | 5 +---- m4/md5sum.m4 | 20 -------------------- tests/moo2data.at | 17 ++++++++++------- 5 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 m4/md5sum.m4 diff --git a/Makefile.am b/Makefile.am index 8096bb9..e5c0d8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 843799d..57a2e9b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 843799dbec995b276a7d017bb32c053747b55400 +Subproject commit 57a2e9b84fe5ec89d919373dae66bb4924926d7a diff --git a/configure.ac b/configure.ac index 34b1491..5be386e 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index d3926ba..0000000 --- a/m4/md5sum.m4 +++ /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 -])]) diff --git a/tests/moo2data.at b/tests/moo2data.at index 240787c..e47ccf4 100644 --- a/tests/moo2data.at +++ b/tests/moo2data.at @@ -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` + 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]) -- 2.43.2