当前位置: 首页>>代码示例>>Python>>正文


Python httpserver.HTTPService类代码示例

本文整理汇总了Python中oeqa.utils.httpserver.HTTPService的典型用法代码示例。如果您正苦于以下问题:Python HTTPService类的具体用法?Python HTTPService怎么用?Python HTTPService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTTPService类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SdkUpdateTest

class SdkUpdateTest(oeSDKExtTest):

    @classmethod
    def setUpClass(self):
        self.publish_dir = os.path.join(self.tc.sdktestdir, 'esdk_publish')
        if os.path.exists(self.publish_dir):
            shutil.rmtree(self.publish_dir)
        os.mkdir(self.publish_dir)

        tcname_new = self.tc.d.expand(
            "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}-new.sh")
        if not os.path.exists(tcname_new):
            tcname_new = self.tc.tcname

        cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir)
        subprocess.check_output(cmd, shell=True)

        self.http_service = HTTPService(self.publish_dir)
        self.http_service.start()

        self.http_url = "http://127.0.0.1:%d" % self.http_service.port

    def test_sdk_update_http(self):
        output = self._run("devtool sdk-update \"%s\"" % self.http_url)

    def test_sdk_update_local(self):
        output = self._run("devtool sdk-update \"%s\"" % self.publish_dir)

    @classmethod
    def tearDownClass(self):
        self.http_service.stop()
        shutil.rmtree(self.publish_dir)
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:32,代码来源:sdk_update.py

示例2: SdkUpdateTest

class SdkUpdateTest(OESDKExtTestCase):
    @classmethod
    def setUpClass(self):
        self.publish_dir = os.path.join(self.tc.sdk_dir, 'esdk_publish')
        if os.path.exists(self.publish_dir):
            shutil.rmtree(self.publish_dir)
        os.mkdir(self.publish_dir)

        base_tcname = "%s/%s" % (self.td.get("SDK_DEPLOY", ''),
            self.td.get("TOOLCHAINEXT_OUTPUTNAME", ''))
        tcname_new = "%s-new.sh" % base_tcname
        if not os.path.exists(tcname_new):
            tcname_new = "%s.sh" % base_tcname

        cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir)
        subprocess.check_output(cmd, shell=True)

        self.http_service = HTTPService(self.publish_dir)
        self.http_service.start()

        self.http_url = "http://127.0.0.1:%d" % self.http_service.port

    def test_sdk_update_http(self):
        output = self._run("devtool sdk-update \"%s\"" % self.http_url)

    @classmethod
    def tearDownClass(self):
        self.http_service.stop()
        shutil.rmtree(self.publish_dir)
开发者ID:01org,项目名称:luv-yocto,代码行数:29,代码来源:devtool.py

示例3: setUpClass

    def setUpClass(self):
        self.repolist = []

        # Index RPMs
        rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo")
        index_cmds = []
        rpm_dirs_found = False
        archs = (oeRuntimeTest.tc.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split()
        for arch in archs:
            rpm_dir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True), arch)
            idx_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpm', arch)
            db_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpmdb', arch)
            if not os.path.isdir(rpm_dir):
                continue
            if os.path.exists(db_path):
                bb.utils.remove(dbpath, True)
            lockfilename = oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True) + "/rpm.lock"
            lf = bb.utils.lockfile(lockfilename, False)
            oe.path.copyhardlinktree(rpm_dir, idx_path)
            # Full indexes overload a 256MB image so reduce the number of rpms
            # in the feed. Filter to p* since we use the psplash packages and
            # this leaves some allarch and machine arch packages too.
            bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm")
            bb.utils.unlockfile(lf)
            index_cmds.append("%s --dbpath %s --update -q %s" % (rpm_createrepo, db_path, idx_path))
            rpm_dirs_found = True
         # Create repodata¬
        result = oe.utils.multiprocess_exec(index_cmds, self.create_index)
        if result:
            bb.fatal('%s' % ('\n'.join(result)))
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('WORKDIR', True), oeRuntimeTest.tc.target.server_ip)
        self.repo_server.start()
开发者ID:agangidi53,项目名称:openbmc,代码行数:32,代码来源:smart.py

示例4: setUpClass

    def setUpClass(self):
        #note the existing channels that are on the board before creating new ones
#        self.existingchannels = set()
#        (status, result) = oeRuntimeTest.tc.target.run('smart channel --show | grep "\["', 0)
#        for x in result.split("\n"):
#            self.existingchannels.add(x)
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR'), oeRuntimeTest.tc.target.server_ip)
        self.repo_server.start()
开发者ID:kraj,项目名称:openembedded-core,代码行数:8,代码来源:_ptest.py

示例5: setUpClass

    def setUpClass(self):
        self.publish_dir = os.path.join(self.tc.sdktestdir, 'esdk_publish')
        if os.path.exists(self.publish_dir):
            shutil.rmtree(self.publish_dir)
        os.mkdir(self.publish_dir)

        tcname_new = self.tc.d.expand(
            "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}-new.sh")
        if not os.path.exists(tcname_new):
            tcname_new = self.tc.tcname

        cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir)
        subprocess.check_output(cmd, shell=True)

        self.http_service = HTTPService(self.publish_dir)
        self.http_service.start()

        self.http_url = "http://127.0.0.1:%d" % self.http_service.port
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:18,代码来源:sdk_update.py

示例6: setUpClass

    def setUpClass(self):
        self.publish_dir = os.path.join(self.tc.sdk_dir, 'esdk_publish')
        if os.path.exists(self.publish_dir):
            shutil.rmtree(self.publish_dir)
        os.mkdir(self.publish_dir)

        base_tcname = "%s/%s" % (self.td.get("SDK_DEPLOY", ''),
            self.td.get("TOOLCHAINEXT_OUTPUTNAME", ''))
        tcname_new = "%s-new.sh" % base_tcname
        if not os.path.exists(tcname_new):
            tcname_new = "%s.sh" % base_tcname

        cmd = 'oe-publish-sdk %s %s' % (tcname_new, self.publish_dir)
        subprocess.check_output(cmd, shell=True)

        self.http_service = HTTPService(self.publish_dir)
        self.http_service.start()

        self.http_url = "http://127.0.0.1:%d" % self.http_service.port
开发者ID:01org,项目名称:luv-yocto,代码行数:19,代码来源:devtool.py

示例7: setUpClass

 def setUpClass(self):
     self.repolist = []
     self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip)
     self.repo_server.start()
开发者ID:Brainbuster,项目名称:opennfr-buildumgebung,代码行数:4,代码来源:smart.py

示例8: SmartRepoTest

class SmartRepoTest(SmartTest):

    @classmethod
    def setUpClass(self):
        self.repolist = []
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip)
        self.repo_server.start()

    @classmethod
    def tearDownClass(self):
        self.repo_server.stop()
        for i in self.repolist:
            oeRuntimeTest.tc.target.run('smart channel -y --remove '+str(i))

    def test_smart_channel(self):
        self.smart('channel', 1)

    @testcase(719)
    def test_smart_channel_add(self):
        image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True)
        deploy_url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, image_pkgtype)
        pkgarchs = self.tc.d.getVar('PACKAGE_ARCHS', True).replace("-","_").split()
        for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)):
            if arch in pkgarchs:
                self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url))
                self.repolist.append(arch)
        self.smart('update')

    def test_smart_channel_help(self):
        self.smart('channel --help')

    def test_smart_channel_list(self):
        self.smart('channel --list')

    def test_smart_channel_show(self):
        self.smart('channel --show')

    @testcase(717)
    def test_smart_channel_rpmsys(self):
        self.smart('channel --show rpmsys')
        self.smart('channel --disable rpmsys')
        self.smart('channel --enable rpmsys')

    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install(self):
        self.smart('remove -y psplash-default')
        self.smart('install -y psplash-default')

    @testcase(728)
    @skipUnlessPassed('test_smart_install')
    def test_smart_install_dependency(self):
        self.smart('remove -y psplash')
        self.smart('install -y psplash-default')

    @testcase(723)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install_from_disk(self):
        self.smart('remove -y psplash-default')
        self.smart('download psplash-default')
        self.smart('install -y ./psplash-default*')

    @testcase(725)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install_from_http(self):
        output = self.smart('download --urls psplash-default')
        url = re.search('(http://.*/psplash-default.*\.rpm)', output)
        self.assertTrue(url, msg="Couln't find download url in %s" % output)
        self.smart('remove -y psplash-default')
        self.smart('install -y %s' % url.group(0))

    @testcase(729)
    @skipUnlessPassed('test_smart_install')
    def test_smart_reinstall(self):
        self.smart('reinstall -y psplash-default')

    @testcase(727)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_remote_repo(self):
        self.smart('update')
        self.smart('install -y psplash')
        self.smart('remove -y psplash')

    @testcase(726)
    def test_smart_local_dir(self):
        self.target.run('mkdir /tmp/myrpmdir')
        self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y')
        self.target.run('cd /tmp/myrpmdir')
        self.smart('download psplash')
        output = self.smart('channel --list')
        for i in output.split("\n"):
            if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)):
                self.smart('channel --disable '+str(i))
        self.target.run('cd /home/root')
        self.smart('install psplash')
        for i in output.split("\n"):
            if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)):
                self.smart('channel --enable '+str(i))
        self.smart('channel --remove myrpmdir -y')
        self.target.run("rm -rf /tmp/myrpmdir")

#.........这里部分代码省略.........
开发者ID:Brainbuster,项目名称:opennfr-buildumgebung,代码行数:101,代码来源:smart.py

示例9: PtestRunnerTest

class PtestRunnerTest(oeRuntimeTest):

    # a ptest log parser
    def parse_ptest(self, logfile):
        parser = Lparser(test_0_pass_regex="^PASS:(.+)", test_0_fail_regex="^FAIL:(.+)", section_0_begin_regex="^BEGIN: .*/(.+)/ptest", section_0_end_regex="^END: .*/(.+)/ptest")
        parser.init()
        result = Result()

        with open(logfile) as f:
            for line in f:
                result_tuple = parser.parse_line(line)
                if not result_tuple:
                    continue
                result_tuple = line_type, category, status, name = parser.parse_line(line)

                if line_type == 'section' and status == 'begin':
                    current_section = name
                    continue

                if line_type == 'section' and status == 'end':
                    current_section = None
                    continue

                if line_type == 'test' and status == 'pass':
                    result.store(current_section, name, status)
                    continue

                if line_type == 'test' and status == 'fail':
                    result.store(current_section, name, status)
                    continue

        result.sort_tests()
        return result

    @classmethod
    def setUpClass(self):
        #note the existing channels that are on the board before creating new ones
#        self.existingchannels = set()
#        (status, result) = oeRuntimeTest.tc.target.run('smart channel --show | grep "\["', 0)
#        for x in result.split("\n"):
#            self.existingchannels.add(x)
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR'), oeRuntimeTest.tc.target.server_ip)
        self.repo_server.start()

    @classmethod
    def tearDownClass(self):
        self.repo_server.stop()
        #remove created channels to be able to repeat the tests on same image
#        (status, result) = oeRuntimeTest.tc.target.run('smart channel --show | grep "\["', 0)
#        for x in result.split("\n"):
#            if x not in self.existingchannels:
#                oeRuntimeTest.tc.target.run('smart channel --remove '+x[1:-1]+' -y', 0)

    def add_smart_channel(self):
        image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE')
        deploy_url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, image_pkgtype)
        pkgarchs = self.tc.d.getVar('PACKAGE_ARCHS').replace("-","_").split()
        for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)):
            if arch in pkgarchs:
                self.target.run('smart channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url), 0)
        self.target.run('smart update', 0)

    def install_complementary(self, globs=None):
        installed_pkgs_file = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR'),
                                           "installed_pkgs.txt")
        self.pkgs_list = RpmPkgsList(oeRuntimeTest.tc.d, oeRuntimeTest.tc.d.getVar('IMAGE_ROOTFS'), oeRuntimeTest.tc.d.getVar('arch_var'), oeRuntimeTest.tc.d.getVar('os_var'))
        with open(installed_pkgs_file, "w+") as installed_pkgs:
            installed_pkgs.write(self.pkgs_list.list("arch"))

        cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"),
               "-p", oeRuntimeTest.tc.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs_file,
               globs]
        try:
            bb.note("Installing complementary packages ...")
            complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as e:
            bb.fatal("Could not compute complementary packages list. Command "
                     "'%s' returned %d:\n%s" %
                     (' '.join(cmd), e.returncode, e.output))

        return complementary_pkgs.split()

    def setUpLocal(self):
        self.ptest_log = os.path.join(oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR",True), "ptest-%s.log" % oeRuntimeTest.tc.d.getVar('DATETIME'))

    @skipUnlessPassed('test_ssh')
    def test_ptestrunner(self):
        self.add_smart_channel()
        (runnerstatus, result) = self.target.run('which ptest-runner', 0)
        cond = oeRuntimeTest.hasPackage("ptest-runner") and oeRuntimeTest.hasFeature("ptest") and oeRuntimeTest.hasPackageMatch("-ptest") and (runnerstatus != 0)
        if cond:
            self.install_packages(self.install_complementary("*-ptest"))
            self.install_packages(['ptest-runner'])

        (runnerstatus, result) = self.target.run('/usr/bin/ptest-runner > /tmp/ptest.log 2>&1', 0)
        #exit code is !=0 even if ptest-runner executes because some ptest tests fail.
        self.assertTrue(runnerstatus != 127, msg="Cannot execute ptest-runner!")
        self.target.copy_from('/tmp/ptest.log', self.ptest_log)
        shutil.copyfile(self.ptest_log, "ptest.log")

#.........这里部分代码省略.........
开发者ID:kraj,项目名称:openembedded-core,代码行数:101,代码来源:_ptest.py

示例10: SmartRepoTest

class SmartRepoTest(SmartTest):

    @classmethod
    def setUpClass(self):
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip)
        self.repo_server.start()

    @classmethod
    def tearDownClass(self):
        self.repo_server.stop()

    def test_smart_channel(self):
        self.smart('channel', 1)

    def test_smart_channel_add(self):
        image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True)
        deploy_url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, image_pkgtype)
        pkgarchs = self.tc.d.getVar('PACKAGE_ARCHS', True)
        for arch in os.listdir('%s/%s' % (self.repo_server.root_dir, image_pkgtype)):
            if arch in pkgarchs:
                self.smart('channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(a=arch, u=deploy_url))
        self.smart('update')

    def test_smart_channel_help(self):
        self.smart('channel --help')

    def test_smart_channel_list(self):
        self.smart('channel --list')

    def test_smart_channel_show(self):
        self.smart('channel --show')

    def test_smart_channel_rpmsys(self):
        self.smart('channel --show rpmsys')
        self.smart('channel --disable rpmsys')
        self.smart('channel --enable rpmsys')

    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install(self):
        self.smart('remove -y psplash-default')
        self.smart('install -y psplash-default')

    @skipUnlessPassed('test_smart_install')
    def test_smart_install_dependency(self):
        self.smart('remove -y psplash')
        self.smart('install -y psplash-default')

    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install_from_disk(self):
        self.smart('remove -y psplash-default')
        self.smart('download psplash-default')
        self.smart('install -y ./psplash-default*')

    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_install_from_http(self):
        output = self.smart('download --urls psplash-default')
        url = re.search('(http://.*/psplash-default.*\.rpm)', output)
        self.assertTrue(url, msg="Couln't find download url in %s" % output)
        self.smart('remove -y psplash-default')
        self.smart('install -y %s' % url.group(0))

    @skipUnlessPassed('test_smart_install')
    def test_smart_reinstall(self):
        self.smart('reinstall -y psplash-default')
开发者ID:Firestorm552,项目名称:oe-core,代码行数:64,代码来源:smart.py

示例11: setUpClass

 def setUpClass(self):
     self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar("DEPLOY_DIR", True), oeRuntimeTest.tc.qemu.host_ip)
     self.repo_server.start()
开发者ID:alex1818,项目名称:yocto-iot,代码行数:3,代码来源:smart.py

示例12: SmartRepoTest

class SmartRepoTest(SmartTest):
    @classmethod
    def setUpClass(self):
        self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar("DEPLOY_DIR", True), oeRuntimeTest.tc.qemu.host_ip)
        self.repo_server.start()

    @classmethod
    def tearDownClass(self):
        self.repo_server.stop()

    def test_smart_channel(self):
        self.smart("channel", 1)

    def test_smart_channel_add(self):
        image_pkgtype = self.tc.d.getVar("IMAGE_PKGTYPE", True)
        deploy_url = "http://%s:%s/%s" % (self.tc.qemu.host_ip, self.repo_server.port, image_pkgtype)
        pkgarchs = self.tc.d.getVar("PACKAGE_ARCHS", True)
        for arch in os.listdir("%s/%s" % (self.repo_server.root_dir, image_pkgtype)):
            if arch in pkgarchs:
                self.smart("channel -y --add {a} type=rpm-md baseurl={u}/{a}".format(a=arch, u=deploy_url))
        self.smart("update")

    def test_smart_channel_help(self):
        self.smart("channel --help")

    def test_smart_channel_list(self):
        self.smart("channel --list")

    def test_smart_channel_show(self):
        self.smart("channel --show")

    def test_smart_channel_rpmsys(self):
        self.smart("channel --show rpmsys")
        self.smart("channel --disable rpmsys")
        self.smart("channel --enable rpmsys")

    @skipUnlessPassed("test_smart_channel_add")
    def test_smart_install(self):
        self.smart("remove -y psplash-default")
        self.smart("install -y psplash-default")

    @skipUnlessPassed("test_smart_install")
    def test_smart_install_dependency(self):
        self.smart("remove -y psplash")
        self.smart("install -y psplash-default")

    @skipUnlessPassed("test_smart_channel_add")
    def test_smart_install_from_disk(self):
        self.smart("remove -y psplash-default")
        self.smart("download psplash-default")
        self.smart("install -y ./psplash-default*")

    @skipUnlessPassed("test_smart_channel_add")
    def test_smart_install_from_http(self):
        output = self.smart("download --urls psplash-default")
        url = re.search("(http://.*/psplash-default.*\.rpm)", output)
        self.assertTrue(url, msg="Couln't find download url in %s" % output)
        self.smart("remove -y psplash-default")
        self.smart("install -y %s" % url.group(0))

    @skipUnlessPassed("test_smart_install")
    def test_smart_reinstall(self):
        self.smart("reinstall -y psplash-default")
开发者ID:alex1818,项目名称:yocto-iot,代码行数:63,代码来源:smart.py


注:本文中的oeqa.utils.httpserver.HTTPService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。