Skip to content

Commit 7b2b2d1

Browse files
committed
sqlite3: integrate grammar-based SQL test
1 parent ac0a67c commit 7b2b2d1

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

projects/sqlite3/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ RUN mkdir $SRC/sqlite3 && \
2626

2727
RUN find $SRC/sqlite3 -name "*.test" | xargs zip $SRC/ossfuzz_seed_corpus.zip
2828

29+
RUN apt-get update && apt-get install -y cmake liblzma-dev
30+
RUN git clone https://github.com/ligurio/sqlsmith_proto $SRC/sqlsmith_proto
31+
2932
WORKDIR sqlite3
3033
COPY build.sh *.dict *.options run_tests.sh $SRC/

projects/sqlite3/build.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,41 @@ $CXX $CXXFLAGS \
4141
$LIB_FUZZING_ENGINE ./sqlite3.o
4242

4343
cp $SRC/*.options $SRC/*.dict $SRC/*.zip $OUT/
44+
45+
cd $SRC/sqlsmith_proto
46+
47+
case $SANITIZER in
48+
address) SANITIZERS_ARGS="-DENABLE_ASAN=ON" ;;
49+
undefined) SANITIZERS_ARGS="-DENABLE_UBSAN=ON" ;;
50+
*) SANITIZERS_ARGS="" ;;
51+
esac
52+
53+
: ${LD:="${CXX}"}
54+
: ${LDFLAGS:="${CXXFLAGS}"} # to make sure we link with sanitizer runtime
55+
56+
cmake_args=(
57+
-DCMAKE_BUILD_TYPE=Debug
58+
-DOSS_FUZZ=ON
59+
-DBUNDLED_PROTOBUF=OFF
60+
$SANITIZERS_ARGS
61+
# C compiler
62+
-DCMAKE_C_COMPILER="${CC}"
63+
-DCMAKE_C_FLAGS="${CFLAGS}"
64+
# C++ compiler
65+
-DCMAKE_CXX_COMPILER="${CXX}"
66+
-DCMAKE_CXX_FLAGS="${CXXFLAGS}"
67+
# Linker
68+
-DCMAKE_LINKER="${LD}"
69+
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}"
70+
-DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}"
71+
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}"
72+
)
73+
74+
[[ -e build ]] && rm -rf build
75+
cmake "${cmake_args[@]}" -S . -B build
76+
cmake --build build --parallel --verbose
77+
78+
for f in $(find build -name '*_test' -type f);
79+
do
80+
cp $f $OUT/
81+
done

0 commit comments

Comments
 (0)