Skip to content
Merged
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
5 changes: 1 addition & 4 deletions src/python/bot/tasks/fuzz_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,10 +1474,7 @@ def generate_blackbox_testcases(self, fuzzer, fuzzer_directory,
return error_occurred, None, None, None, None

# Build the fuzzer command execution string.
# TODO(mbarbella): Conditionally invoke with Python 2 depending on
# the fuzzer. At present, all were implemented to work with Python 2.
command = shell.get_execute_command(
fuzzer_executable, is_blackbox_fuzzer=True)
command = shell.get_execute_command(fuzzer_executable)

# NodeJS and shell script expect space seperator for arguments.
if command.startswith('node ') or command.startswith('sh '):
Expand Down
3 changes: 1 addition & 2 deletions src/python/bot/testcase_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,7 @@ def get_command_line_for_application(file_to_run='',
# have app_name == launcher. In this case don't prepend launcher to
# command - just use app_name.
if os.path.basename(launcher) != app_name:
launcher_with_interpreter = shell.get_execute_command(
launcher, is_blackbox_fuzzer=True)
launcher_with_interpreter = shell.get_execute_command(launcher)
command += launcher_with_interpreter + ' '
elif is_android:
# Android-specific testcase path fixup for fuzzers that don't rely on
Expand Down
2 changes: 1 addition & 1 deletion src/python/system/process_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def run_process(cmdline,
# If the process is still running, then terminate it.
if not process_status.finished:
launcher_with_interpreter = shell.get_execute_command(
launcher, is_blackbox_fuzzer=True) if launcher else None
launcher) if launcher else None
if (launcher_with_interpreter and
cmdline.startswith(launcher_with_interpreter)):
# If this was a launcher script, we KILL all child processes created
Expand Down
13 changes: 3 additions & 10 deletions src/python/system/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_free_disk_space(path='/'):
return psutil.disk_usage(path).free


def get_interpreter(file_to_execute, is_blackbox_fuzzer=False):
def get_interpreter(file_to_execute):
"""Gives the interpreter needed to execute |file_to_execute|."""
interpreters = {
'.bash': 'bash',
Expand All @@ -368,19 +368,12 @@ def get_interpreter(file_to_execute, is_blackbox_fuzzer=False):
except KeyError:
return None

# TODO(mbarbella): Remove this when fuzzers have been migrated to Python 3.
if (is_blackbox_fuzzer and interpreter == sys.executable and
environment.get_value('USE_PYTHON2_FOR_BLACKBOX_FUZZERS') and
sys.version_info.major == 3):
interpreter = 'python2'

return interpreter


def get_execute_command(file_to_execute, is_blackbox_fuzzer=False):
def get_execute_command(file_to_execute):
"""Return command to execute |file_to_execute|."""
interpreter_path = get_interpreter(
file_to_execute, is_blackbox_fuzzer=is_blackbox_fuzzer)
interpreter_path = get_interpreter(file_to_execute)

# Hack for Java scripts.
file_to_execute = file_to_execute.replace('.class', '')
Expand Down