Skip to content

Commit 7a27d77

Browse files
authored
Merge branch 'master' into test_remove_fluentd
2 parents 07490b9 + 7e1ff72 commit 7a27d77

File tree

12 files changed

+97
-72
lines changed

12 files changed

+97
-72
lines changed

.github/workflows/staleness.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Close stale issues and PRs"
2+
3+
permissions: read-all
4+
5+
on:
6+
schedule:
7+
- cron: "0 * * * *"
8+
9+
jobs:
10+
stale:
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
17+
with:
18+
days-before-stale: 60
19+
days-before-close: 14
20+
operations-per-run: 100
21+
remove-stale-when-updated: true
22+
exempt-issue-labels: "good first issue,backlog"
23+
exempt-all-assignees: true
24+
ignore-updates: false
25+
stale-issue-label: stale
26+
stale-issue-message: |
27+
This issue has not had any activity for 60 days and will be automatically closed in two weeks
28+
stale-pr-label: stale
29+
stale-pr-message: |
30+
This pull request has not had any activity for 60 days and will be automatically closed in two weeks
31+
close-issue-label: "autoclosed"
32+
close-issue-message: |
33+
Automatically closing stale issue
34+
close-pr-label: "autoclosed"
35+
close-pr-message: |
36+
Automatically closing stale pull request

src/appengine/handlers/upload_testcase.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,9 @@ def do_post(self):
392392
trusted_agreement_signed = request.get(
393393
'trustedAgreement') == TRUSTED_AGREEMENT_TEXT.strip()
394394

395-
if (not trusted_agreement_signed and
395+
# Chrome is the only ClusterFuzz deployment where there are trusted bots running utasks.
396+
# This check also fails on oss-fuzz because of the way it abuses platform.
397+
if (not trusted_agreement_signed and utils.is_chromium() and
396398
task_utils.is_remotely_executing_utasks() and
397399
((platform_id and platform_id != 'Linux') or
398400
job.platform.lower() != 'linux')):

src/clusterfuzz/_internal/bot/fuzzers/centipede/engine.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@ def fuzz(self, target_path, options, reproducers_dir, max_time): # pylint: disa
313313
'actual_duration': actual_duration,
314314
'fuzzing_time_percent': fuzzing_time_percent,
315315
})
316+
fuzz_time_secs_avg = stats.get('FuzzTimeSec_Avg', 1.0)
317+
if fuzz_time_secs_avg == 0.0:
318+
fuzz_time_secs_avg = 1.0
319+
num_execs_avg = stats.get('NumExecs_Avg', 0.0)
320+
stats['average_exec_per_sec'] = num_execs_avg / fuzz_time_secs_avg
316321
stats.update(_parse_centipede_logs(log_lines))
317322
return engine.FuzzResult(fuzz_result.output, fuzz_result.command, crashes,
318323
stats, fuzz_result.time_executed)

src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/fuzzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_arguments(fuzzer_path) -> options.FuzzerArguments:
4242
rss_limit_mb = arguments.get('rss_limit_mb', constructor=int)
4343
timeout = arguments.get('timeout', constructor=int)
4444

45-
if timeout is None or timeout > constants.DEFAULT_TIMEOUT_LIMIT:
45+
if timeout is None:
4646
arguments[constants.TIMEOUT_FLAGNAME] = constants.DEFAULT_TIMEOUT_LIMIT
4747

4848
if not rss_limit_mb and (utils.is_chromium() or

src/clusterfuzz/_internal/bot/tasks/utasks/minimize_task.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,9 @@ def do_js_minimization(test_function, get_temp_file, data, deadline, threads,
13701370

13711371

13721372
def _run_libfuzzer_testcase(fuzz_target,
1373-
testcase,
1374-
testcase_file_path,
1375-
crash_retries=1):
1373+
testcase: data_types.Testcase,
1374+
testcase_file_path: str,
1375+
crash_retries: int = 1) -> CrashResult:
13761376
"""Run libFuzzer testcase, and return the CrashResult."""
13771377
# Cleanup any existing application instances and temp directories.
13781378
process_handler.cleanup_stale_processes()
@@ -1429,8 +1429,16 @@ def _run_libfuzzer_tool(
14291429
expected_crash_state: str,
14301430
minimize_task_input: uworker_msg_pb2.MinimizeTaskInput, # pylint: disable=no-member
14311431
fuzz_target: Optional[data_types.FuzzTarget],
1432-
set_dedup_flags: bool = False):
1433-
"""Run libFuzzer tool to either minimize or cleanse."""
1432+
set_dedup_flags: bool = False
1433+
) -> tuple[str, CrashResult, str] | tuple[None, None, None]:
1434+
"""Run libFuzzer tool to either minimize or cleanse.
1435+
1436+
Returns (None, None, None) in case of failure.
1437+
Otherwise sets `testcase.minimized_keys` and returns:
1438+
1439+
(testcase_file_path, crash_result, minimized_keys)
1440+
1441+
"""
14341442
memory_tool_options_var = environment.get_current_memory_tool_var()
14351443
saved_memory_tool_options = environment.get_value(memory_tool_options_var)
14361444

@@ -1565,8 +1573,6 @@ def do_libfuzzer_minimization(
15651573
"""Use libFuzzer's built-in minimizer where appropriate."""
15661574
timeout = environment.get_value('LIBFUZZER_MINIMIZATION_TIMEOUT', 600)
15671575
rounds = environment.get_value('LIBFUZZER_MINIMIZATION_ROUNDS', 5)
1568-
current_testcase_path = testcase_file_path
1569-
last_crash_result = None
15701576

15711577
# Get initial crash state.
15721578
initial_crash_result = _run_libfuzzer_testcase(
@@ -1637,7 +1643,10 @@ def do_libfuzzer_minimization(
16371643
if env:
16381644
testcase.set_metadata('env', env, False)
16391645

1640-
minimized_keys = None
1646+
current_testcase_path = testcase_file_path
1647+
last_crash_result = None
1648+
last_minimized_keys = None
1649+
16411650
# We attempt minimization multiple times in case one round results in an
16421651
# incorrect state, or runs into another issue such as a slow unit.
16431652
for round_number in range(1, rounds + 1):
@@ -1653,6 +1662,7 @@ def do_libfuzzer_minimization(
16531662
set_dedup_flags=True)
16541663
if output_file_path:
16551664
last_crash_result = crash_result
1665+
last_minimized_keys = minimized_keys
16561666
current_testcase_path = output_file_path
16571667

16581668
if not last_crash_result:
@@ -1663,8 +1673,8 @@ def do_libfuzzer_minimization(
16631673
minimize_task_output = uworker_msg_pb2.MinimizeTaskOutput( # pylint: disable=no-member
16641674
last_crash_result_dict=crash_result_dict,
16651675
memory_tool_options=memory_tool_options)
1666-
if minimized_keys:
1667-
minimize_task_output.minimized_keys = str(minimized_keys)
1676+
if last_minimized_keys:
1677+
minimize_task_output.minimized_keys = str(last_minimized_keys)
16681678
return uworker_msg_pb2.Output( # pylint: disable=no-member
16691679
error_type=uworker_msg_pb2.ErrorType.LIBFUZZER_MINIMIZATION_FAILED, # pylint: disable=no-member
16701680
minimize_task_output=minimize_task_output)
@@ -1673,7 +1683,7 @@ def do_libfuzzer_minimization(
16731683

16741684
if utils.is_oss_fuzz():
16751685
# Scrub the testcase of non-essential data.
1676-
cleansed_testcase_path, minimized_keys = do_libfuzzer_cleanse(
1686+
cleansed_testcase_path, last_minimized_keys = do_libfuzzer_cleanse(
16771687
fuzz_target, testcase, current_testcase_path,
16781688
expected_state.crash_state, minimize_task_input)
16791689
if cleansed_testcase_path:
@@ -1690,8 +1700,8 @@ def do_libfuzzer_minimization(
16901700
minimize_task_output = uworker_msg_pb2.MinimizeTaskOutput( # pylint: disable=no-member
16911701
last_crash_result_dict=last_crash_result_dict,
16921702
memory_tool_options=memory_tool_options)
1693-
if minimized_keys:
1694-
minimize_task_output.minimized_keys = str(minimized_keys)
1703+
if last_minimized_keys:
1704+
minimize_task_output.minimized_keys = str(last_minimized_keys)
16951705
return uworker_msg_pb2.Output(minimize_task_output=minimize_task_output) # pylint: disable=no-member
16961706

16971707

src/clusterfuzz/_internal/bot/testcase_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,10 @@ def _get_crash_state(self, round_number: int,
673673
return state
674674

675675
def reproduce_with_retries(self,
676-
retries,
677-
expected_state=None,
678-
expected_security_flag=None,
679-
flaky_stacktrace=False):
676+
retries: int,
677+
expected_state: CrashInfo | None = None,
678+
expected_security_flag: bool | None = None,
679+
flaky_stacktrace: bool = False) -> CrashResult:
680680
"""Try reproducing a crash with retries."""
681681
self._pre_run_cleanup()
682682
crash_result = None
@@ -775,7 +775,7 @@ def test_for_crash_with_retries(fuzz_target,
775775
http_flag=False,
776776
use_gestures=True,
777777
compare_crash=True,
778-
crash_retries=None):
778+
crash_retries=None) -> CrashResult:
779779
"""Test for a crash and return crash parameters like crash type, crash state,
780780
crash stacktrace, etc."""
781781
logs.info('Testing for crash.')

src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ def get_attachment(self, resource_name):
11461146

11471147
def find_issues(self, keywords=None, only_open=None):
11481148
"""Finds issues."""
1149-
return self.find_issues_with_filters(keywords, only_open)
1149+
return self.find_issues_with_filters(keywords=keywords, only_open=only_open)
11501150

11511151
def find_issues_with_filters(self,
11521152
keywords=None,

src/clusterfuzz/_internal/metrics/fuzzer_stats_schema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,10 @@
851851
'mode': 'NULLABLE',
852852
'name': 'fuzzing_time_percent',
853853
'type': 'FLOAT'
854+
}, {
855+
'mode': 'NULLABLE',
856+
'name': 'average_exec_per_sec',
857+
'type': 'FLOAT'
854858
}] + _COMMON_COLUMNS
855859

856860
_SCHEMA = {

src/local/butler/deploy.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from local.butler import common
3030
from local.butler import constants
3131
from local.butler import package
32-
from local.butler import py_unittest
3332
from src.clusterfuzz._internal.base import utils
3433
from src.clusterfuzz._internal.config import local_config
3534
from src.clusterfuzz._internal.system import environment
@@ -458,14 +457,6 @@ def _is_safe_deploy_day():
458457
return day_now_in_ny not in {4, 5, 6} # The days of the week are 0-indexed.
459458

460459

461-
def _enforce_tests_pass():
462-
config = local_config.Config()
463-
if not config.get('project.enforce_tests_before_deploy', False):
464-
return
465-
py_unittest.run_tests(target='core', parallel=True)
466-
py_unittest.run_tests(target='appengine', parallel=True)
467-
468-
469460
def _enforce_safe_day_to_deploy():
470461
"""Checks that is not an unsafe day (Friday, Saturday, or Sunday) to
471462
deploy for chrome ClusterFuzz."""
@@ -530,7 +521,6 @@ def execute(args):
530521
print('gsutil not found in PATH.')
531522
sys.exit(1)
532523

533-
_enforce_tests_pass()
534524
_enforce_safe_day_to_deploy()
535525

536526
# Build templates before deployment.

src/local/butler/package.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from local.butler import appengine
2222
from local.butler import common
2323
from local.butler import constants
24-
from local.butler import py_unittest
2524
from src.clusterfuzz._internal.base import utils
2625

2726
MIN_SUPPORTED_NODEJS_VERSION = 4
@@ -84,8 +83,6 @@ def package(revision,
8483
print('You do not have nodejs, or your nodejs is not at least version 4.')
8584
sys.exit(1)
8685

87-
py_unittest.execute(args={})
88-
8986
common.install_dependencies(platform_name=platform_name)
9087

9188
# This needs to be done before packaging step to let src/appengine/config be

0 commit comments

Comments
 (0)