コード例 #1
0
ファイル: installer.py プロジェクト: renormalist/autotest
    def install_unittests(self):
        userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
        test_repo = self.params.get("test_git_repo")
        test_branch = self.params.get("test_branch", "master")
        test_commit = self.params.get("test_commit", None)
        test_lbranch = self.params.get("test_lbranch", "master")

        if test_repo:
            test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests")
            kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir,
                                     test_commit, test_lbranch)
            unittest_cfg = os.path.join(test_srcdir, 'x86', 'unittests.cfg')
            self.test_srcdir = test_srcdir
        else:
            unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86',
                                        'unittests.cfg')
        self.unittest_cfg = None
        if os.path.isfile(unittest_cfg):
            self.unittest_cfg = unittest_cfg
        else:
            if test_repo:
                logging.error(
                    "No unittest config file %s found, skipping "
                    "unittest build", self.unittest_cfg)

        self.unittest_prefix = None
        if self.unittest_cfg:
            logging.info("Building and installing unittests")
            os.chdir(os.path.dirname(os.path.dirname(self.unittest_cfg)))
            utils.system('./configure --prefix=%s' % self.prefix)
            utils.system('make')
            utils.system('make install')
            self.unittest_prefix = os.path.join(self.prefix, 'share', 'qemu',
                                                'tests')
コード例 #2
0
ファイル: installer.py プロジェクト: renormalist/autotest
    def install_unittests(self):
        userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
        test_repo = self.params.get("test_git_repo")
        test_branch = self.params.get("test_branch", "master")
        test_commit = self.params.get("test_commit", None)
        test_lbranch = self.params.get("test_lbranch", "master")

        if test_repo:
            test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests")
            kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir,
                                     test_commit, test_lbranch)
            unittest_cfg = os.path.join(test_srcdir, 'x86',
                                        'unittests.cfg')
            self.test_srcdir = test_srcdir
        else:
            unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86',
                                        'unittests.cfg')
        self.unittest_cfg = None
        if os.path.isfile(unittest_cfg):
            self.unittest_cfg = unittest_cfg
        else:
            if test_repo:
                logging.error("No unittest config file %s found, skipping "
                              "unittest build", self.unittest_cfg)

        self.unittest_prefix = None
        if self.unittest_cfg:
            logging.info("Building and installing unittests")
            os.chdir(os.path.dirname(os.path.dirname(self.unittest_cfg)))
            utils.system('./configure --prefix=%s' % self.prefix)
            utils.system('make')
            utils.system('make install')
            self.unittest_prefix = os.path.join(self.prefix, 'share', 'qemu',
                                                'tests')
コード例 #3
0
ファイル: kvm_install.py プロジェクト: yochow/autotest
    def __init__(self, test, params):
        """
        Initialize class parameters and retrieves code from git repositories.

        @param test: kvm test object.
        @param params: Dictionary with test parameters.
        """
        install_mode = params["mode"]
        srcdir = params.get("srcdir", test.bindir)
        if not srcdir:
            os.makedirs(srcdir)
        self.srcdir = srcdir
        # KVM build prefix
        self.test_bindir = test.bindir
        prefix = os.path.join(test.bindir, 'build')
        self.prefix = os.path.abspath(prefix)
        # Are we going to load modules?
        load_modules = params.get('load_modules')
        if not load_modules:
            self.load_modules = True
        elif load_modules == 'yes':
            self.load_modules = True
        elif load_modules == 'no':
            self.load_modules = False

        kernel_repo = params.get("git_repo")
        user_repo = params.get("user_git_repo")
        kmod_repo = params.get("kmod_repo")

        branch = params.get("git_branch", "master")
        lbranch = params.get("lbranch")

        tag = params.get("git_tag", "HEAD")
        user_tag = params.get("user_git_tag", "HEAD")
        kmod_tag = params.get("kmod_git_tag", "HEAD")

        if not kernel_repo:
            message = "KVM git repository path not specified"
            logging.error(message)
            raise error.TestError(message)
        if not user_repo:
            message = "KVM user git repository path not specified"
            logging.error(message)
            raise error.TestError(message)

        kernel_srcdir = os.path.join(srcdir, "kvm")
        kvm_utils.get_git_branch(kernel_repo, branch, kernel_srcdir, tag,
                                 lbranch)
        self.kernel_srcdir = kernel_srcdir

        userspace_srcdir = os.path.join(srcdir, "kvm_userspace")
        kvm_utils.get_git_branch(user_repo, branch, userspace_srcdir, user_tag,
                                 lbranch)
        self.userspace_srcdir = userspace_srcdir

        if kmod_repo:
            kmod_srcdir = os.path.join (srcdir, "kvm_kmod")
            kvm_utils.get_git_branch(kmod_repo, branch, kmod_srcdir, user_tag,
                                     lbranch)
            self.kmod_srcdir = kmod_srcdir
コード例 #4
0
ファイル: build.py プロジェクト: ehabkost/my-autotest-hacks
    def __init__(self, test, params):
        """
        Initialize class parameters and retrieves code from git repositories.

        @param test: kvm test object.
        @param params: Dictionary with test parameters.
        """
        super(GitInstaller, self).__init__(test, params)

        kernel_repo = params.get("git_repo")
        user_repo = params.get("user_git_repo")
        kmod_repo = params.get("kmod_repo")
        test_repo = params.get("test_git_repo")

        kernel_branch = params.get("kernel_branch", "master")
        user_branch = params.get("user_branch", "master")
        kmod_branch = params.get("kmod_branch", "master")
        test_branch = params.get("test_branch", "master")

        kernel_lbranch = params.get("kernel_lbranch", "master")
        user_lbranch = params.get("user_lbranch", "master")
        kmod_lbranch = params.get("kmod_lbranch", "master")
        test_lbranch = params.get("test_lbranch", "master")

        kernel_commit = params.get("kernel_commit", None)
        user_commit = params.get("user_commit", None)
        kmod_commit = params.get("kmod_commit", None)
        test_commit = params.get("test_commit", None)

        kernel_patches = eval(params.get("kernel_patches", "[]"))
        user_patches = eval(params.get("user_patches", "[]"))
        kmod_patches = eval(params.get("user_patches", "[]"))

        if not user_repo:
            message = "KVM user git repository path not specified"
            logging.error(message)
            raise error.TestError(message)

        userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
        kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
                                 user_commit, user_lbranch)
        self.userspace_srcdir = userspace_srcdir

        if user_patches:
            os.chdir(self.userspace_srcdir)
            for patch in user_patches:
                utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                   os.path.basename(patch)))
                utils.system('patch -p1 %s' % os.path.basename(patch))

        if test_repo:
            test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests")
            kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir,
                                     test_commit, test_lbranch)
            unittest_cfg = os.path.join(test_srcdir, 'x86',
                                        'unittests.cfg')
            self.test_srcdir = test_srcdir
        else:
            unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86',
                                        'unittests.cfg')

        self.unittest_cfg = None
        if os.path.isfile(unittest_cfg):
            self.unittest_cfg = unittest_cfg

        if kernel_repo:
            kernel_srcdir = os.path.join(self.srcdir, "kvm")
            kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
                                     kernel_commit, kernel_lbranch)
            self.kernel_srcdir = kernel_srcdir
            if kernel_patches:
                os.chdir(self.kernel_srcdir)
                for patch in kernel_patches:
                    utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                       os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kernel_srcdir = None

        if kmod_repo:
            kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod")
            kvm_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
                                     kmod_commit, kmod_lbranch)
            self.kmod_srcdir = kmod_srcdir
            if kmod_patches:
                os.chdir(self.kmod_srcdir)
                for patch in kmod_patches:
                    utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                       os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kmod_srcdir = None

        configure_script = os.path.join(self.userspace_srcdir, 'configure')
        self.configure_options = check_configure_options(configure_script)
コード例 #5
0
ファイル: installer.py プロジェクト: renormalist/autotest
    def _pull_code(self):
        """
        Retrieves code from git repositories.
        """
        params = self.params

        kernel_repo = params.get("git_repo")
        user_repo = params.get("user_git_repo")
        kmod_repo = params.get("kmod_repo")

        kernel_branch = params.get("kernel_branch", "master")
        user_branch = params.get("user_branch", "master")
        kmod_branch = params.get("kmod_branch", "master")

        kernel_lbranch = params.get("kernel_lbranch", "master")
        user_lbranch = params.get("user_lbranch", "master")
        kmod_lbranch = params.get("kmod_lbranch", "master")

        kernel_commit = params.get("kernel_commit", None)
        user_commit = params.get("user_commit", None)
        kmod_commit = params.get("kmod_commit", None)

        kernel_patches = eval(params.get("kernel_patches", "[]"))
        user_patches = eval(params.get("user_patches", "[]"))
        kmod_patches = eval(params.get("user_patches", "[]"))

        if not user_repo:
            message = "KVM user git repository path not specified"
            logging.error(message)
            raise error.TestError(message)

        userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
        kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
                                 user_commit, user_lbranch)
        self.userspace_srcdir = userspace_srcdir

        if user_patches:
            os.chdir(self.userspace_srcdir)
            for patch in user_patches:
                utils.get_file(
                    patch,
                    os.path.join(self.userspace_srcdir,
                                 os.path.basename(patch)))
                utils.system('patch -p1 %s' % os.path.basename(patch))

        if kernel_repo:
            kernel_srcdir = os.path.join(self.srcdir, "kvm")
            kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
                                     kernel_commit, kernel_lbranch)
            self.kernel_srcdir = kernel_srcdir
            if kernel_patches:
                os.chdir(self.kernel_srcdir)
                for patch in kernel_patches:
                    utils.get_file(
                        patch,
                        os.path.join(self.userspace_srcdir,
                                     os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kernel_srcdir = None

        if kmod_repo:
            kmod_srcdir = os.path.join(self.srcdir, "kvm_kmod")
            kvm_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
                                     kmod_commit, kmod_lbranch)
            self.kmod_srcdir = kmod_srcdir
            if kmod_patches:
                os.chdir(self.kmod_srcdir)
                for patch in kmod_patches:
                    utils.get_file(
                        patch,
                        os.path.join(self.userspace_srcdir,
                                     os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kmod_srcdir = None

        configure_script = os.path.join(self.userspace_srcdir, 'configure')
        self.configure_options = check_configure_options(configure_script)
コード例 #6
0
ファイル: installer.py プロジェクト: renormalist/autotest
    def _pull_code(self):
        """
        Retrieves code from git repositories.
        """
        params = self.params

        kernel_repo = params.get("git_repo")
        user_repo = params.get("user_git_repo")
        kmod_repo = params.get("kmod_repo")

        kernel_branch = params.get("kernel_branch", "master")
        user_branch = params.get("user_branch", "master")
        kmod_branch = params.get("kmod_branch", "master")

        kernel_lbranch = params.get("kernel_lbranch", "master")
        user_lbranch = params.get("user_lbranch", "master")
        kmod_lbranch = params.get("kmod_lbranch", "master")

        kernel_commit = params.get("kernel_commit", None)
        user_commit = params.get("user_commit", None)
        kmod_commit = params.get("kmod_commit", None)

        kernel_patches = eval(params.get("kernel_patches", "[]"))
        user_patches = eval(params.get("user_patches", "[]"))
        kmod_patches = eval(params.get("user_patches", "[]"))

        if not user_repo:
            message = "KVM user git repository path not specified"
            logging.error(message)
            raise error.TestError(message)

        userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
        kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
                                 user_commit, user_lbranch)
        self.userspace_srcdir = userspace_srcdir

        if user_patches:
            os.chdir(self.userspace_srcdir)
            for patch in user_patches:
                utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                   os.path.basename(patch)))
                utils.system('patch -p1 %s' % os.path.basename(patch))

        if kernel_repo:
            kernel_srcdir = os.path.join(self.srcdir, "kvm")
            kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
                                     kernel_commit, kernel_lbranch)
            self.kernel_srcdir = kernel_srcdir
            if kernel_patches:
                os.chdir(self.kernel_srcdir)
                for patch in kernel_patches:
                    utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                       os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kernel_srcdir = None

        if kmod_repo:
            kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod")
            kvm_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
                                     kmod_commit, kmod_lbranch)
            self.kmod_srcdir = kmod_srcdir
            if kmod_patches:
                os.chdir(self.kmod_srcdir)
                for patch in kmod_patches:
                    utils.get_file(patch, os.path.join(self.userspace_srcdir,
                                                       os.path.basename(patch)))
                    utils.system('patch -p1 %s' % os.path.basename(patch))
        else:
            self.kmod_srcdir = None

        configure_script = os.path.join(self.userspace_srcdir, 'configure')
        self.configure_options = check_configure_options(configure_script)
コード例 #7
0
ファイル: build.py プロジェクト: wenhann/chromiumos
    def __init__(self, test, params):
        """
        Initialize class parameters and retrieves code from git repositories.

        @param test: kvm test object.
        @param params: Dictionary with test parameters.
        """
        install_mode = params["mode"]
        srcdir = params.get("srcdir", test.bindir)
        if not srcdir:
            os.makedirs(srcdir)
        self.srcdir = srcdir
        # KVM build prefix
        self.test_bindir = test.bindir
        prefix = os.path.join(test.bindir, 'build')
        self.prefix = os.path.abspath(prefix)
        # Current host kernel directory
        default_host_kernel_source = '/lib/modules/%s/build' % os.uname()[2]
        self.host_kernel_srcdir = params.get('host_kernel_source',
                                             default_host_kernel_source)
        # Extra parameters that can be passed to the configure script
        self.extra_configure_options = params.get('extra_configure_options',
                                                  None)
        # Are we going to load modules?
        load_modules = params.get('load_modules')
        if not load_modules:
            self.load_modules = True
        elif load_modules == 'yes':
            self.load_modules = True
        elif load_modules == 'no':
            self.load_modules = False

        self.extra_modules = params.get("extra_modules", None)

        kernel_repo = params.get("git_repo")
        user_repo = params.get("user_git_repo")
        kmod_repo = params.get("kmod_repo")

        kernel_branch = params.get("kernel_branch", "master")
        user_branch = params.get("user_branch", "master")
        kmod_branch = params.get("kmod_branch", "master")

        kernel_lbranch = params.get("kernel_lbranch", "master")
        user_lbranch = params.get("user_lbranch", "master")
        kmod_lbranch = params.get("kmod_lbranch", "master")

        kernel_tag = params.get("kernel_tag", "HEAD")
        user_tag = params.get("user_tag", "HEAD")
        kmod_tag = params.get("kmod_tag", "HEAD")

        if not kernel_repo:
            message = "KVM git repository path not specified"
            logging.error(message)
            raise error.TestError(message)
        if not user_repo:
            message = "KVM user git repository path not specified"
            logging.error(message)
            raise error.TestError(message)

        kernel_srcdir = os.path.join(srcdir, "kvm")
        kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
                                 kernel_tag, kernel_lbranch)
        self.kernel_srcdir = kernel_srcdir

        userspace_srcdir = os.path.join(srcdir, "kvm_userspace")
        kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
                                 user_tag, user_lbranch)
        self.userspace_srcdir = userspace_srcdir

        if kmod_repo:
            kmod_srcdir = os.path.join (srcdir, "kvm_kmod")
            kvm_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
                                     kmod_tag, kmod_lbranch)
            self.kmod_srcdir = kmod_srcdir
        else:
            self.kmod_srcdir = None

        configure_script = os.path.join(self.userspace_srcdir, 'configure')
        self.configure_options = check_configure_options(configure_script)