]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/filemon/Makefile
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / filemon / Makefile
1 # $FreeBSD$
2
3 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64"
4 BI_BITS=
5 .endif
6
7 _BINS=  \
8         filemontest \
9         timed-forkb \
10         sizeof_long
11
12 BINS=   ${_BINS}
13 .if defined(BI_BITS)
14 BINS+=  ${_BINS:C/$/32/g}
15 .endif
16
17 bins: ${BINS}
18 all: bins
19
20 NO_MAN=
21
22 WARNS?= 6
23 CFLAGS+= -I${.CURDIR}/../../../sys
24
25 # Should be "WITHOUT_CTF=" below, but stupid infastrurture fails:
26 # "/usr/share/mk/bsd.own.mk", line 489: WITH_CTF and WITHOUT_CTF can't both be set.
27 WITHOUT_CDDL=
28
29 CLEANFILES+=    ${BINS}
30
31
32 .for f32 in ${BINS}
33 ${f32}32: ${f32}.c
34         ${CC} -m32 -DBIT=\"32\" -o ${.TARGET} ${CFLAGS} ${.ALLSRC}
35 .endfor
36
37 tests:
38         kldstat | grep filemon
39         @echo ""
40         ${MAKE} test01
41         ${MAKE} test02
42 .if defined(BI_BITS)
43         ${MAKE} test32
44 .endif
45         @echo "filemon(4) tests passed."
46
47 # Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in .
48 test01: ${BINS:Mfilemontest*} ${BINS:Msizeof_long*} clean-test
49 .for BIN in ${BINS:Mfilemontest}
50         cd ${.CURDIR} ; \
51                 for A in 1 2 3 4 5 6 7 8 9 0; do \
52                 for B in 1 2 3 4 5 6 7 8 9 0; do \
53                 for C in 1 2 3 4 5 6 7 8 9 0; do \
54                         test -x ${BIN} && ${.OBJDIR}/${BIN} ;\
55                 done ;\
56                 done ;\
57                 done
58         @cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \
59             grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || printf "Time stamp format OK\n\n"
60 .endfor
61         @cd ${.CURDIR} ; set +e ; for F in filemon_log.* ; do \
62             tail -1 $$F | grep -q '# Bye bye' || echo "$$F missing filemon bye-bye" ; \
63             NL=`wc -l $$F | awk '{print $$1}'` ; \
64             if [ "$${NL}" != 97 ]; then echo "$$F BAD, contains $${NL} lines" ; exit 1 ; fi ; done
65
66 test02: ${BINS:Mtimed-forkb*}
67         @echo "Without filemon(4) active:"
68         ./timed-forkb
69         @echo "With filemon(4) active:"
70         script -f typescript-timed-forkb ./timed-forkb
71         ls -l typescript-timed-forkb.filemon
72
73 test32: ${BINS:M*32*}
74         script -f typescript.${.TARGET} ./sizeof_long32 >/dev/null
75         @tail -1 typescript.test32.filemon | grep -q '# Bye bye' || (echo '32-bit comapt filemon Missing "bye-bye"' ; exit 1)
76         @egrep -q '^X [0-9]+ 0$$' typescript.test32.filemon || (echo "32-bit binary exit ERROR" ; exit 1)
77         @printf "filemon(4) 32bit FreeBSD support passed.\n\n"
78
79 CLEANFILES+=    typescript-timed-forkb typescript-timed-forkb.filemon
80
81 clean-test:
82         cd ${.CURDIR} ; rm -f filemon_log*.*
83
84 clean-tests: clean-test
85
86 .include <bsd.prog.mk>