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

Avoid ASAN for release builds, use w/ GCC or clang in debug builds #425

Merged
merged 3 commits into from
Apr 19, 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
4 changes: 2 additions & 2 deletions .github/workflows/pkg-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: make --file=Makefile.pkg-config PREFIX=${PREFIX} install

- name: Build the client/server examples
run: PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig make --file=Makefile.pkg-config
run: PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig make --file=Makefile.pkg-config PROFILE=debug

- name: Verify client is dynamically linked
run: LD_LIBRARY_PATH=$PREFIX/lib ldd target/client | grep "rustls"
Expand All @@ -48,4 +48,4 @@ jobs:
run: LD_LIBRARY_PATH=$PREFIX/lib ldd target/server | grep "rustls"

- name: Run the integration tests
run: LD_LIBRARY_PATH=$PREFIX/lib make --file=Makefile.pkg-config integration
run: LD_LIBRARY_PATH=$PREFIX/lib make --file=Makefile.pkg-config PROFILE=debug integration
20 changes: 17 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,23 @@ jobs:
toolchain: ${{ matrix.rust }}
- env:
CARGO_UNSTABLE_HTTP_REGISTRY: true
run: make CC=${{ matrix.cc }} PROFILE=release test integration
run: make CC=${{ matrix.cc }} PROFILE=debug test integration
- name: Platform verifier connect test
run: make connect-test
run: make PROFILE=debug connect-test
- name: Verify debug builds were using ASAN
if: runner.os == 'Linux' # For 'nm'
run: |
nm target/client | grep '__asan_init'
nm target/server | grep '__asan_init'
- name: Build release binaries
run: |
make clean
make CC=${{ matrix.cc }} PROFILE=release
- name: Verify release builds were not using ASAN
if: runner.os == 'Linux' # For 'nm'
run: |
nm target/client | grep -v '__asan_init'
nm target/server | grep -v '__asan_init'

valgrind:
name: Valgrind
Expand All @@ -56,7 +70,7 @@ jobs:
persist-credentials: false
- name: Install valgrind
run: sudo apt-get update && sudo apt-get install -y valgrind
- run: VALGRIND=valgrind make test integration
- run: VALGRIND=valgrind make PROFILE=release test integration

test-windows-cmake-debug:
name: Windows CMake, Debug configuration
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CFLAGS := -Werror -Wall -Wextra -Wpedantic -g -I src/
PROFILE := release
DESTDIR=/usr/local

ifeq ($(CC), clang)
ifeq ($(PROFILE), debug)
CFLAGS += -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address -fsanitize=undefined
endif

ifeq ($(PROFILE), release)
Expand Down
4 changes: 2 additions & 2 deletions Makefile.pkg-config
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ CFLAGS := -Werror -Wall -Wextra -Wpedantic -g -I src/
PROFILE := release
PREFIX=/usr/local

ifeq ($(CC), clang)
ifeq ($(PROFILE), debug)
CFLAGS += -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address -fsanitize=undefined
endif

ifeq ($(PROFILE), release)
Expand Down