summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2007-10-29 22:00:53 +0000
committerKen Raeburn <raeburn@mit.edu>2007-10-29 22:00:53 +0000
commit6ced4e0fa11dc0e2752ad03f8264a531470495b4 (patch)
tree254772143b0bc337a7bef0cc8e6bb333fe20aedb /src/tests
parentcd98f2bff6fdebd46f90c556502499341ae2888f (diff)
Test that C++ code can use our installed headers
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20149 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/misc/Makefile.in16
-rw-r--r--src/tests/misc/test_cxx_gss.cpp10
-rw-r--r--src/tests/misc/test_cxx_krb5.cpp16
3 files changed, 40 insertions, 2 deletions
diff --git a/src/tests/misc/Makefile.in b/src/tests/misc/Makefile.in
index 0dc4260eb..a6fa1a4aa 100644
--- a/src/tests/misc/Makefile.in
+++ b/src/tests/misc/Makefile.in
@@ -11,8 +11,10 @@ SRCS=$(srcdir)/test_getpw.c
all:: test_getpw
-check:: test_getpw
+check:: test_getpw test_cxx_krb5 test_cxx_gss
$(RUN_SETUP) $(VALGRIND) ./test_getpw
+ $(RUN_SETUP) $(VALGRIND) ./test_cxx_krb5
+ $(RUN_SETUP) $(VALGRIND) ./test_cxx_gss
test_getpw: $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_DEPLIB)
$(CC_LINK) $(ALL_CFLAGS) -o test_getpw $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_LIB)
@@ -20,10 +22,20 @@ test_getpw: $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_DEPLIB)
test_getsockname: $(OUTPRE)test_getsockname.$(OBJEXT)
$(CC_LINK) $(ALL_CFLAGS) -o test_getsockname $(OUTPRE)test_getsockname.$(OBJEXT) $(LIBS)
+CXX_LINK=$(CC_LINK) # hack!
+test_cxx_krb5 test_cxx_gss: CC=$(CXX)
+test_cxx_krb5: $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_DEPLIB)
+ $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_krb5 $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_LIB) $(LIBS)
+test_cxx_gss: $(OUTPRE)test_cxx_gss.$(OBJEXT)
+ $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_gss $(OUTPRE)test_cxx_gss.$(OBJEXT) $(LIBS)
+
+test_cxx_krb5.$(OBJEXT): test_cxx_krb5.cpp
+test_cxx_gss.$(OBJEXT): test_cxx_gss.cpp
+
install::
clean::
- $(RM) test_getpw
+ $(RM) test_getpw test_cxx_krb5 test_cxx_gss *.o
# +++ Dependency line eater +++
#
diff --git a/src/tests/misc/test_cxx_gss.cpp b/src/tests/misc/test_cxx_gss.cpp
new file mode 100644
index 000000000..6602c8393
--- /dev/null
+++ b/src/tests/misc/test_cxx_gss.cpp
@@ -0,0 +1,10 @@
+// Test that the krb5.h header is compatible with C++ application code.
+
+#include <stdio.h>
+#include "gssapi/gssapi.h"
+
+int main ()
+{
+ printf("hello, world\n");
+ return 0;
+}
diff --git a/src/tests/misc/test_cxx_krb5.cpp b/src/tests/misc/test_cxx_krb5.cpp
new file mode 100644
index 000000000..906c21d83
--- /dev/null
+++ b/src/tests/misc/test_cxx_krb5.cpp
@@ -0,0 +1,16 @@
+// Test that the krb5.h header is compatible with C++ application code.
+
+#include <stdio.h>
+#include "krb5.h"
+
+int main (int argc, char *argv[])
+{
+ krb5_context ctx;
+
+ if (krb5_init_context(&ctx) != 0) {
+ printf("krb5_init_context returned an error\n");
+ return 1;
+ }
+ printf("hello, world\n");
+ return 0;
+}