Skip to content

Commit

Permalink
Remove untrusted_runner code from setup.
Browse files Browse the repository at this point in the history
It's not used anymore.
  • Loading branch information
jonathanmetzman committed Dec 23, 2024
1 parent a8aafb7 commit f64d2d5
Showing 1 changed file with 3 additions and 49 deletions.
52 changes: 3 additions & 49 deletions src/clusterfuzz/_internal/bot/tasks/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ def setup_testcase(testcase: data_types.Testcase, job_type: str,
if environment.is_android():
_copy_testcase_to_device_and_setup_environment(testcase, testcase_file_path)

# Push testcases to worker.
if take_trusted_host_path():
from clusterfuzz._internal.bot.untrusted_runner import file_host
file_host.push_testcases_to_worker()

# Copy global blacklist into local blacklist.
if setup_input.global_blacklisted_functions:
# Get local blacklist without this testcase's entry.
Expand Down Expand Up @@ -467,12 +462,6 @@ def _prepare_update_data_bundle(fuzzer, data_bundle):
return data_bundle_directory


def take_trusted_host_path():
if environment.is_uworker():
return False
return environment.is_trusted_host()


def update_data_bundle(
fuzzer: data_types.Fuzzer,
data_bundle_corpus: uworker_msg_pb2.DataBundleCorpus) -> bool: # pylint: disable=no-member
Expand All @@ -491,26 +480,9 @@ def update_data_bundle(
# case, the fuzzer will generate testcases from a gcs bucket periodically.
if not _is_search_index_data_bundle(data_bundle.name):

if not (take_trusted_host_path() and data_bundle.sync_to_worker):
logs.info('Data bundles: normal path.')
result = corpus_manager.sync_data_bundle_corpus_to_disk(
data_bundle_corpus, data_bundle_directory)
else:
logs.info('Data bundles: untrusted runner path.')
from clusterfuzz._internal.bot.untrusted_runner import \
corpus_manager as untrusted_corpus_manager
from clusterfuzz._internal.bot.untrusted_runner import file_host
worker_data_bundle_directory = file_host.rebase_to_worker_root(
data_bundle_directory)

file_host.create_directory(
worker_data_bundle_directory, create_intermediates=True)
result = untrusted_corpus_manager.RemoteGSUtilRunner().rsync(
data_bundle_corpus.gcs_url,
worker_data_bundle_directory,
delete=False)
result = result.return_code == 0

logs.info('Data bundles: normal path.')
result = corpus_manager.sync_data_bundle_corpus_to_disk(
data_bundle_corpus, data_bundle_directory)
if not result:
logs.error(f'Failed to sync data bundle {data_bundle.name}.')
return False
Expand All @@ -522,11 +494,6 @@ def update_data_bundle(
# Write last synced time in the sync file.
sync_file_path = _get_data_bundle_sync_file_path(data_bundle_directory)
utils.write_data_to_file(time_before_sync_start, sync_file_path)
if take_trusted_host_path() and data_bundle.sync_to_worker:
from clusterfuzz._internal.bot.untrusted_runner import file_host
worker_sync_file_path = file_host.rebase_to_worker_root(sync_file_path)
file_host.copy_file_to_worker(sync_file_path, worker_sync_file_path)

return True


Expand Down Expand Up @@ -697,13 +664,6 @@ def update_fuzzer_and_data_bundles(

# For launcher script usecase, we need the entire fuzzer directory on the
# worker.
if take_trusted_host_path():
from clusterfuzz._internal.bot.untrusted_runner import file_host
worker_fuzzer_directory = file_host.rebase_to_worker_root(
fuzzer_directory)
file_host.copy_directory_to_worker(
fuzzer_directory, worker_fuzzer_directory, replace=True)

return fuzzer


Expand All @@ -717,12 +677,6 @@ def _is_data_bundle_up_to_date(data_bundle, data_bundle_directory):
"""Return true if the data bundle is up to date, false otherwise."""
sync_file_path = _get_data_bundle_sync_file_path(data_bundle_directory)

if take_trusted_host_path() and data_bundle.sync_to_worker:
from clusterfuzz._internal.bot.untrusted_runner import file_host
worker_sync_file_path = file_host.rebase_to_worker_root(sync_file_path)
shell.remove_file(sync_file_path)
file_host.copy_file_from_worker(worker_sync_file_path, sync_file_path)

if not os.path.exists(sync_file_path):
return False

Expand Down

0 comments on commit f64d2d5

Please sign in to comment.