Merge from vendor branch TNF:
[pkgsrcv2.git] / regress / buildlink-transform / Makefile
1 # $NetBSD: Makefile,v 1.15 2005/06/08 05:49:21 jlam Exp $
2 #
3 # Run many buildlink transform tests in a single regression test to avoid
4 # having to keep creating the wrapper scripts over and over again.
5 #
6 DISTNAME=       regress-buildlink-transform-0.0
7 CATEGORIES=     regress
8 MASTER_SITES=   # empty
9 DISTFILES=      # empty
10
11 MAINTAINER=     jlam@NetBSD.org
12 COMMENT=        test buildlink wrapper transformation
13
14 .include "../../mk/bsd.prefs.mk"
15
16 EXTRACT_ONLY=   # empty
17 NO_CONFIGURE=   yes
18 NO_INSTALL=     yes
19 NO_PACKAGE=     yes
20
21 # Remove GCC optimization options.
22 BUILDLINK_TRANSFORM+=   rm:-O[0-9]*
23
24 # Remove /opt/schily.
25 .if ${LOCALBASE} != "/opt/schily"
26 BUILDLINK_TRANSFORM+=   rmdir:/opt/schily
27 .endif
28
29 # Convert "-lreadline" into "-ledit -ltermcap -lm".
30 BUILDLINK_TRANSFORM+=   l:readline:edit:termcap:m
31
32 REGRESS_ENV=            PATH=${PATH}
33 .if defined(PHASES_AFTER_WRAPPER)
34 REGRESS_ENV+=           WRAPPER_DEBUG=yes
35 .endif
36
37 # Create a "regress" script in the wrapper directory that just echoes its
38 # arguments.
39 #
40 REGRESS=                ${ECHO}
41 WRAPPEES+=              REGRESS
42 _WRAP_ALIASES.REGRESS=  regress
43
44 post-wrapper:
45         @${RM} -f ${WRAPPER_BINDIR}/${REGRESS}
46
47 .PHONY: regress do-regress
48
49 regress: wrapper do-regress
50
51 FAILED_TESTS=   ${WRKDIR}/failed
52 PASSED_TESTS=   ${WRKDIR}/passed
53
54 do-regress:
55         @if [ -f ${FAILED_TESTS} ]; then                                \
56                 ${ECHO} "FAILED:";                                      \
57                 ${CAT} ${FAILED_TESTS} | while read test; do            \
58                         ${ECHO} "       $$test";                        \
59                 done;                                                   \
60                 exit 1;                                                 \
61         else                                                            \
62                 ${DO_NADA};                                             \
63         fi
64
65 report-failed:
66         @if [ -f "${FAILED_TESTS}" ]; then                              \
67                 ${ECHO} `${CAT} ${FAILED_TESTS} | ${WC} -l`;            \
68         else                                                            \
69                 ${ECHO} "0";                                            \
70         fi
71
72 report-passed:
73         @if [ -f "${PASSED_TESTS}" ]; then                              \
74                 ${ECHO} `${CAT} ${PASSED_TESTS} | ${WC} -l`;            \
75         else                                                            \
76                 ${ECHO} "0";                                            \
77         fi
78
79 TEST_RESULT=    runtest=`${SETENV} ${REGRESS_ENV} regress $$test`;      \
80                 ${ECHO} "(${.TARGET}) saw:      $$test";                \
81                 ${ECHO} "(${.TARGET}) got:      $$runtest";             \
82                 ${ECHO} "(${.TARGET}) expected: $$expected";            \
83                 case $$runtest in                                       \
84                 $$expected)                                             \
85                         ${ECHO} "(${.TARGET}) result:   PASS";          \
86                         ${ECHO} "${.TARGET}" >> ${PASSED_TESTS};        \
87                         ;;                                              \
88                 *)                                                      \
89                         ${ECHO} "(${.TARGET}) result:   FAIL";          \
90                         ${ECHO} "${.TARGET}" >> ${FAILED_TESTS};        \
91                         ;;                                              \
92                 esac
93
94 TEST_DIR=       ${.CURDIR}/tests
95
96 # If RUNTESTS is defined, then just run those tests, otherwise run them all.
97 .if defined(RUNTESTS)
98 TEST_MAKEFILES= ${RUNTESTS:S/^/${TEST_DIR}\//:S/$/.mk/}
99 .  for _mkfile_ in ${TEST_MAKEFILES}
100 .    if exists(${_mkfile_})
101 .      include "${_mkfile_}"
102 .    endif
103 .  endfor
104 .else
105 .  include "tests/include-pkgdir-slashdot.mk"
106 .  include "tests/include-pkgdir.mk"
107 .  include "tests/include-pkgsubdir.mk"
108 .  include "tests/include-usr-include-slashdot.mk"
109 .  include "tests/include-usr-include-subdir.mk"
110 .  include "tests/include-usr-include.mk"
111 .  include "tests/lib-expand.mk"
112 .  include "tests/libdir-pkgdir-slashdot.mk"
113 .  include "tests/libdir-pkgdir.mk"
114 .  include "tests/libdir-pkgsubdir.mk"
115 .  include "tests/libdir-usr-lib-slashdot.mk"
116 .  include "tests/libdir-usr-lib-subdir.mk"
117 .  include "tests/libdir-usr-lib.mk"
118 .  include "tests/libpath.mk"
119 .  include "tests/libpath-in-define.mk"
120 .  include "tests/no-abspath.mk"
121 .  include "tests/preserve-option.mk"
122 .  include "tests/quoted-arg.mk"
123 .  include "tests/remove-dir.mk"
124 .  include "tests/remove-option.mk"
125 .  include "tests/repeated-arg.mk"
126 .  include "tests/rpath-merge.mk"
127 .  include "tests/rpath-pkgdir-slashdot.mk"
128 .  include "tests/rpath-pkgdir.mk"
129 .  include "tests/rpath-pkgsubdir.mk"
130 .  include "tests/rpath-split.mk"
131 .  include "tests/rpath-usr-lib-slashdot.mk"
132 .  include "tests/rpath-usr-lib-subdir.mk"
133 .  include "tests/rpath-usr-lib.mk"
134 .  include "tests/libpath-shlib.mk"
135 .  include "tests/libpath-shmod.mk"
136 .endif
137
138 .include "../../mk/bsd.pkg.mk"