Skip to content

Commit 1333186

Browse files
Merge #3960 and #3975
1 parent 3e9f2c6 commit 1333186

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

src/appengine/handlers/jobs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def get(self):
109109
bucket = local_config.ProjectConfig().get('custom_builds.bucket')
110110
if not bucket:
111111
bucket = storage.blobs_bucket()
112-
upload_info = gcs.prepare_upload(blobs.generate_new_blob_name())._asdict()
112+
upload_info = gcs.prepare_upload(bucket,
113+
blobs.generate_new_blob_name())._asdict()
113114

114115
return self.render(
115116
'jobs.html',

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ def fuzz(self, target_path, options, reproducers_dir, max_time):
7777
timeout=max_time,
7878
extra_env={
7979
'FUZZTEST_REPRODUCERS_OUT_DIR': reproducers_dir,
80-
})
80+
},
81+
# See https://buganizer.corp.google.com/issues/334956516
82+
additional_args=['--logtostderr', '--minloglevel=3'])
8183
log_lines = fuzz_result.output.splitlines()
8284

8385
crashes = []
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""Tests for googlefuzztest engine."""
15+
# pylint: disable=unused-argument
16+
import os
17+
import tempfile
18+
import unittest
19+
20+
from clusterfuzz._internal.bot.fuzzers import engine_common
21+
from clusterfuzz._internal.bot.fuzzers.googlefuzztest import engine
22+
from clusterfuzz._internal.system import new_process
23+
from clusterfuzz._internal.tests.test_libs import helpers
24+
25+
TEST_PATH = os.path.abspath(os.path.dirname(__file__))
26+
BINARY_NAME = "mock_binary"
27+
28+
29+
class GoogleFuzzTestUnitTests(unittest.TestCase):
30+
"""Tests to make sure the fuzzing engine correctly handles logging by passing correct abseil flags"""
31+
32+
def setUp(self):
33+
self.mock_temp = tempfile.TemporaryDirectory()
34+
self.mock_build = tempfile.TemporaryDirectory()
35+
self.mock_reproducers = tempfile.TemporaryDirectory()
36+
self.mock_binary = tempfile.TemporaryFile()
37+
38+
def tearDown(self):
39+
self.mock_temp.cleanup()
40+
self.mock_build.cleanup()
41+
self.mock_reproducers.cleanup()
42+
self.mock_binary.close()
43+
44+
def test_googlefuzztest_invoked_with_low_log_volume(self):
45+
"""Test if we call fuzztest with the correct abseil flags to reduce logging volume."""
46+
helpers.patch(self, [
47+
'clusterfuzz._internal.bot.fuzzers.engine_common.find_fuzzer_path',
48+
'clusterfuzz._internal.system.new_process.wait_process',
49+
'subprocess.Popen',
50+
])
51+
engine_impl = engine.Engine()
52+
53+
self.mock.find_fuzzer_path.return_value = self.mock_binary.name
54+
self.mock.wait_process.return_value = new_process.ProcessResult(output='')
55+
self.mock.Popen.return_value = None
56+
57+
target_path = engine_common.find_fuzzer_path(self.mock_build.name,
58+
BINARY_NAME)
59+
60+
options = engine_impl.prepare(None, self.mock_binary.name,
61+
self.mock_build.name)
62+
results = engine_impl.fuzz(target_path, options, self.mock_reproducers.name,
63+
10)
64+
65+
self.assertIn('--logtostderr', results.command)
66+
self.assertIn('--minloglevel=3', results.command)

0 commit comments

Comments
 (0)