aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/test_repos.py
blob: 389876864b59e7ec46f76f8311c323c22f763e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This module contains a list of test repository's used in unit/integration
tests.

Note: If you notice tests failing for unexpected reasons, make sure the data
in the test repos are correct. This is because the test repos are dynamic and
may change.

Note: This should be removed when a better method of testing is established.
"""

import collections
import os

ExampleRepo = collections.namedtuple('ExampleRepo', [
    'project_name', 'oss_repo_name', 'git_repo_name', 'image_location',
    'git_url', 'new_commit', 'old_commit', 'intro_commit', 'fuzz_target',
    'testcase_path'
])

TEST_DIR_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'testcases')

# WARNING: Tests are dependent upon the following repos existing and the
# specified commits existing.
# TODO(metzman): Fix this problem.
# TODO(metzman): The testcases got deleted here because the test that used them
# was skipped. Probably worth deleting the test.
TEST_REPOS = [
    ExampleRepo(project_name='curl',
                oss_repo_name='curl',
                git_repo_name='curl',
                image_location='/src',
                git_url='https://github.com/curl/curl.git',
                old_commit='df26f5f9c36e19cd503c0e462e9f72ad37b84c82',
                new_commit='dda418266c99ceab368d723facb52069cbb9c8d5',
                intro_commit='df26f5f9c36e19cd503c0e462e9f72ad37b84c82',
                fuzz_target='curl_fuzzer_ftp',
                testcase_path=os.path.join(TEST_DIR_PATH, 'curl_test_data')),
    ExampleRepo(project_name='libarchive',
                oss_repo_name='libarchive',
                git_repo_name='libarchive',
                image_location='/src',
                git_url='https://github.com/libarchive/libarchive.git',
                old_commit='5bd2a9b6658a3a6efa20bb9ad75bd39a44d71da6',
                new_commit='458e49358f17ec58d65ab1c45cf299baaf3c98d1',
                intro_commit='840266712006de5e737f8052db920dfea2be4260',
                fuzz_target='libarchive_fuzzer',
                testcase_path=os.path.join(TEST_DIR_PATH,
                                           'libarchive_test_data')),
    ExampleRepo(project_name='gonids',
                oss_repo_name='gonids',
                git_repo_name='gonids',
                image_location='/root/go/src/github.com/google/',
                git_url='https://github.com/google/gonids',
                old_commit='',
                new_commit='',
                intro_commit='',
                fuzz_target='',
                testcase_path='')
]

INVALID_REPO = ExampleRepo(project_name='notaproj',
                           oss_repo_name='notarepo',
                           git_repo_name='notarepo',
                           git_url='invalid.git',
                           image_location='/src',
                           old_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                           new_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                           intro_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                           fuzz_target='NONEFUZZER',
                           testcase_path='not/a/path')