Esempio n. 1
0
 def __init__(self, serverCfg):
     self.serverCfg = serverCfg
     self.logger = logger.ServerLogger('rmake-server',
             serverCfg.getServerLogPath())
     self.logger.disableRPCConsole()
     self.logger.logRPCToFile(serverCfg.getXMLRPCLogPath())
     self.server = server.rMakeServer(serverCfg, self.logger)
Esempio n. 2
0
    def testMultipleContexts(self):
        config = """
[nossl]
buildFlavor !ssl
"""
        repos = self.openRepository()
        trv = self.addComponent('testcase:source', '1.0-1', '',
                                [('testcase.recipe', 
                                  basicRecipe + '\tif Use.ssl:pass')])

        self.openRmakeRepository()
        self.writeFile(self.workDir + '/config', config)
        self.buildCfg.read(self.workDir + '/config')

        uri = 'unix://%s/socket' % self.rootDir
        self.buildCfg.strictMode = True
        srv = server.rMakeServer(#None,
                    uri,
                    self.rmakeCfg,
                    None, quiet=True)

        rmakeClient = client.rMakeClient(uri)

        pid = os.fork()
        if pid:
            srv._close()
            try:
                helper = self.getRmakeHelper(rmakeClient.uri)
                troveSpec = '%s=%s[%s]' % trv.getNameVersionFlavor()
                troveSpec2 = '%s=%s[%s]{nossl}' % trv.getNameVersionFlavor()
                jobId = helper.buildTroves([troveSpec, troveSpec2])
                buildCfg = rmakeClient.getJobConfig(jobId)
                self.assertEquals(buildCfg.buildTroveSpecs, [cmdline.parseTroveSpec(troveSpec)])
                helper.waitForJob(jobId)
                job = helper.getJob(jobId)
                # make sure a trove can actually be found
                if job.isFailed():
                    raise RuntimeError('Job Failed: %s' % job.getFailureReason())
                trvs = job.findTrovesWithContext(None, 
                                        [('testcase:source', None, None, None)])
                assert(len(trvs) == 1)
                self.assertEquals(len(trvs.values()[0]), 2)
            finally:
                os.kill(pid, signal.SIGTERM)
                self.waitThenKill(pid)
        else:
            try:
                sys.stdin = open('/dev/null')
                lf = logfile.LogFile(self.rootDir + '/srv.log')
                lf.redirectOutput()
                srv.serve_forever()
            finally:
                os._exit(1)
Esempio n. 3
0
    def testBasic(self):
        repos = self.openRepository()
        trv = self.addComponent('testcase:source', '1.0-1', '',
                                [('testcase.recipe', basicRecipe)])


        self.openRmakeRepository()
        uri = 'unix://%s/socket' % self.rootDir
        srv = server.rMakeServer(#None,
                uri,
                self.rmakeCfg,
                None, quiet=True)
        self.buildCfg.uuid = self.genUUID('foo')
        self.buildCfg.strictMode = True
        #client = server.rMakeClient(srv)
        #client = server.rMakeClient('http://*****:*****@local:linux', None),
                                self.buildCfg.flavor)
            finally:
                os.kill(pid, signal.SIGTERM)
                self.waitThenKill(pid)
        else:
            try:
                sys.stdin = open('/dev/null')
                lf = logfile.LogFile(self.rootDir + '/srv.log')
                lf.redirectOutput()
                srv.serve_forever()
            finally:
                os._exit(1)