Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
    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()
Ejemplo n.º 4
0
    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()
Ejemplo n.º 5
0
 def setUpClass(cls):
     allarchfeed = 'all'
     if cls.tc.td["MULTILIB_VARIANTS"]:
         allarchfeed = cls.tc.td["TUNE_PKGARCH"]
     service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], allarchfeed)
     cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
     cls.repo_server.start()
Ejemplo n.º 6
0
    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)
            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()
Ejemplo n.º 7
0
 def setUpClass(cls):
     cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'],
                                                'oe-testimage-repo'),
                                   '0.0.0.0',
                                   port=cls.tc.target.server_port,
                                   logger=cls.tc.logger)
     cls.repo_server.start()
Ejemplo n.º 8
0
    def setUpClass(cls):
        # If there is an exception in setUpClass it will not run tearDownClass
        # method and it leaves HTTP server running forever, so we need to be
        # sure tearDownClass is run.
        try:
            cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')

            # Start to serve sstate dir
            sstate_dir = get_bb_var('SSTATE_DIR')
            cls.http_service = HTTPService(sstate_dir)
            cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port
            cls.http_service.start()

            cls.image = 'core-image-minimal'
            oeSDKExtSelfTest.generate_eSDK(cls.image)

            # Install eSDK
            cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
            runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))

            cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)

            # Configure eSDK to use sstate mirror from poky
            sstate_config="""
SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
SSTATE_MIRRORS =  "file://.* http://%s/PATH"
            """ % cls.http_url
            with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
                f.write(sstate_config)
        except:
            cls.tearDownClass()
            raise
Ejemplo n.º 9
0
 def setUpClass(cls):
     import tempfile
     cls.temp_dir = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-")
     cls.repo_server = HTTPService(
         os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
         cls.tc.target.server_ip)
     cls.repo_server.start()
Ejemplo n.º 10
0
 def setUpClass(cls):
     service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_DEB'], '')
     cls.repo_server = HTTPService(service_repo,
                                   '0.0.0.0',
                                   port=cls.tc.target.server_port,
                                   logger=cls.tc.logger)
     cls.repo_server.start()
Ejemplo n.º 11
0
    def setUpClass(cls):
        # Start to serve sstate dir
        sstate_dir = get_bb_var('SSTATE_DIR')
        cls.http_service = HTTPService(sstate_dir)
        cls.http_service.start()

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

        cls.image = 'core-image-minimal'

        cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')
        oeSDKExtSelfTest.generate_eSDK(cls.image)

        # Install eSDK
        cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
        runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))

        cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment(
            '', cls.tmpdir_eSDKQA)

        # Configure eSDK to use sstate mirror from poky
        sstate_config = """
SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
SSTATE_MIRRORS =  "file://.* http://%s/PATH"
        """ % cls.http_url
        with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'),
                  'a+') as f:
            f.write(sstate_config)
Ejemplo n.º 12
0
    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()
Ejemplo n.º 13
0
 def setUp(cls):
     allarchfeed = 'all'
     if cls.tc.td["MULTILIB_VARIANTS"]:
         allarchfeed = cls.tc.td["TUNE_PKGARCH"]
     service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], allarchfeed)
     cls.repo_server = HTTPService(service_repo,
                                   '0.0.0.0', port=cls.tc.target.server_port,
                                   logger=cls.tc.logger)
     cls.repo_server.start()
Ejemplo n.º 14
0
    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
Ejemplo n.º 15
0
    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
Ejemplo n.º 16
0
    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)
            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()
Ejemplo n.º 17
0
    def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path):
        sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache')
        cls.http_service = HTTPService(sstate_dir)
        cls.http_service.start()
        cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port

        oeSDKExtSelfTest.generate_eSDK(cls.image)

        cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
        runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))

        cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)

        sstate_config="""
SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
SSTATE_MIRRORS =  "file://.* http://%s/PATH"
CORE_IMAGE_EXTRA_INSTALL = "perl"
        """ % cls.http_url

        with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
            f.write(sstate_config)
Ejemplo n.º 18
0
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")
Ejemplo n.º 19
0
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")

        result = self.parse_ptest("ptest.log")
        log_results_to_location = "./results"
        if os.path.exists(log_results_to_location):
            shutil.rmtree(log_results_to_location)
        os.makedirs(log_results_to_location)

        result.log_as_files(log_results_to_location, test_status = ['pass','fail'])
Ejemplo n.º 20
0
 def setUpClass(self):
     self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar("DEPLOY_DIR", True), oeRuntimeTest.tc.qemu.host_ip)
     self.repo_server.start()
Ejemplo n.º 21
0
 def setUpClass(self):
     self.repo_server = HTTPService(
         oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True),
         oeRuntimeTest.tc.qemu.host_ip)
     self.repo_server.start()
Ejemplo n.º 22
0
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', True),
            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', 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.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', True), "installed_pkgs.txt")
        self.pkgs_list = RpmPkgsList(
            oeRuntimeTest.tc.d,
            oeRuntimeTest.tc.d.getVar('IMAGE_ROOTFS', True),
            oeRuntimeTest.tc.d.getVar('arch_var', True),
            oeRuntimeTest.tc.d.getVar('os_var', True))
        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', True), "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', True))

    @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.hasPackage("-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")

        result = self.parse_ptest("ptest.log")
        log_results_to_location = "./results"
        if os.path.exists(log_results_to_location):
            shutil.rmtree(log_results_to_location)
        os.makedirs(log_results_to_location)

        result.log_as_files(log_results_to_location,
                            test_status=['pass', 'fail'])
Ejemplo n.º 23
0
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')
Ejemplo n.º 24
0
 def setUpClass(cls):
     service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_DEB'], 'all')
     cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
     cls.repo_server.start()
Ejemplo n.º 25
0
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')

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

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

    @testcase(971)
    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")

    @testcase(718)
    def test_smart_add_rpmdir(self):
        self.target.run('mkdir /tmp/myrpmdir')
        self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y')
        self.smart('channel --disable myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertTrue("disabled = yes" in output,
                        msg="Failed to disable rpm dir")
        self.smart('channel --enable  myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertFalse("disabled = yes" in output,
                         msg="Failed to enable rpm dir")
        self.smart('channel --remove myrpmdir -y')
        self.target.run("rm -rf /tmp/myrpmdir")

    @testcase(731)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_remove_package(self):
        self.smart('install -y psplash')
        self.smart('remove -y psplash')
Ejemplo n.º 26
0
 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()
Ejemplo n.º 27
0
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')
Ejemplo n.º 28
0
 def setUpClass(cls):
     cls.repolist = []
     cls.repo_server = HTTPService(cls.tc.td['WORKDIR'],
                                   cls.tc.target.server_ip)
     cls.repo_server.start()
Ejemplo n.º 29
0
 def setUpClass(cls):
     cls.repo_server = HTTPService(
         os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
         cls.tc.target.server_ip)
     cls.repo_server.start()
Ejemplo n.º 30
0
class SmartRepoTest(SmartTest):
    @classmethod
    def create_index(self, arg):
        index_cmd = arg
        try:
            bb.note("Executing '%s' ..." % index_cmd)
            result = subprocess.check_output(index_cmd,
                                             stderr=subprocess.STDOUT,
                                             shell=True).decode("utf-8")
        except subprocess.CalledProcessError as e:
            return (
                "Index creation command '%s' failed with return code %d:\n%s" %
                (e.cmd, e.returncode, e.output.decode("utf-8")))
        if result:
            bb.note(result)
        return None

    @classmethod
    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')
                 or "").replace('-', '_').split()
        for arch in archs:
            rpm_dir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM'),
                                   arch)
            idx_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR'),
                                    'rpm', arch)
            db_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR'),
                                   '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') + "/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'),
                                       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))

    @testcase(1143)
    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')
        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.smart(
                    'channel -y --add {a} type=rpm-md baseurl={u}/{a}'.format(
                        a=arch, u=deploy_url))
                self.repolist.append(arch)
        self.smart('update')

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

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

    @testcase(971)
    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')

    @testcase(1144)
    @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')
        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")

    @testcase(718)
    def test_smart_add_rpmdir(self):
        self.target.run('mkdir /tmp/myrpmdir')
        self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y')
        self.smart('channel --disable myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertTrue("disabled = yes" in output,
                        msg="Failed to disable rpm dir")
        self.smart('channel --enable  myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertFalse("disabled = yes" in output,
                         msg="Failed to enable rpm dir")
        self.smart('channel --remove myrpmdir -y')
        self.target.run("rm -rf /tmp/myrpmdir")

    @testcase(731)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_remove_package(self):
        self.smart('install -y psplash')
        self.smart('remove -y psplash')
Ejemplo n.º 31
0
class SmartRepoTest(SmartTest):

    @classmethod
    def create_index(self, arg):
        index_cmd = arg
        try:
            bb.note("Executing '%s' ..." % index_cmd)
            result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
        except subprocess.CalledProcessError as e:
            return("Index creation command '%s' failed with return code %d:\n%s" %
                    (e.cmd, e.returncode, e.output.decode("utf-8")))
        if result:
            bb.note(result)
        return None

    @classmethod
    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)
            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()

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

    @testcase(1143)
    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')

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

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

    @testcase(971)
    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')

    @testcase(1144)
    @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')
        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")

    @testcase(718)
    def test_smart_add_rpmdir(self):
        self.target.run('mkdir /tmp/myrpmdir')
        self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y')
        self.smart('channel --disable myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertTrue("disabled = yes" in output, msg="Failed to disable rpm dir")
        self.smart('channel --enable  myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertFalse("disabled = yes" in output, msg="Failed to enable rpm dir")
        self.smart('channel --remove myrpmdir -y')
        self.target.run("rm -rf /tmp/myrpmdir")

    @testcase(731)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_remove_package(self):
        self.smart('install -y psplash')
        self.smart('remove -y psplash')
Ejemplo n.º 32
0
 def setUp(cls):
     service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], 'all')
     cls.repo_server = HTTPService(service_repo,
                                   cls.tc.target.server_ip,
                                   logger=cls.tc.logger)
     cls.repo_server.start()
Ejemplo n.º 33
0
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")

    @testcase(718)
    def test_smart_add_rpmdir(self):
        self.target.run('mkdir /tmp/myrpmdir')
        self.smart('channel --add myrpmdir type=rpm-dir path=/tmp/myrpmdir -y')
        self.smart('channel --disable myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertTrue("disabled = yes" in output, msg="Failed to disable rpm dir")
        self.smart('channel --enable  myrpmdir -y')
        output = self.smart('channel --show myrpmdir')
        self.assertFalse("disabled = yes" in output, msg="Failed to enable rpm dir")
        self.smart('channel --remove myrpmdir -y')
        self.target.run("rm -rf /tmp/myrpmdir")

    @testcase(731)
    @skipUnlessPassed('test_smart_channel_add')
    def test_smart_remove_package(self):
        self.smart('install -y psplash')
        self.smart('remove -y psplash')
Ejemplo n.º 34
0
 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()
Ejemplo n.º 35
0
 def setUpClass(cls):
     rpm_deploy = os.path.join(cls.tc.td['DEPLOY_DIR'], 'rpm')
     cls.repo_server = HTTPService(rpm_deploy, cls.tc.target.server_ip)
     cls.repo_server.start()