1# Copyright 2020 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""This module contains a list of test repository's used in unit/integration 15tests. 16 17Note: If you notice tests failing for unexpected reasons, make sure the data 18in the test repos are correct. This is because the test repos are dynamic and 19may change. 20 21Note: This should be removed when a better method of testing is established. 22""" 23 24import collections 25import os 26 27ExampleRepo = collections.namedtuple('ExampleRepo', [ 28 'project_name', 'oss_repo_name', 'git_repo_name', 'image_location', 29 'git_url', 'new_commit', 'old_commit', 'intro_commit', 'fuzz_target', 30 'testcase_path' 31]) 32 33TEST_DIR_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 34 'testcases') 35 36# WARNING: Tests are dependent upon the following repos existing and the 37# specified commits existing. 38# TODO(metzman): Fix this problem. 39# TODO(metzman): The testcases got deleted here because the test that used them 40# was skipped. Probably worth deleting the test. 41TEST_REPOS = [ 42 ExampleRepo(project_name='curl', 43 oss_repo_name='curl', 44 git_repo_name='curl', 45 image_location='/src', 46 git_url='https://github.com/curl/curl.git', 47 old_commit='df26f5f9c36e19cd503c0e462e9f72ad37b84c82', 48 new_commit='dda418266c99ceab368d723facb52069cbb9c8d5', 49 intro_commit='df26f5f9c36e19cd503c0e462e9f72ad37b84c82', 50 fuzz_target='curl_fuzzer_ftp', 51 testcase_path=os.path.join(TEST_DIR_PATH, 'curl_test_data')), 52 ExampleRepo(project_name='libarchive', 53 oss_repo_name='libarchive', 54 git_repo_name='libarchive', 55 image_location='/src', 56 git_url='https://github.com/libarchive/libarchive.git', 57 old_commit='5bd2a9b6658a3a6efa20bb9ad75bd39a44d71da6', 58 new_commit='458e49358f17ec58d65ab1c45cf299baaf3c98d1', 59 intro_commit='840266712006de5e737f8052db920dfea2be4260', 60 fuzz_target='libarchive_fuzzer', 61 testcase_path=os.path.join(TEST_DIR_PATH, 62 'libarchive_test_data')), 63 ExampleRepo(project_name='gonids', 64 oss_repo_name='gonids', 65 git_repo_name='gonids', 66 image_location='/root/go/src/github.com/google/', 67 git_url='https://github.com/google/gonids', 68 old_commit='', 69 new_commit='', 70 intro_commit='', 71 fuzz_target='', 72 testcase_path='') 73] 74 75INVALID_REPO = ExampleRepo(project_name='notaproj', 76 oss_repo_name='notarepo', 77 git_repo_name='notarepo', 78 git_url='invalid.git', 79 image_location='/src', 80 old_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 81 new_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 82 intro_commit='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 83 fuzz_target='NONEFUZZER', 84 testcase_path='not/a/path') 85