Skip to content

Commit a7bf195

Browse files
authored
Add run_tests.sh for spotify-json glog libarchive (#14746)
Adds run_tests.sh for the spotify-json glog libarchive project. run_tests.sh is used as part of Chronos with cached builds: https://github.com/google/oss-fuzz/tree/master/infra/chronos#chronos-feature--running-tests-of-a-project --------- Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
1 parent 17cb0f6 commit a7bf195

File tree

7 files changed

+80
-5
lines changed

7 files changed

+80
-5
lines changed

projects/glog/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ FROM gcr.io/oss-fuzz-base/base-builder
1818

1919
RUN git clone --depth 1 https://github.com/google/glog
2020

21-
COPY build.sh $SRC/
21+
COPY run_tests.sh build.sh $SRC/
2222
WORKDIR $SRC/glog

projects/glog/run_tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -eu
2+
#
3+
# Copyright 2026 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
################################################################################
18+
19+
ctest --test-dir build -E "stacktrace|symbolize|includes_logging|includes_vlog_is_on|includes_raw_logging"

projects/libarchive/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ RUN mkdir /deps && \
3838
make install && \
3939
cp .libs/libxml2.a /deps/
4040

41-
COPY build.sh libarchive_fuzzer.cc $SRC/
41+
COPY run_tests.sh build.sh libarchive_fuzzer.cc $SRC/
4242
WORKDIR $SRC

projects/libarchive/run_tests.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -eu
2+
#
3+
# Copyright 2026 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
################################################################################
18+
19+
# Skip leak sanitizer and disable possible null return from allocator
20+
export ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1"
21+
22+
# Run unit test and disable those tests that are failing or not able to run without network connection
23+
ctest --test-dir libarchive/build2 -j$(nproc) -E \
24+
"libarchive_test_compat_zip_4|libarchive_test_read_format_cpio_bin*|libarchive_test_read_pax_truncated|bsdcpio_test_basic|bsdcpio_test_option_0|bsdcpio_test_option_L_upper|bsdcpio_test_option_d|bsdcpio_test_option_f|bsdcpio_test_option_m|bsdcpio_test_option_t"

projects/spotify-json/Dockerfile

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

1717
FROM gcr.io/oss-fuzz-base/base-builder
18+
RUN apt-get update && apt-get install -y libboost-dev libboost-test-dev \
19+
libboost-system-dev libboost-chrono-dev
1820
RUN git clone https://github.com/spotify/spotify-json
1921

2022
WORKDIR $SRC/spotify-json
21-
COPY build.sh $SRC/
23+
COPY run_tests.sh build.sh $SRC/

projects/spotify-json/build.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,21 @@
1515
#
1616
################################################################################
1717

18-
mkdir build && cd build
18+
# Build spotify-json
19+
mkdir build
20+
pushd build
1921
cmake -DSPOTIFY_JSON_BUILD_TESTS=OFF ../
20-
make
22+
make -j$(nproc) spotify-json
2123

2224
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE ../fuzzers//fuzz_decode.cpp \
2325
-I../include -I../vendor/double-conversion \
2426
./libspotify-json.a ./vendor/double-conversion/libdouble-conversion.a -lpthread -o $OUT/fuzz_decode
27+
popd
28+
29+
# Build unit testing and benchmark which is incompatible with major build with fuzzing sanitizer
30+
mkdir build-tests
31+
pushd build-tests
32+
unset CXXFLAGS
33+
cmake -DSPOTIFY_JSON_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS='-stdlib=libstdc++' ../
34+
make -j$(nproc) spotify_json_test json_benchmark
35+
popd

projects/spotify-json/run_tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -eu
2+
#
3+
# Copyright 2026 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
################################################################################
18+
19+
make test -C $SRC/spotify-json/build-tests -j$(nproc)

0 commit comments

Comments
 (0)