コード例 #1
0
ファイル: cros_stage.py プロジェクト: zhangjiayun/chromium.bb
    def _GenerateTestBits(self, tempdir):
        """Generate and transfer to the Moblab the test bits we require.

    Args:
      tempdir: Temporary Directory to store the generated test artifacts.
    """
        build_root = cros_build_lib.GetSysroot(board=self.board)
        cwd = os.path.join(build_root, BOARD_BUILD_DIR)
        commands.BuildAutotestTarballsForHWTest(build_root, cwd, tempdir)
コード例 #2
0
 def BuildAutotestTarballs(self):
   """Build the autotest tarballs."""
   with osutils.TempDir(prefix='cbuildbot-autotest') as tempdir:
     with self.ArtifactUploader(strict=True) as queue:
       cwd = os.path.abspath(
           os.path.join(self._build_root, 'chroot', 'build',
                        self._current_board, constants.AUTOTEST_BUILD_PATH,
                        '..'))
       for tarball in commands.BuildAutotestTarballsForHWTest(
           self._build_root, cwd, tempdir):
         queue.put([tarball])
コード例 #3
0
    def _GenerateTestArtifactsInMoblabDisk(self, vms):
        """Generates test artifacts into devserver cache directory in moblab's disk.

    Args:
      vms: A moblab_vm.MoblabVm instance that has been Createed but not Started.

    Returns:
      The absolute path inside moblab VM where the image cache is located.
    """
        with vms.MountedMoblabDiskContext() as disk_dir:
            # If by any chance this path exists, the permission bits are surely
            # nonsense, since 'moblab' user doesn't exist on the host system.
            osutils.RmDir(os.path.join(disk_dir, _MOBLAB_PAYLOAD_CACHE_DIR),
                          ignore_missing=True,
                          sudo=True)
            payloads_dir = os.path.join(disk_dir, _MOBLAB_PAYLOAD_CACHE_DIR,
                                        self._SubDutTargetImage())
            # moblab VM will chown this folder upon boot, so once again permission
            # bits from the host don't matter.
            osutils.SafeMakedirsNonRoot(payloads_dir)
            target_image_path = os.path.join(self.GetImageDirSymlink(),
                                             constants.TEST_IMAGE_BIN)
            commands.GeneratePayloads(target_image_path=target_image_path,
                                      archive_dir=payloads_dir,
                                      full=True,
                                      delta=False,
                                      stateful=True,
                                      dlc=False)
            commands.GenerateQuickProvisionPayloads(
                target_image_path=target_image_path, archive_dir=payloads_dir)
            cwd = os.path.abspath(
                os.path.join(self._build_root, 'chroot', 'build',
                             self._current_board,
                             constants.AUTOTEST_BUILD_PATH, '..'))
            logging.debug(
                'Running BuildAutotestTarballsForHWTest root %s cwd %s target %s',
                self._build_root, cwd, payloads_dir)
            commands.BuildAutotestTarballsForHWTest(self._build_root, cwd,
                                                    payloads_dir)
        return os.path.join(_MOBLAB_STATIC_MOUNT_PATH,
                            _MOBLAB_PAYLOAD_CACHE_DIR)