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,
                         '..'))

        control_files_tarball = commands.BuildAutotestControlFilesTarball(
            self._build_root, cwd, tempdir)
        queue.put([control_files_tarball])

        packages_tarball = commands.BuildAutotestPackagesTarball(
            self._build_root, cwd, tempdir)
        queue.put([packages_tarball])

        # Tar up the test suites.
        test_suites_tarball = commands.BuildAutotestTestSuitesTarball(
            self._build_root, cwd, tempdir)
        queue.put([test_suites_tarball])

        # Build the server side package.
        server_tarball = commands.BuildAutotestServerPackageTarball(
            self._build_root, cwd, tempdir)
        queue.put([server_tarball])
 def testBuildAutotestPackagesTarball(self):
   """Tests that generating the autotest packages tarball is correct."""
   with mock.patch.object(commands, 'BuildTarball') as m:
     commands.BuildAutotestPackagesTarball(self._buildroot, self._cwd,
                                           self._tarball_dir)
     m.assert_called_once_with(self._buildroot, ['autotest/packages'],
                               os.path.join(self._tarball_dir,
                                            'autotest_packages.tar'),
                               cwd=self._cwd, compressed=False)