Skip to content

Commit 3291f34

Browse files
authored
Adds run_tests.sh for simdjson rauc rapidjson python3-libraries spicy (google#14744)
Adds run_tests.sh for the simdjson rauc python3-libraries spicy projects and fix the build and run_tests.sh for rapidjson 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 aa21535 commit 3291f34

File tree

12 files changed

+112
-25
lines changed

12 files changed

+112
-25
lines changed

projects/python3-libraries/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ RUN apt-get update && \
1919
apt-get install -y build-essential libncursesw5-dev libreadline-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev libbz2-dev zlib1g-dev libffi-dev
2020
RUN git clone https://github.com/python/cpython.git cpython
2121
RUN git clone --depth 1 https://github.com/python/library-fuzzers.git
22-
COPY build.sh $SRC/
22+
COPY run_tests.sh build.sh $SRC/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash -eu
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Disable leak sanitizer
19+
export ASAN_OPTIONS="detect_leaks=0"
20+
21+
# Run unit test (2 unit tests that required network connection are skipped)
22+
ctest --test-dir $SRC/cpython -j$(nproc) -E "test_urllib2|test_urllibnet"

projects/rapidjson/Dockerfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616

1717
FROM gcr.io/oss-fuzz-base/base-builder
1818
RUN apt-get update && \
19-
apt-get install -y make autoconf automake libtool cmake
20-
RUN git clone --depth 1 https://github.com/google/googletest && \
21-
cd $SRC/googletest && \
22-
mkdir build && \
23-
cd build && \
24-
cmake .. && \
25-
make -j$(nproc) && \
26-
make install
19+
apt-get install -y make autoconf automake libtool cmake libgtest-dev
2720
RUN git clone --depth 1 https://github.com/Tencent/rapidjson.git rapidjson
2821
WORKDIR rapidjson
2922
COPY *.sh fuzzer.cpp $SRC/

projects/rapidjson/build.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ then
2727
export CXXFLAGS="$CXXFLAGS -DASAN"
2828
fi
2929

30-
# First build library and tests, which is needed for OSS-Fuzz's Chronos.
31-
mkdir build
32-
cd build
33-
cmake ../
34-
make -j$(nproc)
35-
cd ../
36-
3730
# Build fuzz harness.
3831
$CXX $CXXFLAGS -D_GLIBCXX_DEBUG -I $SRC/rapidjson/include $SRC/fuzzer.cpp $LIB_FUZZING_ENGINE -o $OUT/fuzzer
3932

33+
# Build unit test and perf test only
34+
mkdir build
35+
cd build
36+
NO_ERROR="-Wno-error=character-conversion"
37+
NO_ERROR="$NO_ERROR -Wno-error=deprecated-declarations"
38+
NO_ERROR="$NO_ERROR -Wno-error=uninitialized-const-pointer"
39+
export LDFLAGS="-pthread"
40+
cmake -DRAPIDJSON_BUILD_CXX17=ON \
41+
-DRAPIDJSON_BUILD_CXX11=OFF \
42+
-DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF \
43+
-DCMAKE_CXX_FLAGS="$NO_ERROR" \
44+
..
45+
make -j$(nproc) unittest perftest

projects/rapidjson/run_tests.sh

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

18-
./build/bin/unittest
19-
20-
# The below fails when run in OSS-Fuzz.
21-
# TODO: adjust so this runs in a regular ASAN OSS-Fuzz build environment.
22-
#./build/bin/perftest
18+
$SRC/rapidjson/build/bin/unittest && $SRC/rapidjson/build/bin/perftest

projects/rauc/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ RUN apt-get update && apt-get install -y python3-pip
1919
RUN unset CFLAGS CXXFLAGS && pip3 install -U meson ninja
2020
RUN git clone --depth 1 https://github.com/rauc/rauc.git rauc
2121
WORKDIR rauc
22-
COPY build.sh $SRC/
22+
COPY run_tests.sh build.sh $SRC/

projects/rauc/run_tests.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
# Disable leak sanitizer
20+
export ASAN_OPTIONS="detect_leaks=0"
21+
22+
# Run unit testing, skipping some that requires hardware or network configuration
23+
meson test -C $WORK/build --suite rauc -j$(nproc) artifacts bootchooser checksum config_file context event_log hash_index manifest progress slot stats status_file utils
24+
25+
# Test skipped that requires hardware or network configuration
26+
# meson test -C $WORK/build --suite rauc -j$(nproc) boot_raw_fallback bundle dm install service signature update_handler

projects/simdjson/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ RUN apt-get update && apt-get install -y ninja-build wget
2020

2121
RUN git clone --depth 1 https://github.com/simdjson/simdjson.git simdjson
2222
WORKDIR simdjson
23-
COPY build.sh $SRC/
23+
COPY run_tests.sh build.sh $SRC/
2424

projects/simdjson/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+
# Disable leak sanitizer
20+
export ASAN_OPTIONS="detect_leaks=0"
21+
22+
# Exclude failing unit test cases and run the remaining unit testing
23+
ctest --test-dir $SRC/simdjson/build -j$(nproc) -E \
24+
"minify_tests|prettify_tests|ondemand_tostring_tests|ondemand_cacheline|builder_string_builder_tests"

projects/spicy/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ RUN git clone --depth 1 --recursive https://github.com/zeek/spicy spicy \
6363

6464
WORKDIR ${SRC}/spicy
6565

66-
COPY build.sh $SRC/
66+
COPY run_tests.sh build.sh $SRC/

0 commit comments

Comments
 (0)