コード例 #1
0
ファイル: handlers.py プロジェクト: csmart/jockey-yum
    def test_xorg_invalid_conf(self):
        '''XorgDriverHandler with invalid xorg.conf'''

        # append some breakage
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
EndSection

Section "Module"
EndSection
'''
        f.close()

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assert_('xorg.conf is invalid' in h.can_change())
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.disable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
コード例 #2
0
ファイル: handlers.py プロジェクト: csmart/jockey-yum
    def test_xorg_driver_modules(self):
        '''XorgDriverHandler with default Modules xorg.conf section'''

        # append a Module section
        f = open(OSLib.inst.xorg_conf_path, 'a')
        print >> f, '''
Section "Module"
        Load            "dri"
        SubSection "extmod"
                Option          "omit xfree86-dga"
        EndSubSection
        Load            "foo"
EndSection
'''
        f.close()

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I|re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, 'v3d.oldconf'))

        # should restore module dri, drop glx and remove dri2
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I|re.M))
コード例 #3
0
ファイル: handlers.py プロジェクト: csmart/jockey-yum
    def test_xorg_driver_nomodules(self):
        '''XorgDriverHandler with no default Modules xorg.conf section'''
        
        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')

        orig_xorg_conf = open(OSLib.inst.xorg_conf_path).read()

        self.assertEqual(h.name(), 'Vanilla accelerated graphics driver')
        self.assertEqual(h.id(), 'xorg:vanilla3d')
        self.assertEqual(h.description(),  OSLib.inst.package_description('mesa-vanilla')[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.failIf(h.used())
        self.assertEqual(h.available(), None)
        self.failIf(h.enables_composite())

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.failIf(h.used()) # X.org needs to be restarted for this to work
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # driver should be used when loading the module (done in enable()) and
        # starting jockey again
        h2 = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'], remove_modules=['dri'],
            name='Vanilla accelerated graphics driver')
        self.assert_(h2.enabled())
        self.assert_(h2.used())

        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.used()) # wasn't used after enabling
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))

        # restores original backup
        self.assertEqual(open(OSLib.inst.xorg_conf_path).read(), orig_xorg_conf)

        # vendor
        h.driver_vendor = 'Foo Bar'
        self.assertEqual(h.id(), 'xorg:vanilla3d:Foo_Bar')
コード例 #4
0
    def available(self):
        # we don't offer cdv in a life CD environment, as we will run out of
        # RAM trying to download and install all the packages in the RAM disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling cdv driver on live system')
            return False

        logging.debug('cdv.available: falling back to default')
        return XorgDriverHandler.available(self)
コード例 #5
0
ファイル: fglrx.py プロジェクト: thnguyn2/ECE_527_MP
    def available(self):
        # we don't offer fglrx in a life CD environment, as we will run out of
        # RAM trying to download and install all the packages in the RAM disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling fglrx driver on live system')
            return False

        logging.debug('fglrx.available: falling back to default')
        return XorgDriverHandler.available(self)
コード例 #6
0
ファイル: handlers.py プロジェクト: csmart/jockey-yum
    def test_xorg_driver_abi_checking(self):
        '''XorgDriverHandler ABI checking'''

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', 'v3d',
            'vanilla', name='Vanilla accelerated graphics driver')

        # our TestOSLib doesn't define video_driver_abi(), so should be
        # available by default
        self.assertNotEqual(h.available(), False)

        orig_video_driver_abi = OSLib.inst.video_driver_abi
        try:
            # should be available for matching ABI
            OSLib.inst.video_driver_abi = lambda pkg: OSLib.inst.current_xorg_video_abi()
            self.assertNotEqual(h.available(), False)

            # should not be available for nonmatching ABI
            OSLib.inst.video_driver_abi = lambda pkg: 'otherabi'
            self.assertEqual(h.available(), False)
        finally:
            OSLib.inst.video_driver_abi = orig_video_driver_abi
コード例 #7
0
ファイル: pvr-omap4.py プロジェクト: thnguyn2/ECE_527_MP
    def available(self):
        '''Check /proc/cpuinfo for an OMAP 4 board.'''
        if XorgDriverHandler.available(self) == False:
            return False

        try:
            for l in open('/proc/cpuinfo'):
                if self.omap4_re.match(l):
                    return True
        except IOError as e:
            logging.error('could not open /proc/cpuinfo: %s' % str(e))

        return False
コード例 #8
0
ファイル: pvr-omap4.py プロジェクト: CanaimaKueka/jockey
    def available(self):
        '''Check /proc/cpuinfo for an OMAP 4 board.'''
        if XorgDriverHandler.available(self) == False:
            return False

        try:
            for l in open('/proc/cpuinfo'):
                if self.omap4_re.match(l):
                    return True
        except IOError as e:
            logging.error('could not open /proc/cpuinfo: %s' % str(e))

        return False
コード例 #9
0
    def available(self):
        # we don't offer this driver in a life CD environment, as we will run
        # out of RAM trying to download and install all the packages in the RAM
        # disk.
        if os.path.isdir('/rofs'):
            logging.debug('Disabling Nvidia driver on live system')
            return False

        if 'intel' in self.loaded_drivers():
            logging.debug('Disabling Nvidia driver on intel/hybrid system')
            return False

        logging.debug('nvidia.available: falling back to default')
        return XorgDriverHandler.available(self)
コード例 #10
0
ファイル: handlers.py プロジェクト: Fabioamd87/nfs-manager
    def test_xorg_driver_no_xorgconf(self):
        """XorgDriverHandler without a default xorg.conf"""

        os.unlink(OSLib.inst.xorg_conf_path)

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)  # should create an xorg.conf from scratch
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed("mesa-vanilla"))
        self.failIf(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))

        # should remove xorg.conf again
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed("mesa-vanilla"))
        self.assert_(OSLib.inst.module_blacklisted("vanilla3d"))
        self.failIf(os.path.exists(OSLib.inst.xorg_conf_path))
コード例 #11
0
ファイル: handlers.py プロジェクト: Fabioamd87/nfs-manager
    def test_xorg_invalid_conf(self):
        """XorgDriverHandler with invalid xorg.conf"""

        # append some breakage
        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
EndSection

Section "Module"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.assertEqual(h.name(), "Vanilla accelerated graphics driver")
        self.assertEqual(h.description(), OSLib.inst.package_description("mesa-vanilla")[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assert_("xorg.conf is invalid" in h.can_change())
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
        self.failIf(h.disable())
        self.failIf(h.changed())
        self.failIf(h.enabled())
コード例 #12
0
ファイル: handlers.py プロジェクト: csmart/jockey-yum
    def test_xorg_driver_no_xorgconf_nodriver(self):
        '''XorgDriverHandler without a default xorg.conf and no explicit "Driver"'''

        os.unlink(OSLib.inst.xorg_conf_path)

        h = XorgDriverHandler(self.backend, 'vanilla3d', 'mesa-vanilla', None,
            None, extra_conf_options={'SuperSpeed': 'true'}, 
            add_modules=['glx'], disable_modules=['dri2'],
            name='Vanilla accelerated graphics driver')

        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None) # should create an xorg.conf from scratch
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed('mesa-vanilla')) 
        self.failIf(OSLib.inst.module_blacklisted('vanilla3d'))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*driver', conf, re.I|re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I|re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I|re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I|re.M))

        # should remove xorg.conf again
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed('mesa-vanilla')) 
        self.assert_(OSLib.inst.module_blacklisted('vanilla3d'))
        self.failIf(os.path.exists(OSLib.inst.xorg_conf_path))
コード例 #13
0
ファイル: handlers.py プロジェクト: Fabioamd87/nfs-manager
    def test_xorg_driver_modules(self):
        """XorgDriverHandler with default Modules xorg.conf section"""

        # append a Module section
        f = open(OSLib.inst.xorg_conf_path, "a")
        print >> f, """
Section "Module"
        Load            "dri"
        SubSection "extmod"
                Option          "omit xfree86-dga"
        EndSubSection
        Load            "foo"
EndSection
"""
        f.close()

        h = XorgDriverHandler(
            self.backend,
            "vanilla3d",
            "mesa-vanilla",
            "v3d",
            "vanilla",
            extra_conf_options={"SuperSpeed": "true"},
            add_modules=["glx"],
            disable_modules=["dri2"],
            remove_modules=["dri"],
            name="Vanilla accelerated graphics driver",
        )

        self.assertEqual(h.name(), "Vanilla accelerated graphics driver")
        self.assertEqual(h.description(), OSLib.inst.package_description("mesa-vanilla")[1])
        self.assertEqual(h.rationale(), None)
        self.failIf(h.free())
        self.failIf(h.changed())
        self.assertEqual(h.can_change(), None)
        self.failIf(h.enabled())
        self.assertEqual(h.available(), None)

        self.failIf(h.enable())
        self.assert_(h.changed())
        self.assert_(h.enabled())
        self.assert_(OSLib.inst.package_installed("mesa-vanilla"))
        self.failIf(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.assert_(re.search('^\s*driver\s*"v3d"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*option\s*"SuperSpeed"\s*"true"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I | re.M))

        # unlink backup file
        os.unlink(os.path.join(OSLib.inst.backup_dir, "v3d.oldconf"))

        # should restore module dri, drop glx and remove dri2
        self.failIf(h.disable())
        self.assert_(h.changed())
        self.failIf(h.enabled())
        self.failIf(OSLib.inst.package_installed("mesa-vanilla"))
        self.assert_(OSLib.inst.module_blacklisted("vanilla3d"))

        conf = open(OSLib.inst.xorg_conf_path).read()
        self.failIf(re.search('^\s*load\s*"glx"\s*$', conf, re.I | re.M))
        self.failIf(re.search('^\s*disable\s*"dri2"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"dri"\s*$', conf, re.I | re.M))
        self.assert_(re.search('^\s*load\s*"foo"\s*$', conf, re.I | re.M))