tests: Introduce 'make check TESTS=test/name'

Currently 'make check' always runs all tests. We can run individual
tests manually, but doing so is a bit cumbersome to do under the same
environment as 'make check', since doing so means running something
like this:

    $ MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \
        ./runtests opr/fmt util/ktime

To make it easier to run single tests introduce a way of calling 'make
check' like this:

    $ make check TESTS='opr/fmt util/ktime'

Which will run the same commands as 'make check', but will run
runtests with only the specified tests, instead of running the default
list.

Some makefiles currently use a "TESTS" or "tests" variable to list
their test binaries; rename them all to "BINS" to avoid conflicting
with this new use for "TESTS" and to make our makefiles a little more
consistent.

Change-Id: I427f83be0d4571794644a97123bcd1f32427bd05
Reviewed-on: https://gerrit.openafs.org/14317
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2020-07-01 14:21:35 -05:00 committed by Benjamin Kaduk
parent 2f435309c7
commit 004c797daa
8 changed files with 30 additions and 21 deletions

View File

@ -660,7 +660,7 @@ test_build_nolibafs: finale_nolibafs_notest
cd tests && $(MAKE) all
check test: finale_notest
cd tests && $(MAKE) check
cd tests && $(MAKE) check TESTS="$(TESTS)"
force:

View File

@ -20,10 +20,19 @@ runtests: runtests.o
runtests.o: $(srcdir)/runtests.c
$(AFS_CCRULE) $(srcdir)/runtests.c
# If $(TESTS) is blank, RUNTESTS_ARGS will expand to RUNTESTS_DEFAULT_, so
# we'll run our default list of tests. If $(TESTS) is not blank,
# $(RUNTESTS_DEFAULT_$(TESTS)) will expand into nothing, so RUNTESTS_ARGS will
# just become effectively $(TESTS).
RUNTESTS_DEFAULT_=-v -l $(abs_top_srcdir)/tests/TESTS
RUNTESTS_ARGS=$(RUNTESTS_DEFAULT_$(TESTS)) $(TESTS)
# To run specific tests, run e.g. 'make check TESTS="rx/foo opr/foo"'
check test tests: runtests
@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \
./runtests -v -l $(abs_top_srcdir)/tests/TESTS
./runtests $(RUNTESTS_ARGS)
install:

View File

@ -4,11 +4,11 @@ abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
TESTS = authcon-t superuser-t keys-t realms-t writekeyfile
BINS = authcon-t superuser-t keys-t realms-t writekeyfile
MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/
all check test tests: $(TESTS)
all check test tests: $(BINS)
MODULE_LIBS = ../tap/libtap.a \
$(abs_top_builddir)/src/auth/liboafs_auth.la \
@ -53,4 +53,4 @@ superuser-t.o: test.h
clean:
$(LT_CLEAN)
rm -f *.o *.cs.c *.ss.c *.xdr.c test.h \
$(TESTS)
$(BINS)

View File

@ -13,9 +13,9 @@ LIBS = ../tap/libtap.a \
$(abs_top_builddir)/src/opr/liboafs_opr.la \
$(abs_top_builddir)/src/opr/liboafs_opr.la
tests = command-t
BINS = command-t
all check test tests: $(tests)
all check test tests: $(BINS)
command-t: command-t.o $(LIBS)
$(LT_LDRULE_static) command-t.o $(LIBS) $(LIB_roken) $(XLIBS)
@ -24,4 +24,4 @@ install:
clean distclean:
$(LT_CLEAN)
$(RM) -f $(tests) *.o core
$(RM) -f $(BINS) *.o core

View File

@ -7,10 +7,10 @@ MODULE_CFLAGS = -I$(TOP_OBJDIR)
LIBS=../tap/libtap.a $(abs_top_builddir)/src/opr/liboafs_opr.la
tests = cache-t dict-t fmt-t jhash-t queues-t rbtree-t softsig-helper time-t \
uuid-t
BINS = cache-t dict-t fmt-t jhash-t queues-t rbtree-t softsig-helper time-t \
uuid-t
all check test tests: $(tests)
all check test tests: $(BINS)
cache-t: cache-t.o
$(LT_LDRULE_static) cache-t.o $(LIBS) $(XLIBS)
@ -41,4 +41,4 @@ softsig-helper: softsig-helper.o $(LIBS)
clean distclean:
$(LT_CLEAN)
$(RM) -f $(tests) *.o core
$(RM) -f $(BINS) *.o core

View File

@ -10,9 +10,9 @@ MODULE_CFLAGS = -I$(TOP_OBJDIR)
LIBS = ../tap/libtap.a \
$(abs_top_builddir)/src/rx/liboafs_rx.la
tests = event-t
BINS = event-t
all check test tests: $(tests)
all check test tests: $(BINS)
event-t: event-t.o $(LIBS)
$(LT_LDRULE_static) event-t.o $(LIBS) $(LIB_roken) $(XLIBS)
@ -20,4 +20,4 @@ install:
clean distclean:
$(LT_CLEAN)
$(RM) -f $(tests) *.o core
$(RM) -f $(BINS) *.o core

View File

@ -11,9 +11,9 @@ LIBS = ../tap/libtap.a \
$(abs_top_builddir)/lib/util.a \
$(abs_top_builddir)/lib/libopr.a
tests = ktime-t exec-alt-t volutil-t
BINS = ktime-t exec-alt-t volutil-t
all check test tests: $(tests)
all check test tests: $(BINS)
ktime-t: ktime-t.o $(LIBS)
$(AFS_LDRULE) ktime-t.o $(LIBS) $(XLIBS)
@ -27,4 +27,4 @@ volutil-t: volutil-t.o $(LIBS)
install:
clean distclean:
$(RM) -f $(tests) *.o core
$(RM) -f $(BINS) *.o core

View File

@ -4,11 +4,11 @@ abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
TESTS = vos-t
BINS = vos-t
MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/
all check test tests: $(TESTS)
all check test tests: $(BINS)
MODULE_LIBS = ../tap/libtap.a \
$(abs_top_builddir)/src/vlserver/liboafs_vldb.la \
@ -22,4 +22,4 @@ vos-t: vos-t.o ../common/config.o ../common/servers.o ../common/ubik.o \
clean:
$(LT_CLEAN)
rm -f *.o $(TESTS)
rm -f *.o $(BINS)