]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Add 'atf-sh' detection to configure 19/head
authorMichael Jeanson <mjeanson@debian.org>
Thu, 15 Feb 2024 18:50:31 +0000 (13:50 -0500)
committerMichael Jeanson <mjeanson@debian.org>
Fri, 1 Mar 2024 19:55:07 +0000 (14:55 -0500)
The configure script now checks for the 'atf-sh' binary when the test
suite is enabled. The binary found is then used in the test script
shebang. As an added bonus, the test script generation is now done by
AC_CONFIG_FILES instead of the Makefile copy custom rules.

Signed-off-by: Michael Jeanson <mjeanson@debian.org>
Makefile.am
configure.ac
tests/functional-tests.in [moved from tests/functional-tests.sh with 98% similarity]
tests/mlmmj-bounce.in [moved from tests/mlmmj-bounce.sh with 99% similarity]
tests/mlmmj-list.in [moved from tests/mlmmj-list.sh with 99% similarity, mode: 0644]
tests/mlmmj-maintd.in [moved from tests/mlmmj-maintd.sh with 99% similarity, mode: 0644]
tests/mlmmj-process.in [moved from tests/mlmmj-process.sh with 98% similarity]
tests/mlmmj-receive.in [moved from tests/mlmmj-receive.sh with 97% similarity, mode: 0644]
tests/mlmmj-send.in [moved from tests/mlmmj-send.sh with 98% similarity]
tests/mlmmj-sub.in [moved from tests/mlmmj-sub.sh with 98% similarity, mode: 0644]

index 3d0c917d4f57182c9c24c1f0e1d2c15d2c30cc32..91673afd96dcf68a39dba96e426a4c10f9b2313e 100644 (file)
@@ -35,32 +35,18 @@ tests_mlmmj_LDADD = \
 tests_fakesmtpd_SOURCES = \
        tests/fakesmtpd.c
 
-EXTRA_DIST += \
-       tests/*.sh
-
-CLEANFILES += \
-       $(test_scripts:.sh=)
-
 test_scripts = \
-       tests/mlmmj-send.sh \
-       tests/functional-tests.sh \
-       tests/mlmmj-maintd.sh \
-       tests/mlmmj-sub.sh \
-       tests/mlmmj-bounce.sh \
-       tests/mlmmj-list.sh \
-       tests/mlmmj-process.sh \
-       tests/mlmmj-receive.sh
-
-check_SCRIPTS = \
-       $(test_scripts:.sh=)
-
-# Copy the test scripts striped of the '.sh' extension in the build directory
-SUFFIXES = .sh
-.sh:
-       install -m 755 $< $@
+       tests/mlmmj-send \
+       tests/functional-tests \
+       tests/mlmmj-maintd \
+       tests/mlmmj-sub \
+       tests/mlmmj-bounce \
+       tests/mlmmj-list \
+       tests/mlmmj-process \
+       tests/mlmmj-receive
 
 # Run the Kyua test suite when the 'check' target is invoked
-check-local: $(check_SCRIPTS) $(check_PROGRAMS)
+check-local: $(check_PROGRAMS) $(test_scripts)
        failed=no; \
        $(KYUA) --config='$(top_builddir)/kyua.conf' test \
            --kyuafile='$(top_srcdir)/Kyuafile' --build-root='$(top_builddir)' \
@@ -72,6 +58,6 @@ check-local: $(check_SCRIPTS) $(check_PROGRAMS)
        fi
 
 # Build the test programs when the 'all' target is invoked
-all-local: $(check_PROGRAMS) $(check_SCRIPTS)
+all-local: $(check_PROGRAMS)
 endif
 
index e2b8ee0ff7fd68840be480c1a7042bb9e1782a27..b066d8f636d929c463bd6dd87c7bdda6e92281e2 100644 (file)
@@ -79,11 +79,16 @@ AC_CHECK_FUNCS([arc4random_uniform copy_file_range])
 
 AS_IF([test x"$enable_tests" = xyes], [
   PKG_CHECK_MODULES([ATF], [atf-c])
+  AC_PATH_PROG([ATFSH], [atf-sh])
   AC_PATH_PROG([KYUA], [kyua])
 
   AS_IF([test "x$KYUA" == "x"], [
     AC_MSG_ERROR([A 'kyua' binary is required when the tests are enabled. Set the PATH or use the KYUA environment variable to specify its location.])
   ])
+
+  AS_IF([test "x$ATFSH" == "x"], [
+    AC_MSG_ERROR([An 'atf-sh' binary is required when the tests are enabled. Set the PATH or use the ATFSH environment variable to specify its location.])
+  ])
 ])
 AM_CONDITIONAL([WANT_TESTS], [test x"$enable_tests" = xyes])
 
@@ -104,4 +109,13 @@ AC_CONFIG_FILES([listtexts/Makefile])
 AC_CONFIG_FILES([contrib/Makefile])
 AC_CONFIG_FILES([contrib/receivestrip/Makefile])
 AC_CONFIG_FILES([tests/test_env.sh])
+AC_CONFIG_FILES([tests/functional-tests],[chmod +x tests/functional-tests])
+AC_CONFIG_FILES([tests/mlmmj-bounce],[chmod +x tests/mlmmj-bounce])
+AC_CONFIG_FILES([tests/mlmmj-list],[chmod +x tests/mlmmj-list])
+AC_CONFIG_FILES([tests/mlmmj-maintd],[chmod +x tests/mlmmj-maintd])
+AC_CONFIG_FILES([tests/mlmmj-process],[chmod +x tests/mlmmj-process])
+AC_CONFIG_FILES([tests/mlmmj-receive],[chmod +x tests/mlmmj-receive])
+AC_CONFIG_FILES([tests/mlmmj-send],[chmod +x tests/mlmmj-send])
+AC_CONFIG_FILES([tests/mlmmj-sub],[chmod +x tests/mlmmj-sub])
+
 AC_OUTPUT
similarity index 98%
rename from tests/functional-tests.sh
rename to tests/functional-tests.in
index 787a4d0f01e5885ef32a2fe320c0667fa9b41864..a655259eb21cd7eb753677bdf7d6840fb754afda 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
similarity index 99%
rename from tests/mlmmj-bounce.sh
rename to tests/mlmmj-bounce.in
index a449200763f1e83c94c653afce9c3a5340e4110f..73776e006f936f40ad1d80ca98b1d5076705f85e 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 99%
rename from tests/mlmmj-list.sh
rename to tests/mlmmj-list.in
index cb83bf3..3b75a19
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 99%
rename from tests/mlmmj-maintd.sh
rename to tests/mlmmj-maintd.in
index b355212..34152bc
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
similarity index 98%
rename from tests/mlmmj-process.sh
rename to tests/mlmmj-process.in
index d7320b656b8fe96c45dc7e7945d4789a61095fdd..1741cd3dede430f2be8bf8bc5a0b79daf603cab3 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 97%
rename from tests/mlmmj-receive.sh
rename to tests/mlmmj-receive.in
index a4cce29..5d824f9
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
similarity index 98%
rename from tests/mlmmj-send.sh
rename to tests/mlmmj-send.in
index 8623bbc95f508550459ec38f7d02924dc7cf4261..e92f2ae60e8f0429619b78323bba9539b858bd78 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh
 
old mode 100755 (executable)
new mode 100644 (file)
similarity index 98%
rename from tests/mlmmj-sub.sh
rename to tests/mlmmj-sub.in
index 3df33b5..b2dfe13
@@ -1,4 +1,4 @@
-#!/usr/bin/env atf-sh
+#!@ATFSH@
 
 . $(atf_get_srcdir)/test_env.sh