Skip to content

Commit 77784e5

Browse files
run-new-oss-fuzz-project: add helper script for running a dir of targets (#877)
Signed-off-by: David Korczynski <[email protected]>
1 parent 97815e7 commit 77784e5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2025 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+
"""Module for running OFG on multiple new OSS-Fuzz projects. This module
15+
must be run from the base of OFG."""
16+
import os
17+
import shutil
18+
import subprocess
19+
import sys
20+
21+
source_dir = sys.argv[1]
22+
23+
TARGET_OSS_FUZZ = 'work/oss-fuzz'
24+
25+
projects_to_exec = ''
26+
for empty_oss_fuzz in os.listdir(source_dir):
27+
dst = os.path.join(TARGET_OSS_FUZZ, 'projects', empty_oss_fuzz)
28+
if os.path.isdir(dst):
29+
shutil.rmtree(dst)
30+
31+
shutil.copytree(os.path.join(source_dir, empty_oss_fuzz), dst)
32+
projects_to_exec += empty_oss_fuzz + ' '
33+
34+
# Launch the runner
35+
cmd = f'scripts/run-new-oss-fuzz-project/run-project.sh {projects_to_exec}'
36+
37+
# Call with shell to ensure we have the right environment.
38+
subprocess.check_call(cmd, shell=True)

0 commit comments

Comments
 (0)