aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--infra/bisector_test.py19
-rw-r--r--infra/build_specified_commit_test.py11
-rw-r--r--infra/repo_manager.py2
-rw-r--r--infra/test_repos.py11
4 files changed, 27 insertions, 16 deletions
diff --git a/infra/bisector_test.py b/infra/bisector_test.py
index 89d483e5..29904dd6 100644
--- a/infra/bisector_test.py
+++ b/infra/bisector_test.py
@@ -48,15 +48,16 @@ class BisectIntegrationTests(unittest.TestCase):
def test_bisect(self):
"""Test the bisect method on example projects."""
for test_repo in test_repos.TEST_REPOS:
- build_data = build_specified_commit.BuildData(
- project_name=test_repo.project_name,
- engine='libfuzzer',
- sanitizer='address',
- architecture='x86_64')
- error_sha = bisector.bisect(test_repo.old_commit, test_repo.new_commit,
- test_repo.test_case_path,
- test_repo.fuzz_target, build_data)
- self.assertEqual(error_sha, test_repo.intro_commit)
+ if test_repo.new_commit:
+ build_data = build_specified_commit.BuildData(
+ project_name=test_repo.project_name,
+ engine='libfuzzer',
+ sanitizer='address',
+ architecture='x86_64')
+ error_sha = bisector.bisect(test_repo.old_commit, test_repo.new_commit,
+ test_repo.test_case_path,
+ test_repo.fuzz_target, build_data)
+ self.assertEqual(error_sha, test_repo.intro_commit)
if __name__ == '__main__':
diff --git a/infra/build_specified_commit_test.py b/infra/build_specified_commit_test.py
index 808bcc21..13ca7b6e 100644
--- a/infra/build_specified_commit_test.py
+++ b/infra/build_specified_commit_test.py
@@ -69,11 +69,12 @@ class BuildImageIntegrationTests(unittest.TestCase):
def test_detect_main_repo_from_commit(self):
"""Test the detect main repo function from build specific commit module."""
for example_repo in test_repos.TEST_REPOS:
- repo_origin, repo_name = build_specified_commit.detect_main_repo(
- example_repo.project_name, commit=example_repo.new_commit)
- self.assertEqual(repo_origin, example_repo.git_url)
- self.assertEqual(repo_name,
- os.path.join('/src', example_repo.oss_repo_name))
+ if example_repo.new_commit:
+ repo_origin, repo_name = build_specified_commit.detect_main_repo(
+ example_repo.project_name, commit=example_repo.new_commit)
+ self.assertEqual(repo_origin, example_repo.git_url)
+ self.assertEqual(repo_name,
+ os.path.join('/src', example_repo.oss_repo_name))
repo_origin, repo_name = build_specified_commit.detect_main_repo(
test_repos.INVALID_REPO.project_name,
diff --git a/infra/repo_manager.py b/infra/repo_manager.py
index 53ac2df4..9910333e 100644
--- a/infra/repo_manager.py
+++ b/infra/repo_manager.py
@@ -50,7 +50,7 @@ class RepoManager:
if repo_name:
self.repo_name = repo_name
else:
- self.repo_name = os.path.basename(self.repo_url).strip('.git')
+ self.repo_name = os.path.basename(self.repo_url).replace('.git', '')
self.repo_dir = os.path.join(self.base_dir, self.repo_name)
self._clone()
diff --git a/infra/test_repos.py b/infra/test_repos.py
index 61003697..708c9595 100644
--- a/infra/test_repos.py
+++ b/infra/test_repos.py
@@ -63,7 +63,16 @@ TEST_REPOS = [
intro_commit='840266712006de5e737f8052db920dfea2be4260',
fuzz_target='libarchive_fuzzer',
test_case_path=os.path.join(TEST_DIR_PATH,
- 'libarchive_test_data'))
+ 'libarchive_test_data')),
+ ExampleRepo(project_name='gonids',
+ oss_repo_name='gonids',
+ git_repo_name='gonids',
+ git_url='https://github.com/google/gonids',
+ old_commit='',
+ new_commit='',
+ intro_commit='',
+ fuzz_target='',
+ test_case_path='')
]
INVALID_REPO = ExampleRepo(project_name='notaproj',