Ignore:
Timestamp:
26/06/06 16:16:23 (13 years ago)
Author:
spascoe
Message:

Fixed the client API testcase problem. The client and server modules
cannot be linked into the same python interpreter, presumably because of
symbol conflicts. This should only be an issue during testing so I've created
the runclient.py script to circumvent it. There are now a set of test cases that wrap both client and server in python.

bbftp.c has been ammended to ensure all global variables are reset on each
invocation of bbftpc_main().

Location:
TI05-delivery/trunk/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/test/test_embedded.py

    r1195 r1238  
    224224 
    225225        lines = self._readSyslog() 
     226 
    226227        self.assertLines(['.*AuthContext received Auth message: NDG-Delivery-client %s' % VERSION], lines) 
    227228 
     
    339340# Embedded client test case currently segfaults :-( 
    340341# 
    341 ## import delivery.bbftpc 
    342 ## import StringIO 
    343  
    344 ## class PythonClientAuthOK(AuthOK): 
    345 ##     """Repeat AuthOK tests with a python-embedded client. 
    346 ##     """ 
    347  
    348 ##     def _runClient(self, cmd, debug=False, user="testcase", privatestr=None): 
    349 ##         """Run the client. 
    350 ##         """ 
    351  
    352 ##         #print "Waiting for gdb connect, pid = %d" % os.getpid() 
    353 ##         #time.sleep(15) 
    354  
    355 ##         if debug: 
    356 ##             f = "-d" 
    357 ##         else: 
    358 ##             f = "-m" 
    359  
    360 ##         # Tell bbftp to dump output to a file which is then opened for reading. 
    361 ##         tmp = tempfile.mktemp('test_bbftpd') 
    362 ##         args = ['-e', cmd, f, '-u', user, 
    363 ##                 #'-o', tmp, '-f', tmp, 
    364 ##                 '-r', '1'] 
    365  
    366 ##         if privatestr != None: 
    367 ##             args += ['-P', privatestr] 
    368  
    369 ##         args.append('localhost') 
    370 ##         print "Running client with args: %s" % (args,) 
    371  
    372 ##         delivery.bbftpc.run(args) 
    373  
    374 ##         #fh = open(tmp) 
    375 ##         #os.remove(tmp) 
    376 ##         fh = StringIO.StringIO('') 
    377  
    378 ##         return fh 
     342 
     343class PythonClientAuthOK(AuthOK): 
     344    """Repeat AuthOK tests with a python-embedded client. 
     345    """ 
     346 
     347    def _runClient(self, cmd, debug=False, user="testcase", privatestr=None): 
     348        """Run the client. 
     349        """ 
     350 
     351        if debug: 
     352            f = "-d" 
     353        else: 
     354            f = "-m" 
     355 
     356        args = ['-e', repr(cmd), f, '-u', user, 
     357                '-r', '1'] 
     358 
     359        if privatestr != None: 
     360            args += ['-P', privatestr] 
     361 
     362        args.append('localhost') 
     363 
     364        fh = os.popen('%s/test/runclient.py %s' % (HOME, ' '.join(args))) 
     365 
     366        return fh 
    379367 
    380368if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.