This commit was manufactured by cvs2svn to create branch 'branch_ltfix'.
authorcvs2svn <admin@example.com>
Fri, 10 Jun 2005 11:49:24 +0000 (11:49 +0000)
committercvs2svn <admin@example.com>
Fri, 10 Jun 2005 11:49:24 +0000 (11:49 +0000)
Sprout from glite-security-gsoap-plugin_branch_1_1_0 2005-05-06 13:38:56 UTC cvs2svn <admin@example.com> 'This commit was manufactured by cvs2svn to create branch 'glite-security-'
Cherrypick from master 2005-06-10 11:49:23 UTC Aleš Křenek <ljocha@ics.muni.cz> 'improved test':
    org.glite.security.gsoap-plugin/build.xml
    org.glite.security.gsoap-plugin/project/version.properties
    org.glite.security.gsoap-plugin/src/glite_gsplugin.c
    org.glite.security.gsoap-plugin/test/test_gss.cpp

org.glite.security.gsoap-plugin/build.xml
org.glite.security.gsoap-plugin/project/version.properties
org.glite.security.gsoap-plugin/src/glite_gsplugin.c
org.glite.security.gsoap-plugin/test/test_gss.cpp

index 485aa55..b93e59c 100755 (executable)
@@ -76,6 +76,7 @@
                 Load version file 
             ========================================= -->
        <property file="${module.version.file}"/>
+       <property file="${module.build.file}"/>
                
        <!-- ==============================================
                 Local private targets
index 08e9de3..b69e5b7 100644 (file)
@@ -1,2 +1,3 @@
-module.version=1.1.0
+# 1.2 pushed after branching 1.1, no added functionality yet
+module.version=1.2.0
 module.age=0
index 17cacc5..43a1aee 100644 (file)
@@ -232,6 +232,8 @@ glite_gsplugin_connect(
                                ctx->timeout,
                                ctx->connection, &gss_stat);
        if ( ret ) {
+               free(ctx->connection);
+               ctx->connection = NULL;
                edg_wll_gss_get_error(&gss_stat, "edg_wll_gss_connect()", &ctx->error_msg);
                goto err;
        }
index 083b71a..630de3f 100644 (file)
@@ -1,13 +1,16 @@
 #include <iostream>
+#include <fstream>
 #include <sys/types.h>
 #include <unistd.h>
-
+#include <assert.h>
 
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
+#include <cppunit/XmlOutputter.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
 
 #include "glite_gss.h"
 
@@ -15,11 +18,14 @@ class GSSTest: public  CppUnit::TestFixture
 {
        CPPUNIT_TEST_SUITE(GSSTest);
        CPPUNIT_TEST(echo);
+       CPPUNIT_TEST(echo);
+       CPPUNIT_TEST(bigecho);
        CPPUNIT_TEST(errorTest);
        CPPUNIT_TEST_SUITE_END();
 
 public:
        void echo();
+       void bigecho();
        void errorTest();
 
        void setUp();
@@ -31,7 +37,6 @@ private:
        struct timeval  timeout;
        
        void replier();
-       
 };
 
 
@@ -41,9 +46,10 @@ void GSSTest::replier() {
        struct sockaddr_in      a;
        socklen_t               alen = sizeof(a);
        int                     s, len;
-       char                    buf[100];
+       char                    buf[8*BUFSIZ];
+       
+       std::cerr << "replier " << getpid() << std::endl;
        
-
        if ( (s = accept(sock, (struct sockaddr *) &a, &alen)) < 0 ) exit(1);
        
        if ( edg_wll_gss_accept(my_cred, s, &timeout, &conn, &stat) ) exit(1);
@@ -63,8 +69,9 @@ void GSSTest::setUp(void) {
        socklen_t               alen = sizeof(a);
        char *                  cred_file = NULL;
        char *                  key_file = NULL;
+       char *                  to = getenv("GSS_TEST_TIMEOUT");
 
-       timeout.tv_sec = 10;
+       timeout.tv_sec = to ? atoi(to) : 10 ;
        timeout.tv_usec = 0;
        
        key_file = cred_file = getenv("X509_USER_PROXY");
@@ -106,6 +113,7 @@ void GSSTest::echo()
        char                    buf[] = "f843fejwfanczn nc4*&686%$$&^(*)*#$@WSH";       
        char                    buf2[100];      
 
+       std::cerr << "echo " << getpid() << std::endl;
 
        err = edg_wll_gss_connect(my_cred, "localhost", port, &timeout, &conn, &stat);
        CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_connect()", !err);
@@ -122,6 +130,32 @@ void GSSTest::echo()
                
 }
 
+void GSSTest::bigecho()
+{
+       edg_wll_GssConnection   conn;
+       edg_wll_GssStatus       stat;
+       size_t                  total;
+       int                     err;
+       char                    buf[7*BUFSIZ];
+       char                    buf2[7*BUFSIZ]; 
+
+       std::cerr << "bigecho " << getpid() << std::endl;
+
+       err = edg_wll_gss_connect(my_cred, "localhost", port, &timeout, &conn, &stat);
+       CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_connect()", !err);
+       
+       err = edg_wll_gss_write(&conn, buf, sizeof buf, &timeout, &stat);
+       CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_write()", !err);
+       
+       err = edg_wll_gss_read_full(&conn, buf2, sizeof buf2, &timeout, &total, &stat);
+       CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_read_full()", !err);
+
+       CPPUNIT_ASSERT(sizeof buf == total && !memcmp(buf,buf2,sizeof buf) );
+
+       edg_wll_gss_close(&conn, &timeout);
+               
+}
+
 
 void GSSTest::errorTest()
 {
@@ -141,9 +175,24 @@ CPPUNIT_TEST_SUITE_REGISTRATION( GSSTest );
 
 int main (int ac,const char *av[])
 {
+       assert(ac == 2);
+       std::ofstream   xml(av[1]);
+
        CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-       CppUnit::TextUi::TestRunner runner;
-       
+       CppUnit::TestRunner runner;
+
+       CppUnit::TestResult controller;
+       CppUnit::TestResultCollector result;
+       controller.addListener( &result );
+
        runner.addTest(suite);
-       return runner.run() ? 0 : 1;
+       runner.run(controller);
+
+
+       CppUnit::XmlOutputter xout( &result, xml );
+       CppUnit::CompilerOutputter tout( &result, std::cout);
+       xout.write();
+       tout.write();
+
+       return result.wasSuccessful() ? 0 : 1 ;
 }