Esempio n. 1
0
    def install(self, filenames):
        import pisock

        sd = pisock.pi_socket(pisock.PI_AF_SLP, pisock.PI_SOCK_STREAM, pisock.PI_PF_PADP)
        if not sd:
            self.log("failed to create socket", LOG_ERROR)
            return
        if (pisock.pi_bind(sd, (pisock.PI_AF_SLP, self.port))) == -1:
            self.log("failed to bind socket", LOG_ERROR)
            return
        if (pisock.pi_listen(sd, 1)) == -1:
            self.log("failed to listen on socket", LOG_ERROR)
            return
        ret = pisock.pi_accept(sd)
        if ret == -1:
            self.log("failed to accept connection", LOG_ERROR)
            return
        socket = ret[0]
        pisock.dlp_OpenConduit(socket)
        #user_info = pisock.dlp_ReadUserInfo(socket) # not used yet
        
        if type(filenames) == type(''): filenames = [filenames]
        for fn in filenames:
            f = pisock.pi_file(fn)
            f.install(socket)
            del f
            if not self.keep_installed_files:
                os.unlink(fn)
                
        # write back user info... not yet

        pisock.dlp_AddSyncLogEntry(socket, "Pyrite Publisher install completed.")
        pisock.pi_close(socket)
Esempio n. 2
0
 def testBadPort(self):
     sd = pisock.pi_socket(pisock.PI_AF_PILOT, pisock.PI_SOCK_STREAM,
                           pisock.PI_PF_DLP)
     self.assertRaises(pisock.error, pisock.pi_bind, sd, "/dev/nosuchport")
Esempio n. 3
0
                      dest="verbose",
                      action="store_true",
                      help="Print more output",
                      default=0)
    (options, args) = parser.parse_args()

    runner = unittest.TextTestRunner()

    VERBOSE = options.verbose

    if options.pilotport:

        pilotport = options.pilotport
        print "Running online and offline tests using port %s" % pilotport
        print "Connecting"
        sd = pisock.pi_socket(pisock.PI_AF_PILOT, pisock.PI_SOCK_STREAM,
                              pisock.PI_PF_DLP)

        pisock.pi_bind(sd, pilotport)
        pisock.pi_listen(sd, 1)
        pisock.pi_accept(sd)
        if VERBOSE:
            print pisock.dlp_ReadSysInfo(sd)
        else:
            pisock.dlp_ReadSysInfo(sd)
        pisock.dlp_OpenConduit(sd)
        print "Connected"
        runner.run(combinedSuite)
        pisock.pi_close(sd)
        print "Disconnected"
    else:
        print "Running offline tests only"
Esempio n. 4
0
 def testBadPort(self):
     sd = pisock.pi_socket(pisock.PI_AF_PILOT,
                           pisock.PI_SOCK_STREAM,
                           pisock.PI_PF_DLP)
     self.assertRaises(pisock.error, pisock.pi_bind, sd, "/dev/nosuchport")
Esempio n. 5
0
                      help="Perform online tests using port", metavar="PORT")
    parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
                      help="Print more output", default=0)
    (options, args) = parser.parse_args()

    runner = unittest.TextTestRunner()

    VERBOSE = options.verbose

    if options.pilotport:
        
        pilotport = options.pilotport
        print "Running online and offline tests using port %s" % pilotport
        print "Connecting"
        sd = pisock.pi_socket(pisock.PI_AF_PILOT,
                              pisock.PI_SOCK_STREAM,
                              pisock.PI_PF_DLP)
        
        pisock.pi_bind(sd, pilotport)
        pisock.pi_listen(sd, 1)
        pisock.pi_accept(sd)
        if VERBOSE:
            print pisock.dlp_ReadSysInfo(sd)
        else:
            pisock.dlp_ReadSysInfo(sd)
        pisock.dlp_OpenConduit(sd)
        print "Connected"
        runner.run(combinedSuite)
        pisock.pi_close(sd)
        print "Disconnected"
    else: