emerge forgotten C++ test from branch
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sat, 9 Aug 2008 16:03:47 +0000 (16:03 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sat, 9 Aug 2008 16:03:47 +0000 (16:03 +0000)
org.glite.security.gsoap-plugin/Makefile
org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp [new file with mode: 0644]

index b0faef9..ede762c 100644 (file)
@@ -44,7 +44,7 @@ langflavour:=_${lang}
 langsuffix:=.${lang}
 endif
 
-VPATH=${top_srcdir}/src:${top_srcdir}/examples
+VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples
 
 default: all
 
@@ -91,7 +91,7 @@ EX_LIBS:=-L${stagedir}/lib -lglite_security_gss_${nothrflavour}
 EX_THRLIBS:=-L${stagedir}/lib -lglite_security_gss_${thrflavour}
 HDRS:=glite_gsplugin.h glite_gscompat.h glite_gsplugin-int.h
 EXAMPLES:=wscalc_clt_ex wscalc_srv_ex wscalc_srv_ex2
-TESTS:=test_gss test_coverage test_cxx
+TESTS:=test_cxx
 
 STATICLIB:=libglite_security_gsoap_plugin_${nothrflavour}${langflavour}.a
 THRSTATICLIB:=libglite_security_gsoap_plugin_${thrflavour}${langflavour}.a
@@ -152,14 +152,9 @@ check: check.cxx
 # C/C++ compatibility test
 # (C flavour, gsoap 2.7.10 ==> C++ test fails)
 check.cxx:
-       ${MAKE} lang=cxx ${LTLIB_TEST_S} test_cxx
+       ${MAKE} lang=cxx -f ${top_srcdir}/Makefile ${LTLIB_TEST_S} test_cxx
        ./test_cxx
 
-test_coverage:
-       -mkdir coverage
-       cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check
-       cd coverage && for i in ${OBJS}; do gcov -o .libs/ $$i ; done
-
 examples: ${EXAMPLES}
 
 all-libs-with-soap:
@@ -256,6 +251,7 @@ install-soaplib:
 clean:
        rm -rvf ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB}
        rm -rvf ${LTLIB_S} ${THRLTLIB_S} ${STATICLIB_S} ${THRSTATICLIB_S}
+       rm -rvf ${LTLIB_TEST_S}
        rm -rvf *.c *.h *.xml *.nsmap *.o *.lo .libs ${EXAMPLES} ${TESTS}
        rm -rvf CalcService.wsdl wscalc.xsd
        rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/
diff --git a/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp b/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp
new file mode 100644 (file)
index 0000000..4caad45
--- /dev/null
@@ -0,0 +1,46 @@
+#include <iostream>
+
+#include "stdsoap2.h"
+#include "glite_gsplugin.h"
+
+#define TEST_STR "123456789ABCDEF"
+
+int main() {
+       struct soap *mydlo = NULL;
+       glite_gsplugin_Context gsplugin_ctx = NULL;
+       int ok1, ok2;
+
+       // test 1 - stdsoap2.c compatibility
+       if ((mydlo = soap_new()) == NULL) {
+               std::cerr << "Couldn't create soap" << std::endl;
+               return 1;
+       }
+       soap_set_endpoint(mydlo, TEST_STR);
+       std::cout << mydlo->endpoint << std::endl;
+       ok1 = strcmp(mydlo->endpoint, TEST_STR);
+
+       // test 2 - glite_gsplugin.c compatibility
+       //
+       // not real test, just may crash in bad test case on calling
+       // soap->fdelete where will be other function
+       if ( glite_gsplugin_init_context(&gsplugin_ctx) ) {
+               std::cerr << "Couldn't create gSOAP plugin context" << std::endl;
+               goto err;
+       }
+       if (soap_register_plugin_arg(mydlo, glite_gsplugin, gsplugin_ctx)) {
+               std::cerr << "Couldn't register gSoap plugin" << std::endl;
+               goto err;
+       }
+
+       soap_done(mydlo);
+       free(mydlo);
+       glite_gsplugin_free_context(gsplugin_ctx);
+       return ok1 && ok2;
+
+err:
+       if (gsplugin_ctx) glite_gsplugin_free_context(gsplugin_ctx);
+       if (mydlo) soap_destroy(mydlo);
+       return 1;
+}
+
+Namespace namespaces[] = {{NULL, NULL, NULL, NULL}};