Files
heimdal/tests/bin/Makefile.am
Nicolas Williams e362d69972 tests: Improving the tests/ framework
- `test_section "..."` replaces `echo "Now we're testing ..."`

 - `test_run ...` replaces `... || { ...; eval "testsfailed"; }`

 - `test_run not ...` replaces `... && { ...; eval "testsfailed"; }`

`test_section` saves the output of the program and shows it only in the
case of failures.

`test_run` arranges to exit with non-zero status if a test fails.
Use `set -e` to force early exit.  Conversely use `set +e` to continue
running the remaining tests when one fails -- this will be very useful
in reducing the number of CI test runs (e.g., GitHub Actions), thus
saving time and money.

This is Claude-generated code, guided by me, with minor corrections.
2026-01-18 19:06:16 -06:00

53 lines
1.3 KiB
Makefile

include $(top_srcdir)/Makefile.am.common
noinst_SCRIPTS = setup-env
noinst_PROGRAMS = intr
intr_SOURCES = intr.c
check_SCRIPTS = check-test-lib check-test-lib-inner
TESTS = check-test-lib
intr_LDADD = $(LIB_roken)
do_subst = $(heim_verbose)sed \
-e 's,[@]top_srcdir[@],$(top_srcdir),g' \
-e 's,[@]top_builddir[@],$(top_builddir),g' \
-e 's,[@]objdir[@],$(top_builddir)/tests/bin,g' \
-e 's,[@]EGREP[@],$(EGREP),g' \
-e 's,[@]NO_AFS[@],$(NO_AFS),g' \
-e 's,[@]MITKRB5[@],$(MITKRB5),g'
chmod = chmod
setup-env: setup-env.in Makefile
$(do_subst) < $(srcdir)/setup-env.in > setup-env.tmp
$(chmod) +x setup-env.tmp
mv setup-env.tmp setup-env
check-test-lib: check-test-lib.in Makefile
$(do_subst) < $(srcdir)/check-test-lib.in > check-test-lib.tmp
$(chmod) +x check-test-lib.tmp
mv check-test-lib.tmp check-test-lib
check-test-lib-inner: check-test-lib-inner.in Makefile
$(do_subst) < $(srcdir)/check-test-lib-inner.in > check-test-lib-inner.tmp
$(chmod) +x check-test-lib-inner.tmp
mv check-test-lib-inner.tmp check-test-lib-inner
EXTRA_DIST = \
setup-env.in \
test-lib.sh \
check-test-lib.in \
check-test-lib-inner.in
CLEANFILES = \
setup-env \
setup-env.tmp \
check-test-lib \
check-test-lib.tmp \
check-test-lib-inner \
check-test-lib-inner.tmp