Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions configs/test/gce/windows-init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ $fileName = "$tmp\clusterfuzz.zip"
if ($env:USE_GCLOUD_STORAGE_CP -eq "1") {
gcloud storage cp gs://$deploymentBucket/windows-3.zip $fileName
} else {
gsutil cp gs://$deploymentBucket/windows-3.zip $fileName
gcloud storage cp gs://$deploymentBucket/windows-3.zip $fileName
}
unzip $fileName

Expand Down Expand Up @@ -314,4 +314,3 @@ Write-Host "Run scripts"
c:\autologin.bat
c:\PsExec.exe \\$hostName -accepteula -h -i 0 -username `""$domain\$username"`" -password `""$password"`" c:\startup.bat


2 changes: 1 addition & 1 deletion docker/base/setup_clusterfuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else
if [ "$USE_GCLOUD_STORAGE_CP" = "1" ]; then
gcloud storage cp gs://$DEPLOYMENT_BUCKET/$DEPLOYMENT_ZIP $CLUSTERFUZZ_FILE
else
gsutil cp gs://$DEPLOYMENT_BUCKET/$DEPLOYMENT_ZIP $CLUSTERFUZZ_FILE
gcloud storage cp gs://$DEPLOYMENT_BUCKET/$DEPLOYMENT_ZIP $CLUSTERFUZZ_FILE
fi
unzip -q -o $CLUSTERFUZZ_FILE
fi
Expand Down
53 changes: 25 additions & 28 deletions src/clusterfuzz/_internal/tests/core/fuzzing/corpus_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ def test_rsync_to_disk(self, _):
self.assertTrue(corpus.rsync_to_disk('/dir', timeout=60))

self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-o', 'GSUtil:parallel_thread_count=16',
'-q', 'rsync', '-r', '-d', 'gs://bucket/', '/dir'
'/gsutil_path/gcloud', 'storage', 'rsync', '--recursive',
'--delete-unmatched-destination-objects', 'gs://bucket/', '/dir'
])

self.mock.cpu_count.return_value = 2
corpus = corpus_manager.GcsCorpus('bucket')
self.assertTrue(corpus.rsync_to_disk('/dir', timeout=60))
self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-q', 'rsync', '-r', '-d', 'gs://bucket/',
'/dir'
'/gsutil_path/gcloud', 'storage', 'rsync', '--recursive',
'--delete-unmatched-destination-objects', 'gs://bucket/', '/dir'
])

def test_rsync_from_disk(self):
Expand All @@ -84,16 +84,16 @@ def test_rsync_from_disk(self):
self.assertTrue(corpus.rsync_from_disk('/dir'))

self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-o', 'GSUtil:parallel_thread_count=16',
'-q', 'rsync', '-r', '-d', '/dir', 'gs://bucket/'
'/gsutil_path/gcloud', 'storage', 'rsync', '--recursive',
'--delete-unmatched-destination-objects', '/dir', 'gs://bucket/'
])

self.mock.cpu_count.return_value = 2
corpus = corpus_manager.GcsCorpus('bucket')
self.assertTrue(corpus.rsync_from_disk('/dir'))
self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-q', 'rsync', '-r', '-d', '/dir',
'gs://bucket/'
'/gsutil_path/gcloud', 'storage', 'rsync', '--recursive',
'--delete-unmatched-destination-objects', '/dir', 'gs://bucket/'
])

def test_upload_files(self):
Expand All @@ -105,8 +105,8 @@ def test_upload_files(self):
self.assertTrue(corpus.upload_files(['/dir/a', '/dir/b']))

self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-o', 'GSUtil:parallel_thread_count=16',
'cp', '-I', 'gs://bucket/'
'/gsutil_path/gcloud', 'storage', 'cp', '--read-paths-from-stdin',
'gs://bucket/'
])

mock_popen.communicate.assert_called_with(b'/dir/a\n/dir/b')
Expand All @@ -115,7 +115,7 @@ def test_upload_files(self):
corpus = corpus_manager.GcsCorpus('bucket')
self.assertTrue(corpus.upload_files(['/dir/a', '/dir/b']))
self.assertEqual(self.mock.Popen.call_args[0][0],
['/gsutil_path/gsutil', '-m', 'cp', '-I', 'gs://bucket/'])
['/gsutil_path/gcloud', 'storage', 'cp', '--read-paths-from-stdin', 'gs://bucket/'])


class RsyncErrorHandlingTest(unittest.TestCase):
Expand Down Expand Up @@ -247,12 +247,11 @@ def test_rsync_to_disk(self):
corpus = corpus_manager.FuzzTargetCorpus('libFuzzer', 'fuzzer')
self.assertTrue(corpus.rsync_to_disk('/dir', timeout=60))
self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil',
'-m',
'-q',
'/gsutil_path/gcloud',
'storage',
'rsync',
'-r',
'-d',
'--recursive',
'--delete-unmatched-destination-objects',
'gs://bucket/libFuzzer/fuzzer/',
'/dir',
])
Expand All @@ -267,21 +266,19 @@ def test_rsync_to_disk_with_regressions(self):

self.assertEqual(commands, [
[
'/gsutil_path/gsutil',
'-m',
'-q',
'/gsutil_path/gcloud',
'storage',
'rsync',
'-r',
'-d',
'--recursive',
'--delete-unmatched-destination-objects',
'gs://bucket/libFuzzer/fuzzer/',
'/dir',
],
[
'/gsutil_path/gsutil',
'-m',
'-q',
'/gsutil_path/gcloud',
'storage',
'rsync',
'-r',
'--recursive',
'gs://bucket/libFuzzer/fuzzer_regressions/',
'/dir/regressions',
],
Expand All @@ -292,8 +289,8 @@ def test_rsync_from_disk(self):
corpus = corpus_manager.FuzzTargetCorpus('libFuzzer', 'fuzzer')
self.assertTrue(corpus.rsync_from_disk('/dir'))
self.assertEqual(self.mock.Popen.call_args_list[0][0][0], [
'/gsutil_path/gsutil', '-m', '-q', 'rsync', '-r', '-d', '/dir',
'gs://bucket/libFuzzer/fuzzer/'
'/gsutil_path/gcloud', 'storage', 'rsync', '--recursive', '--delete-unmatched-destination-objects',
'/dir', 'gs://bucket/libFuzzer/fuzzer/'
])

def test_upload_files(self):
Expand All @@ -305,7 +302,7 @@ def test_upload_files(self):
mock_popen.communicate.assert_called_with(b'/dir/a\n/dir/b')

self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', 'cp', '-I', 'gs://bucket/libFuzzer/fuzzer/'
'/gsutil_path/gcloud', 'storage', 'cp', '--read-paths-from-stdin', 'gs://bucket/libFuzzer/fuzzer/'
])


Expand Down