5 topbuilddir:=$(shell cd .. && pwd)
10 TARGETS=udp-preload.so check
12 TESTSCRIPTS ?= $(shell echo $(srcdir)/t-*[0-9a-z])
13 TESTNAMES := $(patsubst t-%,%,$(notdir $(TESTSCRIPTS)))
17 CFLAGS += -D_REENTRANT -fPIC
19 udp-preload.so: udp-preload.o
20 $(CC) -shared -Wl,-soname,$@.1 $^ -o $@ -ldl
22 # These test scripts use little cpu but contain sleeps etc. So when
23 # there are several, we are going to want to run *loads* in parallel.
25 # Ideally we would do something like "every one of these counts for a
26 # tenth of a job" but make can't do that. So bodge it: we treat all the
27 # tests as a single job, and disconnect the parent's jobserver.
29 # make.info says $(MAKE) causes special handling of the rule but only
30 # if it's written literally like that in the rule, hence this
31 # indirection. We need no squash MAKEFLAGS and MFLAGS too.
32 # MAKELEVEL seems like it will be fine to pass on.
34 MAKE_NOTSPECIAL:=$(MAKE)
37 env -u MAKEFLAGS -u MFLAGS \
38 $(MAKE_NOTSPECIAL) -j$(shell nproc || 1)0 check-real
40 check-real: $(foreach t,$(TESTNAMES),d-$t/ok)
42 d-%/ok: $(srcdir)/t-% udp-preload.so $(srcdir)/common.tcl \
43 ../secnet ../test-example/sites.conf
44 @rm -rf d-$*; mkdir d-$*
45 export STEST_BUILDDIR=$(topbuilddir); \
46 cd $(topdir) && stest/t-$* >$(topbuilddir)/stest/d-$*/log 2>&1