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