summaryrefslogtreecommitdiff
path: root/regress/buildlink-transform/Makefile
blob: eccd33fae8ca3ce1ee4e132e346ef68856321a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# $NetBSD: Makefile,v 1.22 2020/05/09 22:42:37 rillig Exp $
#
# Run many buildlink transform tests in a single regression test to avoid
# having to keep creating the wrapper scripts over and over again.
#
DISTNAME=	regress-buildlink-transform-0.0
CATEGORIES=	regress
MASTER_SITES=	# empty
DISTFILES=	# empty

MAINTAINER=	pkgsrc-users@NetBSD.org
COMMENT=	test buildlink wrapper transformation

USE_CWRAPPERS=	no

.include "../../mk/bsd.prefs.mk"

NO_CONFIGURE=	yes
NO_BUILD=	yes
NO_INSTALL=	yes

# Remove GCC optimization options.
BUILDLINK_TRANSFORM+=	rm:-O[0-9]*

# Remove /opt/schily.
.if ${LOCALBASE} != "/opt/schily"
BUILDLINK_TRANSFORM+=	rmdir:/opt/schily
.endif

# Convert "-lreadline" into "-ledit -ltermcap -lm".
BUILDLINK_TRANSFORM+=	l:readline:edit:termcap:m

REGRESS_ENV=		PATH=${PATH}
REGRESS_ENV+=		WRAPPER_DEBUG=yes

# Create a "regress" script in the wrapper directory that just echoes its
# arguments.
#
REGRESS=		${ECHO}
WRAPPEES+=		REGRESS
_WRAP_ALIASES.REGRESS=	regress

post-wrapper:
	@${RM} -f ${WRAPPER_BINDIR}/${REGRESS}

.PHONY: regress do-regress

regress: wrapper do-regress

FAILED_TESTS=	${WRKDIR}/failed
PASSED_TESTS=	${WRKDIR}/passed

do-regress:
	@if [ -f ${FAILED_TESTS} ]; then				\
		${ECHO} "FAILED:";					\
		${CAT} ${FAILED_TESTS} | while read test; do		\
			${ECHO} "	$$test";			\
		done;							\
		exit 1;							\
	else								\
		${DO_NADA};						\
	fi

report-failed:
	@if [ -f "${FAILED_TESTS}" ]; then				\
		${ECHO} `${CAT} ${FAILED_TESTS} | ${WC} -l`;		\
	else								\
		${ECHO} "0";						\
	fi

report-passed:
	@if [ -f "${PASSED_TESTS}" ]; then				\
		${ECHO} `${CAT} ${PASSED_TESTS} | ${WC} -l`;		\
	else								\
		${ECHO} "0";						\
	fi

TEST_RESULT=	runtest=`${SETENV} ${REGRESS_ENV} regress $$test`;	\
		${ECHO} "(${.TARGET}) saw:      $$test";		\
		${ECHO} "(${.TARGET}) got:      $$runtest";		\
		${ECHO} "(${.TARGET}) expected: $$expected";		\
		case $$runtest in					\
		$$expected)						\
			${ECHO} "(${.TARGET}) result:   PASS";		\
			${ECHO} "${.TARGET}" >> ${PASSED_TESTS};	\
			;;						\
		*)							\
			${ECHO} "(${.TARGET}) result:   FAIL";		\
			${ECHO} "${.TARGET}" >> ${FAILED_TESTS};	\
			;;						\
		esac

TEST_DIR=	${.CURDIR}/tests

# If RUNTESTS is defined, then just run those tests, otherwise run them all.
.if defined(RUNTESTS)
.  for mkfile in ${RUNTESTS:@test@ ${TEST_DIR}/${test}.mk @}
.    include "${mkfile}"
.  endfor
.else
.  include "tests/include-pkgdir-slashdot.mk"
.  include "tests/include-pkgdir.mk"
.  include "tests/include-pkgsubdir.mk"
.  include "tests/include-usr-include-slashdot.mk"
.  include "tests/include-usr-include-subdir.mk"
.  include "tests/include-usr-include.mk"
.  include "tests/lib-expand.mk"
.  include "tests/libdir-pkgdir-slashdot.mk"
.  include "tests/libdir-pkgdir.mk"
.  include "tests/libdir-pkgsubdir.mk"
.  include "tests/libdir-usr-lib-slashdot.mk"
.  include "tests/libdir-usr-lib-subdir.mk"
.  include "tests/libdir-usr-lib.mk"
.  include "tests/libpath.mk"
.  include "tests/libpath-in-define.mk"
.  include "tests/no-abspath.mk"
.  include "tests/preserve-option.mk"
.  include "tests/quoted-arg.mk"
.  include "tests/remove-dir.mk"
.  include "tests/remove-option.mk"
.  include "tests/repeated-arg.mk"
.  include "tests/rpath-merge.mk"
.  include "tests/rpath-pkgdir-slashdot.mk"
.  include "tests/rpath-pkgdir.mk"
.  include "tests/rpath-pkgsubdir.mk"
.  include "tests/rpath-split.mk"
.  include "tests/rpath-usr-lib-slashdot.mk"
.  include "tests/rpath-usr-lib-subdir.mk"
.  include "tests/rpath-usr-lib.mk"
.  include "tests/libpath-shlib.mk"
.  include "tests/libpath-shmod.mk"
.endif

.include "../../mk/bsd.pkg.mk"