4 # Automated test suite for libc_r (pthreads).
10 CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
13 # C programs that are used internally by the tests. The build system merely
15 BTESTS := guard_b.c hello_b.c
17 # Tests written in perl.
18 PTESTS := guard_s.pl propagate_s.pl
20 # Munge the file lists to their final executable names (strip the .c).
24 CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
25 CFLAGS := -Wall -pipe -g3
31 # Flags passed to verify. "-v" or "-u" may be useful.
36 # Only use the following suffixes, in order to avoid any strange built-in rules.
38 .SUFFIXES : .c .o .d .pl
40 # Clear out all paths, then set just one (default path) for the main build
45 # Build the C programs.
46 .for bin in $(CTESTS) $(BTESTS)
47 $(bin)_a : $(bin:S/$/&.c/)
48 $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
49 $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_A) $(LIBS)
50 @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_a.o \2/g\" > $(@:R:S/$/&.d/)"
52 $(bin)_p : $(bin:S/$/&.c/)
53 $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
54 $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_P) $(LIBS)
55 @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_p.o \2/g\" > $(@:R:S/$/&.d/)"
57 $(bin)_s : $(bin:S/$/&.c/)
58 $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
59 $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_S) $(LIBS)
60 @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_s.o \2/g\" > $(@:R:S/$/&.d/)"
63 # Dependency file inclusion.
64 .for depfile in $(CTESTS:R:S/$/&_a.d/) $(BTESTS:R:S/$/&_a.d/) \
65 $(CTESTS:R:S/$/&_p.d/) $(BTESTS:R:S/$/&_p.d/) \
66 $(CTESTS:R:S/$/&_s.d/) $(BTESTS:R:S/$/&_s.d/)
67 .if exists($(depfile))
74 tests_a : $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
75 tests_p : $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
76 tests_s : $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
78 tests : tests_a tests_p tests_s
81 .for bin in $(CTESTS) $(BTESTS)
84 @echo "Test static library:"
85 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
88 .for bin in $(CTESTS) $(BTESTS)
91 @echo "Test profile library:"
92 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
95 .for bin in $(CTESTS) $(BTESTS)
98 @echo "Test shared library:"
99 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
101 check : check_a check_p check_s
110 rm -f $(CTESTS) $(BTESTS)
111 rm -f $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
112 rm -f $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
113 rm -f $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)