Exemple #1
0
def GetTestSubsystemForChange(build_root, change):
    """Get a list of subsystem that a given |change| affects.

  If subsystem is specified in the commit message, use that. Otherwise, look in
  appropriate COMMIT-QUEUE.ini. If subsystem is not specified anywhere,
  'subsystem:default' will be used.

  Based on the subsystems a given |change| affects, the CQ could tell whether a
  failure is potentially caused by this |change|. The CQ could then submit some
  changes in the face of unrelated failures.

  Args:
    build_root: The root of the checkout.
    change: Change to examine, as a PatchQuery object.

  Returns:
    A list of subsystem for the given |change|.
  """
    subsystems = []
    if change.commit_message:
        lines = cros_patch.GetOptionLinesFromCommitMessage(
            change.commit_message, 'subsystem:')
        if lines:
            subsystems = [x for x in re.split("[, ]", ' '.join(lines)) if x]
    if not subsystems:
        cq_config_parser = cq_config.CQConfigParser(build_root, change)
        subsystems = cq_config_parser.GetSubsystems()
    return subsystems if subsystems else ['default']
Exemple #2
0
 def testMultiOption(self):
   o = cros_patch.GetOptionLinesFromCommitMessage(self._M4, 'jabberwocky:')
   self.assertEqual(['O frabjuous day!', 'Calloh! Callay!'], o)
Exemple #3
0
 def testYesOption(self):
   o = cros_patch.GetOptionLinesFromCommitMessage(self._M2, 'jabberwocky:')
   self.assertEqual(['Charles Lutwidge Dodgson'], o)
Exemple #4
0
 def testEmptyOption(self):
   o = cros_patch.GetOptionLinesFromCommitMessage(self._M3, 'jabberwocky:')
   self.assertEqual([], o)
Exemple #5
0
 def testNoOption(self):
   o = cros_patch.GetOptionLinesFromCommitMessage(self._M1, 'jabberwocky:')
   self.assertEqual(None, o)