summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig>2006-10-22 07:52:27 +0000
committerrillig <rillig>2006-10-22 07:52:27 +0000
commitcaa8924e3cb27ab91dfbd4ad60f75709c1fb8fba (patch)
tree20e6bb814a0a61590d9189b86c6ef867f48d9cda /regress
parentcbcedafec955fa3cf2fae1563f7df85362b97ec7 (diff)
downloadpkgsrc-caa8924e3cb27ab91dfbd4ad60f75709c1fb8fba.tar.gz
Added tests for macro definitions on the command line.
Diffstat (limited to 'regress')
-rw-r--r--regress/compiler/Makefile20
-rw-r--r--regress/compiler/files/checklen.c11
-rw-r--r--regress/compiler/files/checktype.c1
3 files changed, 27 insertions, 5 deletions
diff --git a/regress/compiler/Makefile b/regress/compiler/Makefile
index 431f486721a..7e572d05f7a 100644
--- a/regress/compiler/Makefile
+++ b/regress/compiler/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.1 2006/07/11 05:03:11 rillig Exp $
+# $NetBSD: Makefile,v 1.2 2006/10/22 07:52:27 rillig Exp $
#
-DISTNAME= compiler-1.0
+DISTNAME= compiler-1.1
CATEGORIES= regress
MASTER_SITES= # none
DISTFILES= # none
@@ -15,11 +15,21 @@ USE_TOOLS+= printf
SRC_CMD= ${PRINTF} '\#if defined(__cplusplus)\nLANG: Cplus\n\#else\nLANG: Cplain\n\#endif\n'
+do-extract:
+ cd ${FILESDIR} && cp *.c ${WRKSRC}
+
do-build:
# Test whether CPP is a C preprocessor.
- ${SRC_CMD} | ${CPP} -DLANG=Cplain
+ ${SRC_CMD} | cpp -DLANG=Cplain
# Test whether CXXCPP is a C++ preprocessor.
# CXXCPP is not (yet)? defined.
- #${SRC_CMD} | ${CXXCPP} -DLANG=Cplus
-
+ #${SRC_CMD} | cxxcpp -DLANG=Cplus
+ # Test whether white-space is preserved in macro definitions.
+ cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"\ \ \ \ \" && ./checklen
+ cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"" \"" && ./checklen
+ cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES='" "' && ./checklen
+ # Test whether backslashes are preserved in macro definitions.
+ cd ${WRKSRC} && cc -c checktype.c -DTYPE="unsigned long"
+ cd ${WRKSRC} && cc -c checktype.c -DTYPE=unsigned\ long
+
.include "../../mk/bsd.pkg.mk"
diff --git a/regress/compiler/files/checklen.c b/regress/compiler/files/checklen.c
new file mode 100644
index 00000000000..92b91acafd4
--- /dev/null
+++ b/regress/compiler/files/checklen.c
@@ -0,0 +1,11 @@
+#include <assert.h>
+#include <string.h>
+
+int
+main(void)
+{
+ const char *s = SPACES;
+
+ assert(strlen(s) == LEN);
+ return 0;
+}
diff --git a/regress/compiler/files/checktype.c b/regress/compiler/files/checktype.c
new file mode 100644
index 00000000000..5c13fc7de61
--- /dev/null
+++ b/regress/compiler/files/checktype.c
@@ -0,0 +1 @@
+typedef TYPE t;