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