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