Fix permission denied errors on CI in unittests (#4664)

Also remove usrstcp from the repos we do tests since they no longer work with usrstcp (repo history seems to have been rewritten).
This commit is contained in:
jonathanmetzman 2020-11-20 10:39:19 -08:00 committed by GitHub
parent a28d03be6e
commit ee7031c4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 26 deletions

View File

@ -21,18 +21,18 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip sudo env "PATH=$PATH" python -m pip install --upgrade pip
pip install -r infra/ci/requirements.txt sudo env "PATH=$PATH" pip install -r infra/ci/requirements.txt
pip install -r infra/build/functions/requirements.txt sudo env "PATH=$PATH" pip install -r infra/build/functions/requirements.txt
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with: with:
version: '298.0.0' version: '298.0.0'
- run: | - run: |
gcloud components install beta cloud-datastore-emulator sudo env "PATH=$PATH" gcloud components install beta cloud-datastore-emulator
gcloud info sudo env "PATH=$PATH" gcloud info
- name: Run infra tests - name: Run infra tests
run: python infra/presubmit.py infra-tests run: sudo env "PATH=$PATH" python infra/presubmit.py infra-tests

View File

@ -41,9 +41,8 @@ class BuildImageIntegrationTests(unittest.TestCase):
The old commit should show the error when its fuzzers run and the new one The old commit should show the error when its fuzzers run and the new one
should not. should not.
""" """
with tempfile.TemporaryDirectory() as tmp_dir: with tempfile.TemporaryDirectory() as tmp_dir:
test_case = test_repos.TEST_REPOS[0] test_case = test_repos.TEST_REPOS[1]
self.assertTrue(helper.build_image_impl(test_case.project_name)) self.assertTrue(helper.build_image_impl(test_case.project_name))
host_src_dir = build_specified_commit.copy_src_from_docker( host_src_dir = build_specified_commit.copy_src_from_docker(
test_case.project_name, tmp_dir) test_case.project_name, tmp_dir)
@ -74,10 +73,7 @@ class BuildImageIntegrationTests(unittest.TestCase):
"""Test the detect main repo function from build specific commit module.""" """Test the detect main repo function from build specific commit module."""
# TODO(metzman): Fix these tests so they don't randomly break because of # TODO(metzman): Fix these tests so they don't randomly break because of
# changes in the outside world. # changes in the outside world.
test_repos_list = [ for example_repo in test_repos.TEST_REPOS:
repo for repo in test_repos.TEST_REPOS if repo.project_name != 'usrsctp'
]
for example_repo in test_repos_list:
if example_repo.new_commit: if example_repo.new_commit:
# TODO(metzman): This function calls _build_image_with_retries which # TODO(metzman): This function calls _build_image_with_retries which
# has a long delay (30 seconds). Figure out how to make this quicker. # has a long delay (30 seconds). Figure out how to make this quicker.
@ -111,7 +107,6 @@ class BuildImageIntegrationTests(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
# Change to oss-fuzz main directory so helper.py runs correctly. # Change to oss-fuzz main directory so helper.py runs correctly.
if os.getcwd() != os.path.dirname(TEST_DIR_PATH): if os.getcwd() != os.path.dirname(TEST_DIR_PATH):
os.chdir(os.path.dirname(TEST_DIR_PATH)) os.chdir(os.path.dirname(TEST_DIR_PATH))

View File

@ -33,21 +33,10 @@ ExampleRepo = collections.namedtuple('ExampleRepo', [
TEST_DIR_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), TEST_DIR_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'testcases') 'testcases')
# WARNING: These tests are dependent upon the following repos existing and # WARNING: Tests are dependent upon the following repos existing and the
# the specified commits existing. # specified commits existing.
# TODO(metzman): Fix this problem. # TODO(metzman): Fix this problem.
TEST_REPOS = [ TEST_REPOS = [
ExampleRepo(project_name='usrsctp',
oss_repo_name='usrsctp',
git_repo_name='usrsctp',
image_location='/src',
git_url='https://github.com/sctplab/usrsctp',
old_commit='4886aaa49fb90e479226fcfc3241d74208908232',
new_commit='c710749b1053978179a027973a3ea3bccf20ee5c',
intro_commit='457d6ead58e82584d9dcb826f6739347f59ebd3a',
fuzz_target='fuzzer_connect',
test_case_path=os.path.join(TEST_DIR_PATH,
'usrsctp_test_data')),
ExampleRepo(project_name='curl', ExampleRepo(project_name='curl',
oss_repo_name='curl', oss_repo_name='curl',
git_repo_name='curl', git_repo_name='curl',