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

Introduce Valgrind to the CI pipeline #369

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 11 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: install-dependencies
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y libsdl2-dev libsdl2-mixer-dev
sudo apt-get install -q -y libsdl2-dev libsdl2-mixer-dev valgrind
.ci/riscv-toolchain-install.sh
wget https://apt.llvm.org/llvm.sh
sudo chmod +x ./llvm.sh
Expand Down Expand Up @@ -119,6 +119,16 @@ jobs:
run: |
make clean && make ENABLE_UBSAN=1 check -j$(nproc)
make ENABLE_JIT=1 clean && make ENABLE_JIT=1 ENABLE_UBSAN=1 check -j$(nproc)
- name: valgrind check (without JIT)
run: |
make clean && make ENABLE_SDL=0 ENABLE_JIT=0 ENABLE_VALGRIND=1
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./build/rv32emu ./build/hello.elf
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./build/rv32emu ./build/aes.elf
- name: valgrind check (with JIT)
run: |
make clean && make ENABLE_SDL=0 ENABLE_JIT=1 ENABLE_VALGRIND=1
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./build/rv32emu ./build/hello.elf
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./build/rv32emu ./build/aes.elf

host-arm64:
needs: [detect-code-related-file-changes]
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ CFLAGS = -std=gnu99 -O2 -Wall -Wextra
CFLAGS += -Wno-unused-label
CFLAGS += -include src/common.h

ENABLE_VALGRIND ?= 0
ifeq ("$(ENABLE_UBSAN)", "1")
henrybear327 marked this conversation as resolved.
Show resolved Hide resolved
# according to gcc's man page: "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective."
# In order to use Valgrind, we need to compile with -g
CFLAGS += -g
LDFLAGS += -g
henrybear327 marked this conversation as resolved.
Show resolved Hide resolved
endif

# Enable link-time optimization (LTO)
ENABLE_LTO ?= 1
ifeq ($(call has, LTO), 1)
Expand Down
Loading