From ef03f4907039205d1763c092fcb2f97c37c5a720 Mon Sep 17 00:00:00 2001 From: jlam Date: Mon, 30 Aug 2004 04:44:14 +0000 Subject: Regression test for the buildlink libtool manipulations. Start with testing whether munging dependency_libs in installed libtool archives works properly. --- regress/buildlink-libtool/Makefile | 90 ++++++++++++++++++++++++++++++++ regress/buildlink-libtool/files/Makefile | 17 ++++++ regress/buildlink-libtool/files/f.c | 3 ++ 3 files changed, 110 insertions(+) create mode 100644 regress/buildlink-libtool/Makefile create mode 100644 regress/buildlink-libtool/files/Makefile create mode 100644 regress/buildlink-libtool/files/f.c (limited to 'regress') diff --git a/regress/buildlink-libtool/Makefile b/regress/buildlink-libtool/Makefile new file mode 100644 index 00000000000..865a4bd5ec3 --- /dev/null +++ b/regress/buildlink-libtool/Makefile @@ -0,0 +1,90 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/08/30 04:44:14 jlam Exp $ + +DISTNAME= regress-buildlink-libtool-0.0 +CATEGORIES= regress +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= jlam@NetBSD.org +COMMENT= test buildlink libtool + +USE_BUILDLINK3= yes +USE_LIBTOOL= yes +EXTRACT_ONLY= # empty +NO_CONFIGURE= yes +NO_INSTALL= yes +NO_PACKAGE= yes + +# Remove GCC optimization options. +BUILDLINK_TRANSFORM+= rm:-O[0-9]* + +# Convert "-lreadline" into "-ledit -ltermcap -lm". +BUILDLINK_TRANSFORM+= l:readline:edit:termcap:m + +do-extract: + ${CP} -R ${FILESDIR} ${WRKSRC} + +.PHONY: regress do-regress + +regress: build 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= ${ECHO} "(${.TARGET}) got: $$test"; \ + ${ECHO} "(${.TARGET}) expected: $$expected"; \ + case $$test in \ + $$expected) \ + ${ECHO} "(${.TARGET}) result: PASS"; \ + ${ECHO} "${.TARGET}" >> ${PASSED_TESTS}; \ + ;; \ + *) \ + ${ECHO} "(${.TARGET}) result: FAIL"; \ + ${ECHO} "${.TARGET}" >> ${FAILED_TESTS}; \ + ;; \ + esac + +# Check that the dependency_libs line of libregress1.lai is empty. +do-regress: test1 +test1: + @cd ${WRKSRC}; \ + . .libs/libregress1.lai; \ + test="$$dependency_libs"; \ + expected=""; \ + ${TEST_RESULT} + +# Check that the dependency_libs line of libregress2.lai is empty. +do-regress: test2 +test2: + @cd ${WRKSRC}; \ + . .libs/libregress2.lai; \ + test="$$dependency_libs"; \ + expected="-L${PREFIX}/lib -lregress1"; \ + ${TEST_RESULT} + +.include "../../mk/bsd.pkg.mk" diff --git a/regress/buildlink-libtool/files/Makefile b/regress/buildlink-libtool/files/Makefile new file mode 100644 index 00000000000..bbc52675f1a --- /dev/null +++ b/regress/buildlink-libtool/files/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/08/30 04:44:14 jlam Exp $ + +.PHONY: all +all: libregress1.la libregress2.la + +.SUFFIXES: .lo + +.c.lo: + ${LIBTOOL} --mode=compile ${CC} -c $< + +libregress1.la: f.lo + ${LIBTOOL} --mode=link ${CC} -o $@ $> \ + -rpath ${PREFIX}/lib -version-info 0:0 + +libregress2.la: libregress1.la f.lo + ${LIBTOOL} --mode=link ${CC} -o $@ $> libregress1.la \ + -rpath ${PREFIX}/lib -version-info 0:0 diff --git a/regress/buildlink-libtool/files/f.c b/regress/buildlink-libtool/files/f.c new file mode 100644 index 00000000000..710e9820073 --- /dev/null +++ b/regress/buildlink-libtool/files/f.c @@ -0,0 +1,3 @@ +/* $NetBSD: f.c,v 1.1.1.1 2004/08/30 04:44:14 jlam Exp $ */ + +int f() { return 0; } -- cgit v1.2.3