From: František Dvořák Date: Sat, 9 Aug 2008 16:03:47 +0000 (+0000) Subject: emerge forgotten C++ test from branch X-Git-Tag: merge_316_6_after~1 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=191f3613dbde842453d7890b35007e880584e303;p=jra1mw.git emerge forgotten C++ test from branch --- diff --git a/org.glite.security.gsoap-plugin/Makefile b/org.glite.security.gsoap-plugin/Makefile index b0faef9..ede762c 100644 --- a/org.glite.security.gsoap-plugin/Makefile +++ b/org.glite.security.gsoap-plugin/Makefile @@ -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 index 0000000..4caad45 --- /dev/null +++ b/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp @@ -0,0 +1,46 @@ +#include + +#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}};