rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def GetVersion(): """Get the version to put in LATEST and update the git version with.""" return datetime.datetime.now().strftime('%d.%m.%y.%H%M%S') | def _generate_dict_results(self, gs_bucket_path): """ Generate a dictionary result similar to GenerateUploadDict """ results = {} for entry in self.files_to_sync: results[entry] = os.path.join(gs_bucket_path, entry.replace(self.strip_path, '').lstrip('/')) return results | def GetVersion(): """Get the version to put in LATEST and update the git version with.""" return datetime.datetime.now().strftime('%d.%m.%y.%H%M%S') |
def LoadFilterFile(filter_file): """Load a file with keywords on a perline basis. | def testGenerateUploadDict(self): gs_bucket_path = 'gs://chromeos-prebuilt/host/version' self.mox.StubOutWithMock(cros_build_lib, 'ListFiles') cros_build_lib.ListFiles(' ').AndReturn(self.files_to_sync) self.mox.ReplayAll() result = prebuilt.GenerateUploadDict(' ', gs_bucket_path, self.strip_path) print result self.ass... | def LoadFilterFile(filter_file): """Load a file with keywords on a perline basis. Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) global FILTER_PACKAGES FILTER_PACKAGES = [filter.strip() for filter in filter_fh.readlines()] return FILTER_PACKAGES |
Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) global FILTER_PACKAGES FILTER_PACKAGES = [filter.strip() for filter in filter_fh.readlines()] return FILTER_PACKAGES def FilterPackage(file_path): """Skip a particular file if it matches a pattern. Skip any files that machine the ... | def LoadFilterFile(filter_file): """Load a file with keywords on a perline basis. Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) global FILTER_PACKAGES FILTER_PACKAGES = [filter.strip() for filter in filter_fh.readlines()] return FILTER_PACKAGES | |
main() | unittest.main() | def main(): parser = optparse.OptionParser() parser.add_option('-b', '--board', dest='board', default=None, help='Board type that was built on this machine') parser.add_option('-p', '--build-path', dest='build_path', help='Path to the chroot') parser.add_option('-s', '--sync-host', dest='sync_host', default=False, acti... |
percent_passed = self.VerifyImage(42) | percent_passed = self.VerifyImage(10) | def testFullUpdateKeepStateful(self): """Tests if we can update normally. |
def NotestFullUpdateWipeStateful(self): | def testFullUpdateWipeStateful(self): | def NotestFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
percent_passed = self.VerifyImage(42) | percent_passed = self.VerifyImage(10) | def NotestFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
print ('\n========== DEBUG FILE %s FOR TEST %s ==============\n' % ( path, test)) print fh.read() print('\n=========== END DEBUG %s FOR TEST %s ===============\n' % ( path, test)) | print >> sys.stderr, ( '\n========== DEBUG FILE %s FOR TEST %s ==============\n' % ( path, test)) out = fh.read() while out: print >> sys.stderr, out out = fh.read() print >> sys.stderr, ( '\n=========== END DEBUG %s FOR TEST %s ===============\n' % ( path, test)) | def _GenerateReportText(self): """Prints a result report to stdout. |
output = RunCommand(['%s/cros_run_vm_test' % self.crosutilsbin, '--image_path=%s' % self.vm_image_path, '--snapshot', '--persist', vm_graphics_flag, '--kvm_pid=%s' % _KVM_PID_FILE, '--test_case=%s' % _VERIFY_SUITE, ], error_ok=True, enter_chroot=False, redirect_stdout=True) | commandWithArgs = ['%s/cros_run_vm_test' % self.crosutilsbin, '--image_path=%s' % self.vm_image_path, '--snapshot', '--persist', '--kvm_pid=%s' % _KVM_PID_FILE, _VERIFY_SUITE, ] if vm_graphics_flag: commandWithArgs.append(vm_graphics_flag) output = RunCommand(commandWithArgs, error_ok=True, enter_chroot=False, redire... | def VerifyImage(self, percent_required_to_pass): """Runs vm smoke suite to verify image.""" # image_to_live already verifies lsb-release matching. This is just # for additional steps. output = RunCommand(['%s/cros_run_vm_test' % self.crosutilsbin, '--image_path=%s' % self.vm_image_path, '--snapshot', '--persist', vm_g... |
def NotVerifyImage(self): | def VerifyImage(self): | def NotVerifyImage(self): """Verifies an image using run_remote_tests.sh with verification suite.""" RunCommand([ '%s/run_remote_tests.sh' % self.crosutils, '--remote=%s' % remote, _VERIFY_SUITE, ], error_ok=False, enter_chroot=False) |
unittest.TextTestRunner(verbosity=2).run(suite) | return_code = unittest.TextTestRunner(verbosity=2).run(suite) | def VerifyImage(self): """Runs vm smoke suite to verify image.""" # image_to_live already verifies lsb-release matching. This is just # for additional steps. RunCommand(['%s/cros_run_vm_test' % self.crosutilsbin, '--image_path=%s' % self.vm_image_path, '--snapshot', '--persist', '--kvm_pid=%s' % _KVM_PID_FILE, '--test... |
Die('Found multiple unstable ebuilds in %s' % root) | Die('Found multiple unstable ebuilds in %s' % os.path.dirname(path)) | def _FindStableEBuilds(files): """Return a list of stable ebuilds from specified list of files. Args: files: List of files. """ workon_dir = False stable_ebuilds = [] unstable_ebuilds = [] for path in files: if path.endswith('.ebuild') and not os.path.islink(path): ebuild = _EBuild(path) if ebuild.is_workon: workon_di... |
Warning('Found multiple stable ebuilds in %s' % root) | Warning('Found multiple stable ebuilds in %s' % os.path.dirname(path)) | def _FindStableEBuilds(files): """Return a list of stable ebuilds from specified list of files. Args: files: List of files. """ workon_dir = False stable_ebuilds = [] unstable_ebuilds = [] for path in files: if path.endswith('.ebuild') and not os.path.islink(path): ebuild = _EBuild(path) if ebuild.is_workon: workon_di... |
Die('Missing 9999 ebuild in %s' % root) | Die('Missing 9999 ebuild in %s' % os.path.dirname(path)) | def _FindStableEBuilds(files): """Return a list of stable ebuilds from specified list of files. Args: files: List of files. """ workon_dir = False stable_ebuilds = [] unstable_ebuilds = [] for path in files: if path.endswith('.ebuild') and not os.path.islink(path): ebuild = _EBuild(path) if ebuild.is_workon: workon_di... |
Die('Missing stable ebuild in %s' % root) | Die('Missing stable ebuild in %s' % os.path.dirname(path)) | def _FindStableEBuilds(files): """Return a list of stable ebuilds from specified list of files. Args: files: List of files. """ workon_dir = False stable_ebuilds = [] unstable_ebuilds = [] for path in files: if path.endswith('.ebuild') and not os.path.islink(path): ebuild = _EBuild(path) if ebuild.is_workon: workon_di... |
for root_dir, dirs, files in os.walk(overlay): | for package_dir, dirs, files in os.walk(overlay): | def _BuildEBuildDictionary(overlays, all, packages): """Build a dictionary of the ebuilds in the specified overlays. overlays: A map which maps overlay directories to arrays of stable EBuilds inside said directories. all: Whether to include all ebuilds in the specified directories. If true, then we gather all packages... |
paths = [os.path.join(root_dir, path) for path in files] | paths = [os.path.join(package_dir, path) for path in files] | def _BuildEBuildDictionary(overlays, all, packages): """Build a dictionary of the ebuilds in the specified overlays. overlays: A map which maps overlay directories to arrays of stable EBuilds inside said directories. all: Whether to include all ebuilds in the specified directories. If true, then we gather all packages... |
def RevEBuild(self, commit_id="", redirect_file=None): | def RevEBuild(self, commit_id='', redirect_file=None): | def RevEBuild(self, commit_id="", redirect_file=None): """Revs an ebuild given the git commit id. |
redirect_file.write(line.replace("~", "")) | redirect_file.write(line.replace('~', '')) | def RevEBuild(self, commit_id="", redirect_file=None): """Revs an ebuild given the git commit id. |
if 0 == RunCommand(diff_cmd, exit_code=True, print_cmd=gflags.FLAGS.verbose): | if 0 == RunCommand(diff_cmd, exit_code=True, redirect_stdout=True, redirect_stderr=True, print_cmd=gflags.FLAGS.verbose): | def RevEBuild(self, commit_id="", redirect_file=None): """Revs an ebuild given the git commit id. |
all = gflags.FLAGS.all | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() _CheckSaneArguments(package_list, command) overlays = { '%s/private-overlays/... | |
_BuildEBuildDictionary(overlays, all, package_list) | _BuildEBuildDictionary(overlays, gflags.FLAGS.all, package_list) | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() _CheckSaneArguments(package_list, command) overlays = { '%s/private-overlays/... |
if not _CheckOnStabilizingBranch(): work_branch = _GitBranch(_STABLE_BRANCH_NAME) work_branch.CreateBranch() if not work_branch.Exists(): Die('Unable to create stabilizing branch in %s' % overlay) | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() _CheckSaneArguments(package_list, command) overlays = { '%s/private-overlays/... | |
for package in repo_dictionary[repo_name]: revisions[package] = revision_tuple[1] | if repo_dictionary.has_key(repo_name): for package in repo_dictionary[repo_name]: revisions[package] = revision_tuple[1] | def _ParseRevisionString(revision_string, repo_dictionary): """Parses the given revision_string into a revision dictionary. Returns a list of tuples that contain [portage_package_name, commit_id] to update. Keyword arguments: revision_string -- revision_string with format 'repo1.git@commit_1 repo2.git@commit2 ...'. r... |
def __init__(self, tests): | def __init__(self, tests, results_dir_root=None): """Constructs and initializes the test runner class. Args: tests: A list of test names (see run_remote_tests.sh). results_dir_root: The results directory root. If provided, the results directory root for each test will be created under it with the SSH port appended to ... | def __init__(self, tests): self._tests = tests |
Arguments: | Args: | def _WaitForCompletion(self, spawned_tests): """Waits for tests to complete and returns a list of failed tests. |
runner = ParallelTestRunner(args) | runner = ParallelTestRunner(args, options.results_dir_root) | def main(): usage = 'Usage: %prog [options] tests...' parser = optparse.OptionParser(usage=usage) (options, args) = parser.parse_args() if not args: parser.print_help() Die('no tests provided') runner = ParallelTestRunner(args) runner.Run() |
cros_mark_as_stable._SimpleRunCommand('git remote update') | cros_mark_as_stable._SimpleRunCommand('repo sync .') | def testPushChange(self): git_log = 'Marking test_one as stable\nMarking test_two as stable\n' fake_description = 'Marking set of ebuilds as stable\n\n%s' % git_log self.mox.StubOutWithMock(cros_mark_as_stable, '_CheckOnStabilizingBranch') self.mox.StubOutWithMock(cros_mark_as_stable.GitBranch, 'CreateBranch') self.mox... |
url_suffix = '%s/%s' % (_GS_HOST_PATH, version) | url_suffix = '%s/%s/' % (_GS_HOST_PATH, version) | def UploadPrebuilt(build_path, bucket, version, board=None, git_sync=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. bucket: The Google Storage bucket to upload to. board: The board to upload to Google Storage, if this is None upload host packages. g... |
remote_path = urlparse.urljoin(base_remote_path, suffix) | remote_path = '%s/%s' % (base_remote_path.rstrip('/'), suffix) | def GenerateUploadDict(base_local_path, base_remote_path, pkgs): """Build a dictionary of local remote file key pairs to upload. Args: base_local_path: The base path to the files on the local hard drive. remote_path: The base path to the remote paths. pkgs: The packages to upload. Returns: Returns a dictionary of loc... |
remote_location = urlparse.urljoin(upload_location, url_suffix) | remote_location = '%s/%s' % (upload_location.rstrip('/'), url_suffix) | def UploadPrebuilt(build_path, upload_location, version, binhost_base_url, board=None, git_sync=False, git_sync_retries=5, key='PORTAGE_BINHOST', pkg_indexes=[], sync_binhost_conf=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. upload_location: The u... |
remote_file = urlparse.urljoin(remote_location, 'Packages') | remote_file = '%s/Packages' % remote_location.rstrip('/') | def UploadPrebuilt(build_path, upload_location, version, binhost_base_url, board=None, git_sync=False, git_sync_retries=5, key='PORTAGE_BINHOST', pkg_indexes=[], sync_binhost_conf=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. upload_location: The u... |
if options.debug: | if not options.debug: | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
m_file.write('CROS_WORKON_COMMIT="my_id"') | m_file.write('CROS_WORKON_COMMIT="my_id"\n') | def testRevEBuild(self): self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') m_file = self.mox.CreateMock(file) |
make_stable=False) | make_stable=mark_stable) | def MarkChromeEBuildAsStable(stable_candidate, unstable_ebuild, chrome_rev, chrome_version, commit, overlay_dir, sticky_ebuild): """Uprevs the chrome ebuild specified by chrome_rev. This is the main function that uprevs the chrome_rev from a stable candidate to its new version. Args: stable_candidate: ebuild that cor... |
unittest.main() | main(sys.argv) | def testTotMarkAsStable(self): """Tests to see if we can mark chrome for tot.""" self._CommonMarkAsStableTest(cros_mark_chrome_as_stable.TIP_OF_TRUNK, self.tot_new_version, self.tot_stable, self.tot_new, 'tot') |
self.mox.StubOutWithMock(cbuildbot, '_CreateRepoDictionary') self.mox.StubOutWithMock(cbuildbot, '_ParseRevisionString') self.mox.StubOutWithMock(cbuildbot, '_UprevFromRevisionList') | def testUprevPackages(self): self.mox.StubOutWithMock(cbuildbot, '_CreateRepoDictionary') self.mox.StubOutWithMock(cbuildbot, '_ParseRevisionString') self.mox.StubOutWithMock(cbuildbot, '_UprevFromRevisionList') self.mox.StubOutWithMock(__builtin__, 'open') | |
cbuildbot._CreateRepoDictionary(self._buildroot, self._test_board).AndReturn(self._test_dict) cbuildbot._ParseRevisionString(self._test_string, self._test_dict).AndReturn( self._test_parsed_string_array) cbuildbot._UprevFromRevisionList(self._buildroot, self._test_parsed_string_array) | cbuildbot.RunCommand(['./cros_mark_all_as_stable', '--tracking_branch="cros/master"'], cwd='%s/src/scripts' % self._buildroot, enter_chroot=True) self.mox.ReplayAll() cbuildbot._UprevPackages(self._buildroot, self._revision_file, self._test_board) self.mox.VerifyAll() def testUprevAllPackages(self): """Test if we get... | def testUprevPackages(self): self.mox.StubOutWithMock(cbuildbot, '_CreateRepoDictionary') self.mox.StubOutWithMock(cbuildbot, '_ParseRevisionString') self.mox.StubOutWithMock(cbuildbot, '_UprevFromRevisionList') self.mox.StubOutWithMock(__builtin__, 'open') |
self.vm_image_path = ('%s/chromiumos_qemu_image.bin' % os.path.dirname( base_image_path)) | self.vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( base_image_path) | def PrepareBase(self): """Creates an update-able VM based on base image.""" |
Info('Qemu image not found, creating one.') | Info('Qemu image %s not found, creating one.' % self.vm_image_path) | def PrepareBase(self): """Creates an update-able VM based on base image.""" |
Info('Using existing VM image') | Info('Using existing VM image %s' % self.vm_image_path) | def PrepareBase(self): """Creates an update-able VM based on base image.""" |
if options.quick_test: _VERIFY_SUITE = 'build_RootFilesystemSize' | def VerifyImage(self, percent_required_to_pass): """Runs vm smoke suite to verify image.""" # image_to_live already verifies lsb-release matching. This is just # for additional steps. output = RunCommand(['%s/cros_run_vm_test' % self.crosutilsbin, '--image_path=%s' % self.vm_image_path, '--snapshot', '--persist', vm_g... | |
def setUp(self): self.utf8 = "<?xml version='1.0' encoding='UTF-8'?>\n" self.tiny_manifest = '<manifest>\n</manifest>' | def setUp(self): self.utf8 = "<?xml version='1.0' encoding='UTF-8'?>\n" self.tiny_manifest = '<manifest>\n</manifest>' | |
def testSimpleParse(self): ptree = loman.LocalManifest() ptree.Parse() | class LocalManifest: """Class which provides an abstraction for manipulating the local manifest.""" | def testSimpleParse(self): ptree = loman.LocalManifest() ptree.Parse() |
def testParse(self): ptree = loman.LocalManifest(self.tiny_manifest) ptree.Parse() self.assertEqual(ptree.ToString(), self.utf8 + self.tiny_manifest) | def __init__(self, text=None): self._text = text or '<manifest>\n</manifest>' | def testParse(self): ptree = loman.LocalManifest(self.tiny_manifest) ptree.Parse() self.assertEqual(ptree.ToString(), self.utf8 + self.tiny_manifest) |
def testUTF8Parse(self): ptree = loman.LocalManifest(self.utf8 + self.tiny_manifest) ptree.Parse() self.assertEqual(ptree.ToString(), self.utf8 + self.tiny_manifest) | def Parse(self): """Parse the manifest.""" self._root = ElementTree.fromstring(self._text) | def testUTF8Parse(self): ptree = loman.LocalManifest(self.utf8 + self.tiny_manifest) ptree.Parse() self.assertEqual(ptree.ToString(), self.utf8 + self.tiny_manifest) |
def testAddNew(self): ptree = loman.LocalManifest('<manifest>\n</manifest>') ptree.Parse() self.assertTrue(ptree.AddWorkonProject('foo', 'path/to/foo')) self.assertEqual( ptree.ToString(), self.utf8 + '<manifest>\n' '<project name="foo" path="path/to/foo" workon="True" />\n' '</manifest>') | def AddWorkonProject(self, name, path): """Add a new workon project if it is not already in the manifest. | def testAddNew(self): ptree = loman.LocalManifest('<manifest>\n</manifest>') ptree.Parse() self.assertTrue(ptree.AddWorkonProject('foo', 'path/to/foo')) self.assertEqual( ptree.ToString(), self.utf8 + '<manifest>\n' '<project name="foo" path="path/to/foo" workon="True" />\n' '</manifest>') |
def testAddDup(self): ptree = loman.LocalManifest('<manifest>\n</manifest>') ptree.Parse() ptree.AddWorkonProject('foo', 'path/to/foo') self.assertTrue(not ptree.AddWorkonProject('foo', 'path/to/foo')) self.assertTrue(not ptree.AddWorkonProject('foo', 'path/foo')) self.assertTrue(not ptree.AddWorkonProject('foobar', 'p... | Returns: True on success. """ | def testAddDup(self): ptree = loman.LocalManifest('<manifest>\n</manifest>') ptree.Parse() ptree.AddWorkonProject('foo', 'path/to/foo') self.assertTrue(not ptree.AddWorkonProject('foo', 'path/to/foo')) self.assertTrue(not ptree.AddWorkonProject('foo', 'path/foo')) self.assertTrue(not ptree.AddWorkonProject('foobar', 'p... |
class MainTest(unittest.TestCase): | for project in self._root.findall('project'): if project.attrib['path'] == path or project.attrib['name'] == name: return False self._AddProject(name, path, workon='True') return True | def testAddDup(self): ptree = loman.LocalManifest('<manifest>\n</manifest>') ptree.Parse() ptree.AddWorkonProject('foo', 'path/to/foo') self.assertTrue(not ptree.AddWorkonProject('foo', 'path/to/foo')) self.assertTrue(not ptree.AddWorkonProject('foo', 'path/foo')) self.assertTrue(not ptree.AddWorkonProject('foobar', 'p... |
def setUp(self): self.utf8 = "<?xml version='1.0' encoding='UTF-8'?>\n" self.tiny_manifest = '<manifest>\n</manifest>' self.stderr = sys.stderr sys.stderr = StringIO.StringIO() | def _AddProject(self, name, path, workon='False'): element = ElementTree.Element('project', name=name, path=path, workon=workon) element.tail = '\n' self._root.append(element) | def setUp(self): self.utf8 = "<?xml version='1.0' encoding='UTF-8'?>\n" self.tiny_manifest = '<manifest>\n</manifest>' self.stderr = sys.stderr sys.stderr = StringIO.StringIO() |
def tearDown(self): sys.stderr = self.stderr | def ToString(self): return ElementTree.tostring(self._root, encoding='UTF-8') | def tearDown(self): sys.stderr = self.stderr |
def testNotEnoughArgs(self): err_msg = 'Not enough arguments\n' self.assertRaises(SystemExit, loman.main, ['loman']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) | def testNotEnoughArgs(self): err_msg = 'Not enough arguments\n' self.assertRaises(SystemExit, loman.main, ['loman']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) | |
def testNotWorkon(self): err_msg = 'Adding of non-workon projects is currently unsupported.\n' self.assertRaises(SystemExit, loman.main, ['loman', 'add', 'foo', 'path']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) | def main(argv): usage = 'usage: %prog add [options] <name> <path>' parser = optparse.OptionParser(usage=usage) parser.add_option('-w', '--workon', action='store_true', dest='workon', default=False, help='Is this a workon package?') parser.add_option('-f', '--file', dest='manifest', help='Non-default manifest file to re... | def testNotWorkon(self): err_msg = 'Adding of non-workon projects is currently unsupported.\n' self.assertRaises(SystemExit, loman.main, ['loman', 'add', 'foo', 'path']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) |
def testBadCommand(self): err_msg = 'Unsupported command: bad.\n' self.assertRaises(SystemExit, loman.main, ['loman', 'bad', 'foo', 'path']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) def testSimpleAdd(self): temp = tempfile.NamedTemporaryFile('w') print >> temp, '<manifest>\n</manifest>' temp.flush() os... | repo_dir = _FindRepoDir() if not repo_dir: Die("Unable to find repo dir.") local_manifest = options.manifest or \ os.path.join(_FindRepoDir(), 'local_manifest.xml') if os.path.isfile(local_manifest): ptree = LocalManifest(open(local_manifest).read()) else: ptree = LocalManifest() ptree.Parse() if not ptree.AddWorkonPro... | def testBadCommand(self): err_msg = 'Unsupported command: bad.\n' self.assertRaises(SystemExit, loman.main, ['loman', 'bad', 'foo', 'path']) self.assertTrue(sys.stderr.getvalue().endswith(err_msg)) |
unittest.main() | main(sys.argv) | def testAddDup(self): temp = tempfile.NamedTemporaryFile('w') print >> temp, '<manifest>\n</manifest>' temp.flush() os.fsync(temp.fileno()) loman.main(['loman', 'add', '--workon', '-f', temp.name, 'foo', 'path/to/foo']) self.assertRaises(SystemExit, loman.main, ['loman', 'add', '--workon', '-f', temp.name, 'foo', 'path... |
_UploadPrebuilts(buildroot, board, buildconfig['rev_overlays'], [new_binhost]) | if not options.debug: _UploadPrebuilts(buildroot, board, buildconfig['rev_overlays'], [new_binhost]) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
if options.sync: _Build(buildroot, emptytree) | _Build(buildroot, emptytree) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-a', '--acl', default='private', help='ACL to set on GSD archives') parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option... |
if not os.path.isdir(path): | if command != 'clean' and not os.path.isdir(path): | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split(':') _CheckSaneArguments(package_list, command) if gflags.FLAGS.overlays: overla... |
'rsync -av %(pkg_index)s %(remote_location)s/Packages' % d] | 'rsync -av --chmod=a+r %(pkg_index)s %(remote_packages)s' % d] | def UploadPrebuilt(build_path, upload_location, version, binhost_base_url, board=None, git_sync=False, git_sync_retries=5, key='PORTAGE_BINHOST', pkg_indexes=[], sync_binhost_conf=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. upload_location: The u... |
equery_cmd = 'equery-%s which %s 2> /dev/null' \ % (gflags.FLAGS.board, package) | equery_cmd = ( 'ACCEPT_KEYWORDS="x86 arm amd64" equery-%s which %s 2> /dev/null' % (gflags.FLAGS.board, package)) | def _FindEBuildPath(cls, package): """Static method that returns the full path of an ebuild.""" _Print('Looking for unstable ebuild for %s' % package) equery_cmd = 'equery-%s which %s 2> /dev/null' \ % (gflags.FLAGS.board, package) path = _SimpleRunCommand(equery_cmd) if path: _Print('Unstable ebuild found at %s' % pat... |
], cwd=cwd, error_ok=True) | ], cwd=cwd, error_ok=False) | def _RunSmokeSuite(buildroot): cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['bin/cros_run_vm_test', '--no_graphics', '--test_case', 'suite_Smoke', ], cwd=cwd, error_ok=True) |
image_path=None, results_dir_root=None): | image_path=None, order_output=False, results_dir_root=None): | def __init__(self, tests, base_ssh_port=_DEFAULT_BASE_SSH_PORT, board=None, image_path=None, results_dir_root=None): """Constructs and initializes the test runner class. |
proc = subprocess.Popen(args, stdin=dev_null) | output = None if self._order_output: output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_') Info('Piping output to %s.' % output.name) proc = subprocess.Popen(args, stdin=dev_null, stdout=output, stderr=output) | def _SpawnTests(self): """Spawns VMs and starts the test runs on them. |
'proc': proc } | 'proc': proc, 'output': output } | def _SpawnTests(self): """Spawns VMs and starts the test runs on them. |
options.image_path, options.results_dir_root) | options.image_path, options.order_output, options.results_dir_root) | def main(): usage = 'Usage: %prog [options] tests...' parser = optparse.OptionParser(usage=usage) parser.add_option('--base_ssh_port', type='int', default=_DEFAULT_BASE_SSH_PORT, help='Base SSH port. Spawned VMs listen to localhost SSH ' 'ports incrementally allocated starting from the base one. ' '[default: %default]'... |
self.download_folder = os.path.join(self.crosutilsbin, 'latest_download') | self.download_folder = os.path.join(self.crosutils, 'latest_download') if not os.path.exists(self.download_folder): os.makedirs(self.download_folder) | def setUp(self): unittest.TestCase.setUp(self) # Set these up as they are used often. self.crosutils = os.path.join(os.path.dirname(__file__), '..') self.crosutilsbin = os.path.join(os.path.dirname(__file__)) self.download_folder = os.path.join(self.crosutilsbin, 'latest_download') |
def BuildStateful(self, src, dst): | def BuildStateful(self, src, dst_dir, dst_file): | def BuildStateful(self, src, dst): """Create a stateful partition update image.""" |
if self.GetCached(src, dst): self.Info('Using cached stateful %s' % dst) | if self.GetCached(src, dst_file): self.Info('Using cached stateful %s' % dst_file) | def BuildStateful(self, src, dst): """Create a stateful partition update image.""" |
cgpt = self.ChrootPath('/usr/bin/cgpt') offset = self.cmd.OutputOneLine(cgpt, 'show', '-b', '-i', '1', src) size = self.cmd.OutputOneLine(cgpt, 'show', '-s', '-i', '1', src) if None in (size, offset): self.Error('Unable to use cgpt to get image geometry') return False return self.cmd.RunPipe([['dd', 'if=%s' % src, 'bs... | return self.cmd.Run(self.CrosUtilsPath( 'cros_generate_stateful_update_payload'), '--image=%s' % src, '--output=%s' % dst_dir) | def BuildStateful(self, src, dst): """Create a stateful partition update image.""" |
not cros_env.BuildStateful(image_file, stateful_file)): | not cros_env.BuildStateful(image_file, image_directory, stateful_file)): | def main(argv): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('--board', dest='board', default=None, help='Board platform type') parser.add_option('--force-mismatch', dest='force_mismatch', default=False, action='store_true', help='Upgrade even if client arch does not ma... |
_SimpleRunCommand('git remote update') merge_branch = _GitBranch(merge_branch_name) merge_branch.CreateBranch() if not merge_branch.Exists(): Die('Unable to create merge branch.') _SimpleRunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) _SimpleRunCommand('git commit -m "%s"' % description) _SimpleRunCommand('g... | for push_try in range(num_retries + 1): try: _SimpleRunCommand('git remote update') merge_branch = _GitBranch(merge_branch_name) merge_branch.CreateBranch() if not merge_branch.Exists(): Die('Unable to create merge branch.') _SimpleRunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) _SimpleRunCommand('git commit ... | def _PushChange(): """Pushes changes to the git repository. Pushes locals commits from calls to CommitChange to the remote git repository specified by os.pwd. Raises: OSError: Error occurred while pushing. """ # TODO(sosa) - Add logic for buildbot to check whether other slaves have # completed and push this change o... |
capture=False, oneline=False): """Perform a command pipeline, with optional input/output filenames.""" | capture=False, oneline=False, hide_stderr=False): """ Perform a command pipeline, with optional input/output filenames. hide_stderr Don't allow output of stderr (default False) """ | def RunPipe(self, pipeline, infile=None, outfile=None, capture=False, oneline=False): """Perform a command pipeline, with optional input/output filenames.""" |
self.env.Info('Running: %s' % ' '.join(cmd)) | if hide_stderr: kwargs['stderr'] = open('/dev/null', 'wb') self.env.Debug('Running: %s' % ' '.join(cmd)) | def RunPipe(self, pipeline, infile=None, outfile=None, capture=False, oneline=False): """Perform a command pipeline, with optional input/output filenames.""" |
def __init__(self, verbose=False): | SILENT = 0 INFO = 1 DEBUG = 2 def __init__(self, verbose=SILENT): | def __init__(self, verbose=False): self.cros_root = os.path.dirname(os.path.abspath(sys.argv[0])) parent = os.path.dirname(self.cros_root) if os.path.exists(os.path.join(parent, 'chromeos-common.sh')): self.cros_root = parent self.cmd = Command(self) self.verbose = verbose |
if self.verbose: | if self.verbose >= CrosEnv.INFO: | def Info(self, msg): if self.verbose: print 'INFO: %s' % msg |
verbose=self.verbose)) | verbose=self.verbose, have_pv=self.have_pv)) | def CreateServer(self, port, update_file, stateful_file): """Start the devserver clone.""" |
print 'Client update completed successfully!' | self.Info('Client update completed successfully!') | def StartClient(self, port): """Ask the client machine to update from our server.""" |
handler.send_Error(404, 'File not found') | handler.send_error(404, 'File not found') | def Reply(self, handler, send_content=True, post_data=None): handler.send_Error(404, 'File not found') return None |
verbose=False, blocksize=16*1024): | verbose=False, blocksize=16*1024, have_pv=False): | def __init__(self, filename, content_type='application/octet-stream', verbose=False, blocksize=16*1024): self.filename = filename self.content_type = content_type self.verbose = verbose self.blocksize = blocksize |
if not send_content: return if filesize <= self.blocksize: handler.wfile.write(f.read()) else: | if send_content: | def Reply(self, handler, send_content=True, post_data=None): """Return file contents to the client. Optionally display progress.""" |
default=DEFAULT_IMAGE_NAME, | def main(argv): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('--board', dest='board', default=None, help='Board platform type') parser.add_option('--force-mismatch', dest='force_mismatch', default=False, action='store_true', help='Upgrade even if client arch does not ma... | |
cros_env = CrosEnv(verbose=options.verbose) | build_test_image = False verbosity = CrosEnv.SILENT if options.verbose: verbosity = CrosEnv.INFO if options.debug: verbosity = CrosEnv.DEBUG cros_env = CrosEnv(verbose=verbosity) | def main(argv): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('--board', dest='board', default=None, help='Board platform type') parser.add_option('--force-mismatch', dest='force_mismatch', default=False, action='store_true', help='Upgrade even if client arch does not ma... |
update_file = os.path.join(image_directory, UPDATE_FILENAME) stateful_file = os.path.join(image_directory, STATEFUL_FILENAME) | def main(argv): usage = 'usage: %prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('--board', dest='board', default=None, help='Board platform type') parser.add_option('--force-mismatch', dest='force_mismatch', default=False, action='store_true', help='Upgrade even if client arch does not ma... | |
'url.ssh://gitrw.chromium.org.pushinsteadof', | 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', | def _FullCheckout(buildroot): MakeDir(buildroot, parents=True) RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], cwd=buildroot, input='\n\ny\n') RunCommand(['repo', 'sync'], cwd=buildroot) RunCommand(['repo', 'forall', '-c', 'git', 'config', 'url.ssh://gitrw.chromium.org.pushinsteadof', 'http:/... |
dev_null = open('/dev/null') | def _SpawnTests(self): """Spawns VMs and starts the test runs on them. | |
proc = subprocess.Popen(args, stdin=dev_null, stdout=output, stderr=output) | proc = subprocess.Popen(args, stdout=output, stderr=output) | def _SpawnTests(self): """Spawns VMs and starts the test runs on them. |
RunCommand(['repo', '--trace', 'sync'], cwd=buildroot) | def RepoSync(buildroot, retries=_DEFAULT_RETRIES): """Uses repo to checkout the source code. Keyword arguments: retries -- Number of retries to try before failing on the sync. """ while retries > 0: try: # The --trace option ensures that repo shows the output from git. This # is needed so that the buildbot can kill us... | |
def _Build(buildroot): | def _Build(buildroot, emptytree): | def _Build(buildroot): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) |
RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) | cmd = ['./build_packages'] if emptytree: cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') RunCommand(cmd, cwd=cwd, enter_chroot=True) | def _Build(buildroot): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) |
if old_binhost and old_binhost != new_binhost: RunCommand(['sudo', 'rm', '-rf', boardpath]) | emptytree = (old_binhost and old_binhost != new_binhost) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
_Build(buildroot) | _Build(buildroot, emptytree) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
pid = RunCommand(['sudo', 'cat', pid_file], redirect_stdout=True, enter_chroot=False) if pid: RunCommand(['sudo', 'kill', pid.strip()], error_ok=True, enter_chroot=False) RunCommand(['sudo', 'rm', pid_file], enter_chroot=False) | RunCommand(['./cros_stop_vm', '--kvm_pid=%s' % pid_file], cwd=self.crosutilsbin) assert not os.path.exists(pid_file) | def _KillExistingVM(self, pid_file): if os.path.exists(pid_file): Warning('Existing %s found. Deleting and killing process' % pid_file) pid = RunCommand(['sudo', 'cat', pid_file], redirect_stdout=True, enter_chroot=False) if pid: RunCommand(['sudo', 'kill', pid.strip()], error_ok=True, enter_chroot=False) RunCommand([... |
def _PreFlightRinse(buildroot): """Cleans up any leftover state from previous runs.""" RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) _UprevCleanup(buildroot, error_ok=True) | def _PreFlightRinse(buildroot): """Cleans up any leftover state from previous runs.""" RunCommand(['sudo', 'killall', 'kvm'], error_ok=True) _UprevCleanup(buildroot, error_ok=True) | |
def _WipeOldOutput(buildroot): RunCommand(['rm', '-rf', 'src/build/images'], cwd=buildroot) | def _Build(buildroot): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./build_packages'], cwd=cwd, enter_chroot=True) | |
def _UprevCleanup(buildroot, error_ok=False): """Clean up after a previous uprev attempt.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./cros_mark_as_stable', '--srcroot=..', '--tracking_branch="cros/master"', 'clean'], cwd=cwd, error_ok=error_ok) | def _UprevPackages(buildroot, revisionfile, board): """Uprevs a package based on given revisionfile. If revisionfile is set to None or does not resolve to an actual file, this function will uprev all packages. Keyword arguments: revisionfile -- string specifying a file that contains a list of revisions to uprev. """ ... | |
if options.clobber: RunCommand(['sudo', 'rm', '-rf', buildroot]) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... | |
if not os.path.isdir(buildroot): | _PreFlightRinse(buildroot) if options.clobber or not os.path.isdir(buildroot): | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
_PreFlightRinse(buildroot) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... | |
_UprevCleanup(buildroot) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... | |
main() | try: main() except Exception: print "Got exception." traceback.print_exc(file=sys.stdout) | def main(): parser = optparse.OptionParser() parser.add_option('-b', '--board', help='board for the image to compare against.') parser.add_option('-c', '--channel', help='channel for the image to compare against.') parser.add_option('-l', '--latestbase', help='Base url for latest links.') parser.add_option('-z', '--zip... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.