aboutsummaryrefslogtreecommitdiff
path: root/infra
diff options
context:
space:
mode:
authorjonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2021-03-17 10:21:49 -0700
committerGitHub <noreply@github.com>2021-03-17 10:21:49 -0700
commit62fce2a587b5d0eff941c392b343edfc68eb4069 (patch)
tree1785ee75bae18192147b5159a5d0ba2e0dbf7445 /infra
parent8038398cb96db472378ccf06aacbf0aa4473b3c3 (diff)
downloadoss-fuzz-62fce2a587b5d0eff941c392b343edfc68eb4069.tar.gz
[CIFuzz] Give testcases unique names. (#5424)
Diffstat (limited to 'infra')
-rw-r--r--infra/cifuzz/run_fuzzers.py3
-rw-r--r--infra/cifuzz/run_fuzzers_test.py9
2 files changed, 7 insertions, 5 deletions
diff --git a/infra/cifuzz/run_fuzzers.py b/infra/cifuzz/run_fuzzers.py
index 419a5169f..d00109e3e 100644
--- a/infra/cifuzz/run_fuzzers.py
+++ b/infra/cifuzz/run_fuzzers.py
@@ -150,7 +150,8 @@ class BaseFuzzTargetRunner:
(target.target_name.encode(), result.stacktrace))
# TODO(metzman): Do this with filestore.
- testcase_artifact_path = self.get_fuzz_target_artifact(target, 'testcase')
+ testcase_artifact_path = self.get_fuzz_target_artifact(
+ target, os.path.basename(result.testcase))
shutil.move(result.testcase, testcase_artifact_path)
bug_summary_artifact_path = self.get_fuzz_target_artifact(
target, 'bug-summary.txt')
diff --git a/infra/cifuzz/run_fuzzers_test.py b/infra/cifuzz/run_fuzzers_test.py
index 1f9255920..f524b8942 100644
--- a/infra/cifuzz/run_fuzzers_test.py
+++ b/infra/cifuzz/run_fuzzers_test.py
@@ -280,7 +280,7 @@ class BatchFuzzTargetRunnerTest(fake_filesystem_unittest.TestCase):
def test_run_fuzz_targets_quits(self, mocked_create_fuzz_target_obj,
mocked_run_fuzz_target,
mocked_get_fuzz_targets):
- """Tests that run_fuzz_targets quits on the first crash it finds."""
+ """Tests that run_fuzz_targets doesn't quit on the first crash it finds."""
workspace = 'workspace'
out_path = os.path.join(workspace, 'out')
self.fs.create_dir(out_path)
@@ -291,8 +291,8 @@ class BatchFuzzTargetRunnerTest(fake_filesystem_unittest.TestCase):
mocked_get_fuzz_targets.return_value = ['target1', 'target2']
runner.initialize()
- testcase1 = os.path.join(workspace, 'testcase1')
- testcase2 = os.path.join(workspace, 'testcase2')
+ testcase1 = os.path.join(workspace, 'testcase-aaa')
+ testcase2 = os.path.join(workspace, 'testcase-bbb')
self.fs.create_file(testcase1)
self.fs.create_file(testcase2)
stacktrace = b'stacktrace'
@@ -313,7 +313,8 @@ class BatchFuzzTargetRunnerTest(fake_filesystem_unittest.TestCase):
magic_mock.target_name = 'target1'
mocked_create_fuzz_target_obj.return_value = magic_mock
self.assertTrue(runner.run_fuzz_targets())
- self.assertIn('target1-address-testcase', os.listdir(runner.artifacts_dir))
+ self.assertIn('target1-address-testcase-aaa',
+ os.listdir(runner.artifacts_dir))
self.assertEqual(mocked_run_fuzz_target.call_count, 2)