Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wamr] Support code coverage #12528

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 39 additions & 27 deletions projects/wamr/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,46 @@
# limitations under the License.
#
################################################################################
echo " <| ------- |> "
pwd
echo " <| ------- |> "
ls
echo " <| ------- |> "
# by default.
# - MVP

echo "<| ------ " $(pwd) " ------ |>"
ls .
ls -l /usr/lib/libFuzzing*
echo "<| ------ -------- ------ |>"


: ${LD:="${CXX}"}
: ${LDFLAGS:="${CXXFLAGS}"} # to make sure we link with sanitizer runtime

cmake_args=(
# C compiler
-DCMAKE_C_COMPILER="${CC}"
-DCMAKE_C_FLAGS="${CFLAGS}"

# C++ compiler
-DCMAKE_CXX_COMPILER="${CXX}"
-DCMAKE_CXX_FLAGS="${CXXFLAGS}"

# Linker
-DCMAKE_LINKER="${LD}"
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}"
-DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}"
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}"
)

# CORPUS
(
cd tests/fuzz/wasm-mutator-fuzz/
./smith_wasm.sh 10
)

# loader
(
cd tests/fuzz/wasm-mutator-fuzz/

if [[ "${SANITIZER}" == "address" ]]; then
cmake -S . -B build -DWAMR_BUILD_SANITIZER=asan\
&& cmake --build build
elif [[ "${SANITIZER}" == "memory" ]]; then
echo "will support msan soon"
exit 0
elif [[ "${SANITIZER}" == "undefined" ]]; then
cmake -S . -B build -DWAMR_BUILD_SANITIZER=ubsan\
&& cmake --build build
elif [[ "${SANITIZER}" == "coverage" ]]; then
echo "will support code coverage soon"
exit 0
else
cmake -S . -B build\
&& cmake --build build
fi

./smith_wasm.sh 5
cp ./build/wasm_mutator_fuzz $OUT/
zip -j $OUT/wasm_mutator_fuzz.zip ./build/CORPUS_DIR/*
cmake -S . -B build_loader \
"${cmake_args[@]}" \
&& cmake --build build_loader

cp ./build_loader/wasm_mutator_fuzz $OUT/wasm_mutator_fuzz_loader
zip -j $OUT/wasm_mutator_fuzz_loader_seed_corpus.zip ./build/CORPUS_DIR/test_*.wasm
)
1 change: 0 additions & 1 deletion projects/wamr/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ primary_contact: "[email protected]"
auto_ccs:
- "[email protected]"
- "[email protected]"
- "[email protected]"
main_repo: "https://github.com/bytecodealliance/wasm-micro-runtime.git"
sanitizers:
- address
Expand Down
Loading