pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/buildlink-unwrap Regression test for whether *...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/43f3f729c0f9
branches:  trunk
changeset: 480021:43f3f729c0f9
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sat Aug 28 06:17:21 2004 +0000

description:
Regression test for whether *-config scripts and other similar files are
correctly unwrapped (unbuildinkified).

diffstat:

 regress/buildlink-unwrap/Makefile               |  76 +++++++++++++++++++++++++
 regress/buildlink-unwrap/spec                   |  12 +++
 regress/buildlink-unwrap/tests/unwrap-config.mk |  22 +++++++
 regress/buildlink-unwrap/tests/unwrap-config.sh |  29 +++++++++
 4 files changed, 139 insertions(+), 0 deletions(-)

diffs (155 lines):

diff -r 0c02408cb0db -r 43f3f729c0f9 regress/buildlink-unwrap/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/buildlink-unwrap/Makefile Sat Aug 28 06:17:21 2004 +0000
@@ -0,0 +1,76 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/08/28 06:17:21 jlam Exp $
+
+DISTNAME=      regress-buildlink-unwrap-0.0
+CATEGORIES=    regress
+MASTER_SITES=  # empty
+DISTFILES=     # empty
+
+MAINTAINER=    jlam%NetBSD.org@localhost
+COMMENT=       test buildlink unwrapping of text files
+
+.include "../../mk/bsd.prefs.mk"
+
+USE_BUILDLINK3=        yes
+EXTRACT_ONLY=  # empty
+WRKSRC=                ${WRKDIR}
+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
+
+REGRESS_UNWRAP_SED=                                                    \
+       -e "s|@PREFIX@|${PREFIX}|g"                                     \
+       -e "s|@COMPILER_RPATH_FLAG@|${COMPILER_RPATH_FLAG}|g"
+
+do-build:
+       @${FIND} ${TEST_DIR} -name "*.sh" -print |                      \
+       while read file; do                                             \
+               dest=`${BASENAME} $$file .sh`;                          \
+               ${SED} ${REGRESS_UNWRAP_SED} $$file > ${WRKSRC}/$$dest; \
+               ${CHMOD} +x ${WRKSRC}/$$dest;                           \
+       done
+
+.PHONY: regress do-regress
+
+regress: build do-regress
+
+do-regress:
+       @${DO_NADA}
+
+TEST_RESULT=   PATH="${WRKSRC}:${PATH}";                               \
+               runtest=`$$test`;                                       \
+               ${ECHO} "(${.TARGET}) ran:      $$test";                \
+               ${ECHO} "(${.TARGET}) got:      $$runtest";             \
+               ${ECHO} "(${.TARGET}) expected: $$expected";            \
+               case $$runtest in                                       \
+               $$expected)                                             \
+                       ${ECHO} "(${.TARGET}) result:   PASS";          \
+                       ;;                                              \
+               *)                                                      \
+                       ${ECHO} "(${.TARGET}) result:   FAIL";          \
+                       exit 1;                                         \
+                       ;;                                              \
+               esac
+
+TEST_DIR=      ${.CURDIR}/tests
+
+# If RUNTESTS is defined, then just run those tests, otherwise run them all.
+.if defined(RUNTESTS)
+TEST_MAKEFILES=        ${RUNTESTS:S/^/${TEST_DIR}\//:S/$/.mk/}
+.else
+TEST_MAKEFILES!= \
+       ${FIND} ${TEST_DIR} -name "*.mk" -print || ${ECHO} "none"
+.endif
+
+.for _mkfile_ in ${TEST_MAKEFILES}
+.  if exists(${_mkfile_})
+.    include "${_mkfile_}"
+.  endif
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff -r 0c02408cb0db -r 43f3f729c0f9 regress/buildlink-unwrap/spec
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/buildlink-unwrap/spec     Sat Aug 28 06:17:21 2004 +0000
@@ -0,0 +1,12 @@
+# $NetBSD: spec,v 1.1.1.1 2004/08/28 06:17:21 jlam Exp $
+#
+# buildlink-unwrap regression test
+# spec file
+#
+MAKEARGS_TEST=regress  # target to invoke for regression tests
+MAKEARGS_CLEAN=clean   # need to remove work directory afterwards
+
+check_result()
+{
+       exit_status 0   # test is passed if the "regress" target returs 0
+}
diff -r 0c02408cb0db -r 43f3f729c0f9 regress/buildlink-unwrap/tests/unwrap-config.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/buildlink-unwrap/tests/unwrap-config.mk   Sat Aug 28 06:17:21 2004 +0000
@@ -0,0 +1,22 @@
+# $NetBSD: unwrap-config.mk,v 1.1.1.1 2004/08/28 06:17:21 jlam Exp $
+
+.PHONY: unwrap-config-cflags
+do-regress: unwrap-config-cflags
+unwrap-config-cflags:
+       @test="unwrap-config --cflags";                                 \
+       expected="-I${PREFIX}/include";                                 \
+       ${TEST_RESULT}
+
+.PHONY: unwrap-config-ldflags
+do-regress: unwrap-config-ldflags
+unwrap-config-ldflags:
+       @test="unwrap-config --ldflags";                                \
+       expected="-L${PREFIX}/lib ${COMPILER_RPATH_FLAG}${PREFIX}/lib"; \
+       ${TEST_RESULT}
+
+.PHONY: unwrap-config-libs
+do-regress: unwrap-config-libs
+unwrap-config-libs:
+       @test="unwrap-config --libs";                                   \
+       expected="-ledit -ltermcap -lm";                                \
+       ${TEST_RESULT}
diff -r 0c02408cb0db -r 43f3f729c0f9 regress/buildlink-unwrap/tests/unwrap-config.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/buildlink-unwrap/tests/unwrap-config.sh   Sat Aug 28 06:17:21 2004 +0000
@@ -0,0 +1,29 @@
+#! /bin/sh
+#
+# $NetBSD: unwrap-config.sh,v 1.1.1.1 2004/08/28 06:17:21 jlam Exp $
+#
+# This is a dummy *-config script that is used to test whether these
+# files are correctly "unwrapped" at post-build time.
+
+prefix="@PREFIX@"
+exec_prefix="${prefix}"
+
+includedir="${prefix}/include"
+libdir="${exec_prefix}/lib"
+
+output=""
+for option do
+       case $option in
+       --cflags)
+               output="$output -O2 -I${includedir}"
+               ;;
+       --ldflags)
+               output="$output -L${libdir} @COMPILER_RPATH_FLAG@${libdir}"
+               ;;
+       --libs)
+               output="$output -lreadline"
+               ;;
+       esac
+done
+
+echo $output



Home | Main Index | Thread Index | Old Index