2010-05-28 17:35:28 +01:00
|
|
|
# Build rules for the OpenAFS test suite.
|
|
|
|
|
2012-05-07 21:52:16 +01:00
|
|
|
srcdir=@srcdir@/../src/external/c-tap-harness/tests
|
2010-05-28 17:35:28 +01:00
|
|
|
abs_top_srcdir=@abs_top_srcdir@
|
|
|
|
abs_top_builddir=@abs_top_builddir@
|
|
|
|
include @TOP_OBJDIR@/src/config/Makefile.config
|
Unix: Rework build system
Rework the unix build system so that we support taking CFLAGS and
LDFLAGS from the command line, and don't replace them with our own
settings. Also, take the opportunity to bring some sanity and
consistency into our Makefiles.
The standard Makefile.config now defines rules for LWP, pthreaded
and shared library builds. The CFLAGS settings for these are
called LWP_CFLAGS, PTH_CFLAGS and SHD_CFLAGS, respectively.
Similarly named variables are provided for LDFLAGS.
A module may select to use a particular build type for its suffix
rule by including either Makefile.lwp, Makefile.pthread or
Makefile.shared from src/config. This creates an appropriate .c.o
suffix rule, defines AFS_CFLAGS and AFS_LDFLAGS as appropriate, and
creates two rules AFS_CCRULE and AFS_LDRULE, which can be used to
build, and link objects. For example:
foo.o: foo.c
$(AFS_CCRULE) foo.c
foo: foo.o
$(AFS_LDRULE) foo.o
If a you wish to override the CFLAGS or LDFLAGS for an object build
using these rules (or through the .c.o suffix rule) you can do so,
by defining CFLAGS_<object> or LDFLAGS_<object>. For example:
CFLAGS_foo.o= -DDEBUG
LDFLAGS_foo = -ldebugging
A module may also alter the behaviour of the compile and link steps
module wide by defining MODULE_CFLAGS or MODULE_LDFLAGS.
This functionality is now used throughout the tree:
*) Suffix rules are used wherever possible, removing a number of
unecessary build rules.
*) All link steps are replaced with AFS_LDRULE
*) All standard compile steps are replaced with AFS_CCRULE
*) Unusal compile steps are defined, as far as possible, int
terms of the LWP_ PTH_ and SHD_ variables.
*) The use of $? has been removed entirely, as it makes it
impossible to provide build rules with dependency information
Change-Id: If76207e45da402a0ed9d7c1bdbe83c58c911a4f2
Reviewed-on: http://gerrit.openafs.org/2896
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2010-10-04 13:49:16 +01:00
|
|
|
include @TOP_OBJDIR@/src/config/Makefile.pthread
|
2010-05-28 17:35:28 +01:00
|
|
|
|
2020-08-04 15:34:07 +01:00
|
|
|
MODULE_CFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
|
|
|
|
-DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
|
2010-05-28 17:35:28 +01:00
|
|
|
|
2011-10-23 21:21:39 +01:00
|
|
|
SUBDIRS = tap common auth util cmd volser opr rx
|
2011-04-23 16:42:54 +01:00
|
|
|
|
2010-05-28 17:35:28 +01:00
|
|
|
all: runtests
|
2011-04-23 16:42:54 +01:00
|
|
|
@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
|
2010-05-28 17:35:28 +01:00
|
|
|
|
|
|
|
runtests: runtests.o
|
Unix: Rework build system
Rework the unix build system so that we support taking CFLAGS and
LDFLAGS from the command line, and don't replace them with our own
settings. Also, take the opportunity to bring some sanity and
consistency into our Makefiles.
The standard Makefile.config now defines rules for LWP, pthreaded
and shared library builds. The CFLAGS settings for these are
called LWP_CFLAGS, PTH_CFLAGS and SHD_CFLAGS, respectively.
Similarly named variables are provided for LDFLAGS.
A module may select to use a particular build type for its suffix
rule by including either Makefile.lwp, Makefile.pthread or
Makefile.shared from src/config. This creates an appropriate .c.o
suffix rule, defines AFS_CFLAGS and AFS_LDFLAGS as appropriate, and
creates two rules AFS_CCRULE and AFS_LDRULE, which can be used to
build, and link objects. For example:
foo.o: foo.c
$(AFS_CCRULE) foo.c
foo: foo.o
$(AFS_LDRULE) foo.o
If a you wish to override the CFLAGS or LDFLAGS for an object build
using these rules (or through the .c.o suffix rule) you can do so,
by defining CFLAGS_<object> or LDFLAGS_<object>. For example:
CFLAGS_foo.o= -DDEBUG
LDFLAGS_foo = -ldebugging
A module may also alter the behaviour of the compile and link steps
module wide by defining MODULE_CFLAGS or MODULE_LDFLAGS.
This functionality is now used throughout the tree:
*) Suffix rules are used wherever possible, removing a number of
unecessary build rules.
*) All link steps are replaced with AFS_LDRULE
*) All standard compile steps are replaced with AFS_CCRULE
*) Unusal compile steps are defined, as far as possible, int
terms of the LWP_ PTH_ and SHD_ variables.
*) The use of $? has been removed entirely, as it makes it
impossible to provide build rules with dependency information
Change-Id: If76207e45da402a0ed9d7c1bdbe83c58c911a4f2
Reviewed-on: http://gerrit.openafs.org/2896
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2010-10-04 13:49:16 +01:00
|
|
|
$(AFS_LDRULE) runtests.o
|
2010-05-28 17:35:28 +01:00
|
|
|
|
2012-05-07 21:52:16 +01:00
|
|
|
runtests.o: $(srcdir)/runtests.c
|
|
|
|
$(AFS_CCRULE) $(srcdir)/runtests.c
|
|
|
|
|
2020-12-28 18:22:38 +00:00
|
|
|
RUNTESTS_V0_DEFAULT=-l $(abs_top_srcdir)/tests/TESTS
|
|
|
|
RUNTESTS_V1_DEFAULT=-v -l $(abs_top_srcdir)/tests/TESTS
|
2020-07-01 20:21:35 +01:00
|
|
|
|
|
|
|
# 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).
|
2020-12-28 18:22:38 +00:00
|
|
|
RUNTESTS_DEFAULT_=$(RUNTESTS_V$(V)_DEFAULT)
|
2020-07-01 20:21:35 +01:00
|
|
|
RUNTESTS_ARGS=$(RUNTESTS_DEFAULT_$(TESTS)) $(TESTS)
|
|
|
|
|
|
|
|
# To run specific tests, run e.g. 'make check TESTS="rx/foo opr/foo"'
|
2021-06-07 22:44:38 +01:00
|
|
|
check test tests: all runtests
|
tests: Fix most tests for objdir builds
Fix a few miscellaneous issues with building and running our tests in
objdir builds:
- Our C tests use -I$(srcdir)/../.. in the CFLAGS, so we can #include
<tests/tap/basic.h>. However, basic.h actually gets copied from
src/external/c-tap-harness/tests/tap/ to tests/tap/ during the
build, and so basic.h is available in the objdir, not srcdir. For
objdir builds, this causes building the tests to fail with failing
to find basic.h. Fix this to use TOP_OBJDIR as the include path
instead.
- Our 'make check' in tests/ tries to run ./libwrap; but our cwd will
be in the objdir for objdir builds, and libwrap is a script in our
srcdir. Fix this to run libwrap from the srcdir path.
- In tests/opr/softsig-t, it tries to find the 'softsig-helper' binary
in the same dir as 'softsig-t'. However, softsig-t is just a script
in the srcdir, but softsig-helper is a binary built in the objdir.
Fix this to use the BUILD env var provided by the tests wrapper, by
default.
Change-Id: Iff642613bfc88d0d7e348660dc62f59e6fa8af75
Reviewed-on: https://gerrit.openafs.org/13939
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2019-11-12 02:34:07 +00:00
|
|
|
MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \
|
2020-07-01 20:21:35 +01:00
|
|
|
./runtests $(RUNTESTS_ARGS)
|
2010-05-28 17:35:28 +01:00
|
|
|
|
2024-04-04 20:51:07 +01:00
|
|
|
# To start an interactive subshell with the environment required to run
|
|
|
|
# the test programs, run 'make shell'. Run 'exit' to end the subshell.
|
|
|
|
#
|
|
|
|
# Example usage:
|
|
|
|
#
|
|
|
|
# $ make shell
|
|
|
|
# Starting a shell to run tests. Run 'exit' when done.
|
|
|
|
# $ PS1="(tests) $PS1" # Optionally set the PS1 in the subshell.
|
|
|
|
# (tests) $ rx/perf-t # Run tests directly or via a debugger.
|
|
|
|
# ...
|
|
|
|
# (tests) $ exit # Exit when done.
|
|
|
|
#
|
|
|
|
shell: all runtests
|
|
|
|
@if [ "x$$MAKECHECK" = "x1" ]; then \
|
|
|
|
echo "Already in the tests subshell."; \
|
|
|
|
else \
|
|
|
|
echo "Starting a shell to run tests. Run 'exit' when done."; \
|
|
|
|
MAKECHECK=1 \
|
|
|
|
C_TAP_SOURCE=@abs_top_srcdir@/tests \
|
|
|
|
C_TAP_BUILD=@abs_top_builddir@/tests \
|
|
|
|
SOURCE=@abs_top_srcdir@/tests \
|
|
|
|
BUILD=@abs_top_builddir@/tests \
|
|
|
|
@abs_top_srcdir@/tests/libwrap @TOP_OBJDIR@/lib $(SHELL); \
|
|
|
|
fi
|
|
|
|
|
2010-05-28 17:35:28 +01:00
|
|
|
install:
|
|
|
|
|
|
|
|
clean distclean:
|
2011-04-23 16:42:54 +01:00
|
|
|
@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
|
2010-05-28 17:35:28 +01:00
|
|
|
$(RM) -f *.o core runtests
|