Пример #1
0
    def _write_image(self, image):
        sdmux.dut_disconnect(self.config.sdmux_id)
        sdmux.host_usda(self.config.sdmux_id)

        device = self.mux_device()
        logging.info("dd'ing image to device (%s)", device)
        dd_cmd = 'dd if=%s of=%s bs=4096 conv=fsync' % (image, device)
        dd_proc = subprocess.Popen(dd_cmd, shell=True)
        dd_proc.wait()
        if dd_proc.returncode != 0:
            raise CriticalError("Failed to dd image to device (Error code %d)" % dd_proc.returncode)

        sdmux.host_disconnect(self.config.sdmux_id)
Пример #2
0
    def file_system(self, partition, directory):
        """
        This works in conjunction with the "mux_device" function to safely
        access a partition/directory on the sdmux filesystem
        """
        self.proc.sendline('sync')
        self.proc.expect(self.tester_ps1_pattern)
        logging.info('powering off')
        self.context.run_command(self.config.power_off_cmd)

        sdmux.dut_disconnect(self.config.sdmux_id)
        sdmux.host_usda(self.config.sdmux_id)

        mntdir = os.path.join(self.scratch_dir, 'sdmux_mnt')
        ensure_directory(mntdir)

        device = self.mux_device()
        device = '%s%s' % (device, partition)
        try:
            self.context.run_command(['mount', device, mntdir], failok=False)
            if directory[0] == '/':
                directory = directory[1:]
            path = os.path.join(mntdir, directory)
            ensure_directory(path)
            logging.info('sdmux(%s) mounted at: %s', device, path)
            yield path
        except CriticalError:
            raise
        except subprocess.CalledProcessError:
            raise CriticalError('Unable to access sdmux device')
        except KeyboardInterrupt:
            raise KeyboardInterrupt
        except:
            logging.exception('Error accessing sdmux filesystem')
            raise CriticalError('Error accessing sdmux filesystem')
        finally:
            logging.info('unmounting sdmux')
            try:
                _flush_files(mntdir)
                self.context.run_command(['umount', device], failok=False)
            except subprocess.CalledProcessError:
                logging.exception('umount failed, re-try in 10 seconds')
                time.sleep(10)
                if self.context.run_command(['umount', device]) != 0:
                    logging.error(
                        'Unable to unmount sdmux device %s', device)

        sdmux.host_disconnect(self.config.sdmux_id)
Пример #3
0
 def power_off(self, proc):
     logging.info('powering off')
     self.context.run_command(self.config.power_off_cmd)
     sdmux.dut_disconnect(self.config.sdmux_id)
Пример #4
0
 def power_off(self, proc):
     logging.info('powering off')
     self.context.run_command(self.config.power_off_cmd)
     sdmux.dut_disconnect(self.config.sdmux_id)