本文整理汇总了Python中oeqa.utils.httpserver.HTTPService.stop方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPService.stop方法的具体用法?Python HTTPService.stop怎么用?Python HTTPService.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oeqa.utils.httpserver.HTTPService
的用法示例。
在下文中一共展示了HTTPService.stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SdkUpdateTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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)
示例2: SdkUpdateTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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)
示例3: SmartRepoTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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")
#.........这里部分代码省略.........
示例4: PtestRunnerTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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")
#.........这里部分代码省略.........
示例5: SmartRepoTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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')
示例6: SmartRepoTest
# 需要导入模块: from oeqa.utils.httpserver import HTTPService [as 别名]
# 或者: from oeqa.utils.httpserver.HTTPService import stop [as 别名]
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")