summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-08-28 06:17:21 +0000
committerjlam <jlam@pkgsrc.org>2004-08-28 06:17:21 +0000
commit0b05bd85f35c3fc269035578b36db0d2b566d078 (patch)
tree08b178cd97bcf9204013757c8f266e336f47c8db /regress
parent8d572feba3c42eb07c7ebefebf9ff3a724667181 (diff)
downloadpkgsrc-0b05bd85f35c3fc269035578b36db0d2b566d078.tar.gz
Regression test for whether *-config scripts and other similar files are
correctly unwrapped (unbuildinkified).
Diffstat (limited to 'regress')
-rw-r--r--regress/buildlink-unwrap/Makefile76
-rw-r--r--regress/buildlink-unwrap/spec12
-rw-r--r--regress/buildlink-unwrap/tests/unwrap-config.mk22
-rw-r--r--regress/buildlink-unwrap/tests/unwrap-config.sh29
4 files changed, 139 insertions, 0 deletions
diff --git a/regress/buildlink-unwrap/Makefile b/regress/buildlink-unwrap/Makefile
new file mode 100644
index 00000000000..51d31c451e8
--- /dev/null
+++ b/regress/buildlink-unwrap/Makefile
@@ -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
+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 --git a/regress/buildlink-unwrap/spec b/regress/buildlink-unwrap/spec
new file mode 100644
index 00000000000..1f99e90a360
--- /dev/null
+++ b/regress/buildlink-unwrap/spec
@@ -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 --git a/regress/buildlink-unwrap/tests/unwrap-config.mk b/regress/buildlink-unwrap/tests/unwrap-config.mk
new file mode 100644
index 00000000000..5b7a0aee12f
--- /dev/null
+++ b/regress/buildlink-unwrap/tests/unwrap-config.mk
@@ -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 --git a/regress/buildlink-unwrap/tests/unwrap-config.sh b/regress/buildlink-unwrap/tests/unwrap-config.sh
new file mode 100644
index 00000000000..47ba634d417
--- /dev/null
+++ b/regress/buildlink-unwrap/tests/unwrap-config.sh
@@ -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