提交 419c0a8b 编写于 作者: S Santhosh

Renamed kernel_build.py to kernel.py and added check_version and

updated module name in examples/tests/linuxbuild.py
上级 0e8b7da3
......@@ -13,11 +13,13 @@
#
# Copyright: Red Hat Inc. 2014
# Author: Ruda Moura <rmoura@redhat.com>
# Author: Santhosh G <santhog4@linux.vnet.ibm.com>
import os
import shutil
import logging
import tempfile
from distutils.version import LooseVersion
from . import download, archive, build
......@@ -100,3 +102,15 @@ class KernelBuild(object):
def __del__(self):
shutil.rmtree(self.work_dir)
def check_version(version):
"""
This utility function compares the current kernel version with
the version parameter and gives assertion error if the version
parameter is greater.
:type version: string
:param version: version to be compared with current kernel version
"""
assert LooseVersion(os.uname()[2]) > LooseVersion(version), "Old kernel"
......@@ -2,7 +2,7 @@
from avocado import Test
from avocado import main
from avocado.utils import kernel_build
from avocado.utils import kernel
class LinuxBuildTest(Test):
......@@ -20,7 +20,7 @@ class LinuxBuildTest(Test):
if linux_config is not None:
linux_config = os.path.join(self.datadir, linux_config)
self.linux_build = kernel_build.KernelBuild(kernel_version,
self.linux_build = kernel.KernelBuild(kernel_version,
linux_config,
self.srcdir)
self.linux_build.download()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册