Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: tools/ipc_fuzzer/scripts/utils.py

Issue 2109853002: [IPC fuzzer] Properly generate clusterfuzz flags files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/ipc_fuzzer/scripts/ipc_fuzzer_mut.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utility functions used by Generational and Mutational ClusterFuzz 6 """Utility functions used by Generational and Mutational ClusterFuzz
7 fuzzers.""" 7 fuzzers."""
8 8
9 import argparse 9 import argparse
10 import os 10 import os
(...skipping 15 matching lines...) Expand all
26 '--renderer-cmd-prefix', 26 '--renderer-cmd-prefix',
27 '--utility-cmd-prefix', 27 '--utility-cmd-prefix',
28 ] 28 ]
29 29
30 def application_name_for_platform(application_name): 30 def application_name_for_platform(application_name):
31 """Return application name for current platform.""" 31 """Return application name for current platform."""
32 if platform() == 'WINDOWS': 32 if platform() == 'WINDOWS':
33 return application_name + '.exe' 33 return application_name + '.exe'
34 return application_name 34 return application_name
35 35
36 def create_flags_file(ipcdump_testcase_path, ipc_replay_application_path): 36 def create_flags_file(ipcdump_testcase_path):
37 """Create a flags file to add launch prefix to application command line.""" 37 """Create a flags file to add launch prefix to application command line."""
38 random_launch_prefix = random.choice(LAUNCH_PREFIXES) 38 random_launch_prefix = random.choice(LAUNCH_PREFIXES)
39 file_content = '%s=%s' % (random_launch_prefix, ipc_replay_application_path) 39 application_name = application_name_for_platform(IPC_REPLAY_APPLICATION)
40 file_content = '%s=%%APP_DIR%%%s%s' % (random_launch_prefix,
41 os.path.sep,
42 application_name)
40 43
41 flags_file_path = ipcdump_testcase_path.replace(FUZZ_PREFIX, FLAGS_PREFIX) 44 flags_file_path = ipcdump_testcase_path.replace(FUZZ_PREFIX, FLAGS_PREFIX)
42 file_handle = open(flags_file_path, 'w') 45 file_handle = open(flags_file_path, 'w')
43 file_handle.write(file_content) 46 file_handle.write(file_content)
44 file_handle.close() 47 file_handle.close()
45 48
46 def create_temp_file(): 49 def create_temp_file():
47 """Create a temporary file.""" 50 """Create a temporary file."""
48 temp_file = tempfile.NamedTemporaryFile(delete=False) 51 temp_file = tempfile.NamedTemporaryFile(delete=False)
49 temp_file.close() 52 temp_file.close()
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 96
94 assert False, 'Unknown platform' 97 assert False, 'Unknown platform'
95 98
96 def get_application_path(): 99 def get_application_path():
97 """Return chrome application path.""" 100 """Return chrome application path."""
98 if APP_PATH_KEY not in os.environ: 101 if APP_PATH_KEY not in os.environ:
99 sys.exit( 102 sys.exit(
100 'Environment variable %s should be set to chrome path.' % APP_PATH_KEY) 103 'Environment variable %s should be set to chrome path.' % APP_PATH_KEY)
101 104
102 return os.environ[APP_PATH_KEY] 105 return os.environ[APP_PATH_KEY]
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/scripts/ipc_fuzzer_mut.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698