Skip to content

Commit 79779ba

Browse files
authored
Merge branch 'master' into feat/parallel-base-image-builds
2 parents 3c5df94 + 3de6704 commit 79779ba

File tree

12 files changed

+49
-29
lines changed

12 files changed

+49
-29
lines changed

infra/base-images/base-builder/indexer/clang_wrapper.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
_INDEXER_THREADS_PER_MERGE_QUEUE = 16
6969
_INDEXER_PER_THREAD_MEMORY = 2 * 1024**3 # 2 GiB
7070

71+
_CDB_FRAGMENT_DELIMITER = ",\n"
72+
7173
SRC = Path(os.getenv("SRC", "/src"))
7274
# On OSS-Fuzz build infra, $OUT is not /out.
7375
OUT = Path(os.getenv("OUT", "/out"))
@@ -177,13 +179,13 @@ def files_by_creation_time(folder_path: Path) -> Sequence[Path]:
177179
return files
178180

179181

180-
def _wait_for_cdb_fragment(file: Path) -> str | None:
182+
def _wait_for_cdb_fragment(file: Path) -> Sequence[str]:
181183
"""Returns the CDB fragment from the given file, waiting if needed."""
182184
num_retries = 3
183185
for i in range(1 + num_retries):
184186
data = file.read_text()
185-
if data.endswith(",\n"):
186-
return data.rstrip().rstrip(",")
187+
if data.endswith(_CDB_FRAGMENT_DELIMITER):
188+
return data.split(_CDB_FRAGMENT_DELIMITER)[:-1]
187189

188190
if i < num_retries:
189191
print(
@@ -202,7 +204,7 @@ def _wait_for_cdb_fragment(file: Path) -> str | None:
202204
else:
203205
raise RuntimeError(error)
204206

205-
return None
207+
return ()
206208

207209

208210
def read_cdb_fragments(cdb_path: Path) -> Any:
@@ -216,11 +218,10 @@ def read_cdb_fragments(cdb_path: Path) -> Any:
216218
if not file.name.endswith(".json"):
217219
continue
218220

219-
fragment = _wait_for_cdb_fragment(file)
220-
if fragment:
221-
contents.append(fragment)
221+
fragments = _wait_for_cdb_fragment(file)
222+
contents.extend(fragments)
222223

223-
contents = ",\n".join(contents)
224+
contents = _CDB_FRAGMENT_DELIMITER.join(contents)
224225
contents = "[" + contents + "]"
225226
return json.loads(contents)
226227

@@ -514,15 +515,13 @@ def load_cdbs(directory: Path) -> Iterator[tuple[Path, dict[str, Any]]]:
514515
if file.name.endswith("_linker_commands.json"):
515516
continue
516517

517-
fragment_data = _wait_for_cdb_fragment(file)
518-
if not fragment_data:
519-
continue
520-
521-
fragment = json.loads(fragment_data)
522-
if "output" not in fragment:
523-
continue
518+
fragments_data = _wait_for_cdb_fragment(file)
519+
for fragment_data in fragments_data:
520+
fragment = json.loads(fragment_data)
521+
if "output" not in fragment:
522+
continue
524523

525-
yield file, fragment
524+
yield file, fragment
526525

527526
# We could be running multiple linking steps in parallel, so serialize merges.
528527
with _file_lock(merged_cdb_path / ".lock"):

infra/base-images/base-builder/indexer/clang_wrapper_test.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,26 @@ def test_merge_incremental_cdb(self):
9090
}
9191

9292
new_cdb_fragments = {
93-
"test.c.aaa.json": {
93+
"test.c.aaa.json": [{
9494
"directory": "/build/subdir",
9595
"file": "test.c",
9696
"output": "test.o",
9797
"arguments": ["-c", "test.c"],
98-
},
98+
}],
99+
"bar.c.bbb.json": [
100+
{
101+
"directory": "/build/subdir",
102+
"file": "bar.c",
103+
"output": "bar.o",
104+
"arguments": ["-c", "bar.c"],
105+
},
106+
{
107+
"directory": "/build/subdir",
108+
"file": "bar2.c",
109+
"output": "bar2.o",
110+
"arguments": ["-c", "bar2.c"],
111+
},
112+
],
99113
}
100114

101115
for cdb_fragment_path, cdb_fragment in old_cdb_fragments.items():
@@ -110,7 +124,7 @@ def test_merge_incremental_cdb(self):
110124

111125
for cdb_fragment_path, cdb_fragment in new_cdb_fragments.items():
112126
(cdb_path / cdb_fragment_path).write_text(
113-
json.dumps(cdb_fragment) + ",\n"
127+
",\n".join([json.dumps(frag) for frag in cdb_fragment]) + ",\n"
114128
)
115129

116130
(cdb_path / "not_a_json").write_text("not a json")
@@ -125,6 +139,7 @@ def test_merge_incremental_cdb(self):
125139
pathlib.Path(merged_cdb_path) / "test.c.aaa.json",
126140
pathlib.Path(merged_cdb_path) / "foo.c.455.json",
127141
pathlib.Path(merged_cdb_path) / "foo.123_linker_commands.json",
142+
pathlib.Path(merged_cdb_path) / "bar.c.bbb.json",
128143
],
129144
)
130145

infra/base-images/base-runner/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ RUN /install_javascript.sh && rm /install_javascript.sh
112112
# Copy built ruby and ruzzy from builder
113113
COPY --from=base-ruby /usr/local/rvm /usr/local/rvm
114114
COPY --from=base-ruby /install/ruzzy /install/ruzzy
115-
COPY ruzzy /usr/bin/ruzzy
115+
COPY ruzzy /usr/local/bin/ruzzy
116116
ENV PATH="$PATH:/usr/local/rvm/rubies/ruby-3.3.1/bin"
117117
# RubyGems installation directory
118118
ENV GEM_HOME="$OUT/fuzz-gem"

projects/abseil-py/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
################################################################################
17-
python3 setup.py install
17+
python3 -m pip install .
1818
cd ../
1919
mkdir fuzzbuilds
2020
cd fuzzbuilds

projects/cmake/project.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ sanitizers:
1111
# - memory
1212

1313
fuzzing_engines:
14-
- afl
1514
- honggfuzz
1615
- libfuzzer
1716

projects/glslang/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $SRC/compile_fuzzer.cc \
3030
-I/src/glslang/glslang/Include/ -I/src/glslang/glslang/.. \
3131
-I/src/glslang/build/include -I/src/glslang/SPIRV/.. \
3232
./glslang/libglslang.a ./SPIRV/libSPIRV.a \
33-
./glslang/libglslang-default-resource-limits.a ./SPIRV/libSPVRemapper.a \
33+
./glslang/libglslang-default-resource-limits.a \
3434
-lpthread ./glslang/libMachineIndependent.a \
3535
./glslang/OSDependent/Unix/libOSDependent.a \
3636
./glslang/libGenericCodeGen.a \

projects/jbig2dec/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ RUN apt-get update && apt-get install -y make libtool pkg-config vim libreadline
1919
RUN git clone --recursive --depth 1 git://git.ghostscript.com/jbig2dec.git jbig2dec
2020
RUN mkdir tests
2121
RUN cp $SRC/jbig2dec/annex-h.jbig2 tests/annex-h.jb2
22-
RUN cd tests && wget -O t89-halftone.zip http://cgit.ghostscript.com/cgi-bin/cgit.cgi/tests.git/plain/jbig2/t89-halftone.zip && unzip t89-halftone.zip
23-
RUN cd tests && wget -O jb2streams.zip http://cgit.ghostscript.com/cgi-bin/cgit.cgi/tests.git/plain/jbig2/jb2streams.zip && unzip jb2streams.zip
22+
RUN cd tests && (wget -O t89-halftone.zip http://cgit.ghostscript.com/cgi-bin/cgit.cgi/tests.git/plain/jbig2/t89-halftone.zip && unzip t89-halftone.zip) || true
23+
RUN cd tests && (wget -O jb2streams.zip http://cgit.ghostscript.com/cgi-bin/cgit.cgi/tests.git/plain/jbig2/jb2streams.zip && unzip jb2streams.zip) || true
2424
RUN cd tests && zip -q $SRC/jbig2_fuzzer_seed_corpus.zip *.jb2
2525
RUN rm -rf tests
2626
COPY *.dict $SRC/

projects/jq/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $CXX $CXXFLAGS $LIB_FUZZING_ENGINE ./jq_fuzz_parse_stream.o \
5353
-o $OUT/jq_fuzz_parse_stream -I./src
5454

5555
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE ./tests/jq_fuzz_execute.cpp \
56-
-I./src \
56+
-I./src -I./vendor/oniguruma/src \
5757
./.libs/libjq.a ./vendor/oniguruma/src/.libs/libonig.a\
5858
-o $OUT/jq_fuzz_execute -I./src
5959

projects/libical/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616
################################################################################
1717

18-
cmake . -DSTATIC_ONLY=ON -DLIBICAL_GLIB=False -DLIBICAL_GLIB_BUILD_DOCS=False -DLIBICAL_GOBJECT_INTROSPECTION=False
18+
cmake . -DSTATIC_ONLY=ON -DLIBICAL_GLIB=False -DLIBICAL_GLIB_BUILD_DOCS=False -DLIBICAL_GOBJECT_INTROSPECTION=False -DLIBICAL_JAVA_BINDINGS=False
1919
make install -j$(nproc)
2020

2121

projects/liblouis/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
#
1616
################################################################################
1717

18+
sed -i 's/main/main2/g' tests/fuzzing/fuzz_backtranslate.c
19+
sed -i 's/main/main2/g' tests/fuzzing/fuzz_translate_generic.c
20+
sed -i 's/LLVMFuzzerRunDriver(&argc/\/\/LLVMFuzzerRunDriver(&argc/g' tests/fuzzing/fuzz_backtranslate.c
21+
sed -i 's/LLVMFuzzerRunDriver(&argc/\/\/LLVMFuzzerRunDriver(&argc/g' tests/fuzzing/fuzz_translate_generic.c
1822
$SRC/liblouis/tests/fuzzing/build.sh

0 commit comments

Comments
 (0)