Logo Search packages:      
Sourcecode: jockey version File versions  Download package

def sandbox::TestOSLib::_make_sys (   self  )  [private]

Create a dummy /sys tree from fake_sys and set self.sys_dir.

Definition at line 298 of file sandbox.py.

00298                        :
        '''Create a dummy /sys tree from fake_sys and set self.sys_dir.'''

        self.sys_dir = os.path.join(self.workdir, 'sys')

        for pcipath, info in fake_sys.iteritems():
            # create /sys/device entry
            device_dir = os.path.join(self.sys_dir, 'devices', pcipath)
            os.makedirs(device_dir)
            if 'modalias' in info:
                open(os.path.join(device_dir, 'modalias'), 'w').write(info['modalias'])
            if 'uevent' in info:
                open(os.path.join(device_dir, 'uevent'), 'w').write(info['uevent'])

            # create driver dir and symlink to device, if existing
            if 'driver' not in info:
                continue
            driver_dir = os.path.join(device_dir, info['driver'])
            try:
                os.makedirs(driver_dir)
            except OSError:
                pass
            os.symlink(info['driver'], os.path.join(device_dir, 'driver'))
            os.symlink(device_dir, os.path.join(driver_dir,
                os.path.basename(pcipath)))

            # create module dir and symlink to driver, if existing
            if 'module' not in info:
                continue
            module_dir = os.path.join(self.workdir, 'sys', 'module', info['module'])
            try:
                os.makedirs(os.path.join(module_dir, 'drivers'))
            except OSError:
                pass
            if not os.path.islink(os.path.join(driver_dir, 'module')):
                os.symlink(module_dir, os.path.join(driver_dir, 'module'))
            driver_comp = info['driver'].split('/')
            mod_driver_link = os.path.join(module_dir, 'drivers',
                '%s:%s' % (driver_comp[-3], driver_comp[-1]))
            if not os.path.islink(mod_driver_link):
                os.symlink(driver_dir, mod_driver_link)

    def _make_proc_modules(self):


Generated by  Doxygen 1.6.0   Back to index