Sanity check of gsoap structure size (gsoap-plugin vs ws-test module).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 15 Mar 2011 19:17:28 +0000 (19:17 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 15 Mar 2011 19:17:28 +0000 (19:17 +0000)
org.glite.lb.ws-test/Makefile
org.glite.lb.ws-test/tests/sizeof_soap_test.c [new file with mode: 0644]
org.glite.lbjp-common.gsoap-plugin/Makefile
org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h.in [moved from org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h with 96% similarity]

index ef8f78d..1ce6c32 100644 (file)
@@ -19,6 +19,7 @@ version=${module.version}
 
 CEXAMPLES:=ws_getversion ws_jobstat ws_joblog ws_lb4agu_GetActivityStatus ws_lb4agu_GetActivityInfo
 #TODO ws_query_ex 
+TESTS:=sizeof_soap_test
 
 default all: ${CEXAMPLES}
 
@@ -30,7 +31,7 @@ else
 default_flavour=_${nothrflavour}
 endif
 
-VPATH=${top_srcdir}/examples
+VPATH=${top_srcdir}/examples:${top_srcdir}/tests
 CC=gcc
 DEBUG:=-g -O0 -Wall
 CFLAGS:=${CFLAGS} -I${gsoap_prefix}/include -I${gsoap_prefix}/ \
@@ -63,11 +64,14 @@ ${SOAP_FILES}: %: LB.xh
 ${CEXAMPLES}: %: %.o ${WS_CLIENT_OBJS}
        ${LINK} -o $@ $@.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS}
 
+sizeof_soap_test: sizeof_soap_test.o
+       ${LINK} -o $@ $<
+
 %.o %.lo: %.c soap_version.h ${SOAP_FILES}
        ${COMPILE} -c $<
 
-check:
-       @echo "No test"
+check: ${TESTS}
+       ./sizeof_soap_test
 
 install:
        mkdir -p ${DESTDIR}${PREFIX}${prefix}/${libdir}/glite-lb/examples/
@@ -76,7 +80,7 @@ install:
        done
 
 clean:
-       rm -rvf .libs LB.xh *.xml ${GSOAP_FILES_PREFIX}* *.o *.lo *.nsmap soap_version.h ${CEXAMPLES}
+       rm -rvf .libs LB.xh *.xml ${GSOAP_FILES_PREFIX}* *.o *.lo *.nsmap soap_version.h ${CEXAMPLES} ${TESTS}
        rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ debian/
 
 LB.xh: ws_typemap.dat ${stagedir}${prefix}/interface/LB.wsdl
diff --git a/org.glite.lb.ws-test/tests/sizeof_soap_test.c b/org.glite.lb.ws-test/tests/sizeof_soap_test.c
new file mode 100644 (file)
index 0000000..bf58cfb
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+Copyright (c) Members of the EGEE Collaboration. 2004-2010.
+See http://www.eu-egee.org/partners for details on the copyright holders.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdsoap2.h>
+
+#include "soap_version.h"
+#include <glite/security/glite_gscompat.h>
+
+int main() {
+       printf("sizeof(struct soap) = %lu, original size = %lu\n",
+               sizeof(struct soap), GSOAP_SIZEOF_STRUCT_SOAP);
+
+       return !(sizeof(struct soap) == GSOAP_SIZEOF_STRUCT_SOAP);
+}
index bc35f80..aec3232 100644 (file)
@@ -57,7 +57,7 @@ langflavour:=_${lang}
 langsuffix:=.${lang}
 endif
 
-VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples
+VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/interface
 
 default: all
 
@@ -113,7 +113,7 @@ endif
 EX_NOTHRLIBS:=-L${stagedir}${prefix}/${libdir} -lglite_security_gss_${nothrflavour}
 EX_THRLIBS:=-L${stagedir}${prefix}/${libdir} -lglite_security_gss_${thrflavour}
 EX_LIBS:=-L${stagedir}${prefix}/${libdir} -lglite_security_gss
-HDRS:=glite_gsplugin.h glite_gscompat.h glite_gsplugin-int.h
+HDRS:=glite_gsplugin.h glite_gsplugin-int.h
 EXAMPLES:=wscalc_clt_ex wscalc_srv_ex wscalc_srv_ex2
 TESTS:=test_cxx
 
@@ -206,7 +206,7 @@ endif
 
 all compile: \
        ${lib_LTLIBRARIES} \
-       all-libs-with-soap examples
+       all-libs-with-soap examples glite_gscompat.h
 
 check: check.cxx
 
@@ -288,6 +288,16 @@ ${GSOAP_FPREFIX}H.h ${GSOAP_FPREFIX}C.c ${GSOAP_FPREFIX}Server.c ${GSOAP_FPREFIX
 wscalc_clt_ex.o: wscalc_clt_ex.c
        ${CC} -c ${CFLAGS} -o $@ $<
 
+sizeof_soap.o: sizeof_soap.c stdsoap2.h
+       ${COMPILE} -c $< -o $@
+
+sizeof_soap: sizeof_soap.o
+       ${LINK} $< -o $@
+
+glite_gscompat.h: glite_gscompat.h.in sizeof_soap
+       size=${shell ./sizeof_soap}; \
+       sed "s/@sizeof_struct_soap@/$$size/" ${top_srcdir}/interface/glite_gscompat.h.in > $@
+
 doc:
 
 stage:
@@ -300,6 +310,7 @@ install:
        -mkdir -p ${DESTDIR}${PREFIX}${prefix}/include/glite/security/
        ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version}
        cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${DESTDIR}${PREFIX}${prefix}/include/glite/security/
+       ${INSTALL} -m 644 glite_gscompat.h ${DESTDIR}${PREFIX}${prefix}/include/glite/security/
        for v in ${gsoap_versions_noflavours}; do \
                ${MAKE} -C `echo $$v | tr -d .` -f ../Makefile install-soaplib gsoap_version=$$v lang= PREFIX=${PREFIX} top_srcdir=${top_srcdir}/.. || exit $?; \
        done
@@ -317,6 +328,7 @@ clean:
        rm -rvf ${LTLIB_TEST_S}
        rm -rvf *.c *.h *.xml *.nsmap *.o *.lo .libs ${EXAMPLES} ${TESTS}
        rm -rvf CalcService.wsdl wscalc.xsd
+       rm -rvf glite_gscompat.h
        rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ debian/
        for v in ${gsoap_versions_noflavours} ${gsoap_versions_flavours}; do \
                rm -rvf `echo $$v | tr -d .`; \
@@ -20,6 +20,14 @@ limitations under the License.
 
 #ident "$Header: "
 
+/*
+ * for basic sanity check
+ *
+ * size of the soap structure can differs with compilation flags
+ * or with C/C++ compilers
+ */
+#define GSOAP_SIZEOF_STRUCT_SOAP @sizeof_struct_soap@
+
 #ifndef GSOAP_VERSION
   #error GSOAP_VERSION required
 #endif