upload android base code part3
This commit is contained in:
parent
71b83c22f1
commit
b9e30e05b1
15122 changed files with 2089659 additions and 0 deletions
94
android/bionic/tools/bionicbb/test_tasks.py
Normal file
94
android/bionic/tools/bionicbb/test_tasks.py
Normal file
|
@ -0,0 +1,94 @@
|
|||
import mock
|
||||
import unittest
|
||||
|
||||
import presubmit
|
||||
|
||||
|
||||
class TestShouldSkipBuild(unittest.TestCase):
|
||||
@mock.patch('presubmit.contains_bionicbb')
|
||||
@mock.patch('presubmit.contains_cleanspec')
|
||||
@mock.patch('gerrit.get_commit')
|
||||
def test_accepts_googlers(self, mock_commit, *other_checks):
|
||||
mock_commit.return_value = {
|
||||
'committer': {'email': 'googler@google.com'}
|
||||
}
|
||||
|
||||
for other_check in other_checks:
|
||||
other_check.return_value = False
|
||||
|
||||
for message_type in ('newchange', 'newpatchset', 'comment'):
|
||||
self.assertFalse(presubmit.should_skip_build({
|
||||
'MessageType': message_type,
|
||||
'Change-Id': '',
|
||||
'PatchSet': '',
|
||||
}))
|
||||
|
||||
@mock.patch('presubmit.contains_bionicbb')
|
||||
@mock.patch('presubmit.contains_cleanspec')
|
||||
@mock.patch('gerrit.get_commit')
|
||||
def test_rejects_googlish_domains(self, mock_commit, *other_checks):
|
||||
mock_commit.return_value = {
|
||||
'committer': {'email': 'fakegoogler@google.com.fake.com'}
|
||||
}
|
||||
|
||||
for other_check in other_checks:
|
||||
other_check.return_value = False
|
||||
|
||||
for message_type in ('newchange', 'newpatchset', 'comment'):
|
||||
self.assertTrue(presubmit.should_skip_build({
|
||||
'MessageType': message_type,
|
||||
'Change-Id': '',
|
||||
'PatchSet': '',
|
||||
}))
|
||||
|
||||
@mock.patch('presubmit.contains_bionicbb')
|
||||
@mock.patch('presubmit.contains_cleanspec')
|
||||
@mock.patch('gerrit.get_commit')
|
||||
def test_rejects_non_googlers(self, mock_commit, *other_checks):
|
||||
mock_commit.return_value = {
|
||||
'committer': {'email': 'johndoe@example.com'}
|
||||
}
|
||||
|
||||
for other_check in other_checks:
|
||||
other_check.return_value = False
|
||||
|
||||
for message_type in ('newchange', 'newpatchset', 'comment'):
|
||||
self.assertTrue(presubmit.should_skip_build({
|
||||
'MessageType': message_type,
|
||||
'Change-Id': '',
|
||||
'PatchSet': '',
|
||||
}))
|
||||
|
||||
@mock.patch('presubmit.contains_bionicbb')
|
||||
@mock.patch('presubmit.is_untrusted_committer')
|
||||
@mock.patch('gerrit.get_files_for_revision')
|
||||
def test_skips_cleanspecs(self, mock_files, *other_checks):
|
||||
mock_files.return_value = ['foo/CleanSpec.mk']
|
||||
for other_check in other_checks:
|
||||
other_check.return_value = False
|
||||
|
||||
for message_type in ('newchange', 'newpatchset', 'comment'):
|
||||
self.assertTrue(presubmit.should_skip_build({
|
||||
'MessageType': message_type,
|
||||
'Change-Id': '',
|
||||
'PatchSet': '',
|
||||
}))
|
||||
|
||||
@mock.patch('presubmit.contains_cleanspec')
|
||||
@mock.patch('presubmit.is_untrusted_committer')
|
||||
@mock.patch('gerrit.get_files_for_revision')
|
||||
def test_skips_bionicbb(self, mock_files, *other_checks):
|
||||
mock_files.return_value = ['tools/bionicbb/common.sh']
|
||||
for other_check in other_checks:
|
||||
other_check.return_value = False
|
||||
|
||||
for message_type in ('newchange', 'newpatchset', 'comment'):
|
||||
self.assertTrue(presubmit.should_skip_build({
|
||||
'MessageType': message_type,
|
||||
'Change-Id': '',
|
||||
'PatchSet': '',
|
||||
}))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Add table
Add a link
Reference in a new issue