From 801da20fd9cc1c4594ac570c98e02e1d6c61aedf Mon Sep 17 00:00:00 2001 From: ka-weihe Date: Mon, 22 Mar 2021 23:05:48 +0100 Subject: [PATCH] ci: test-self (V compiled with -fsanitize=memory) (#9423) --- .github/workflows/ci.yml | 12 +++++++----- cmd/tools/vtest-self.v | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fba76a73c..c90f8d7ce0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -434,7 +434,7 @@ jobs: ./v -o v2 cmd/v -cflags -fsanitize=memory ./v -o v3 cmd/v -cflags -fsanitize=thread ./v -o v4 cmd/v -cflags -fsanitize=undefined - ./v -o v5 cmd/v -cflags -fsanitize=address + ./v -o v5 cmd/v -cflags -fsanitize=address,pointer-compare,pointer-subtract UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v2 -o v.c cmd/v UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v3 -o v.c cmd/v UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v4 -o v.c cmd/v @@ -553,7 +553,7 @@ jobs: - name: Build V run: make -j4 && ./v -cg -cflags -Werror -o v cmd/v - name: Self tests (-fsanitize=address) - run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self + run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags "-fsanitize=address,pointer-compare,pointer-subtract" test-self - name: Self tests (V compiled with -fsanitize=address) run: ./v -cflags -fsanitize=address -o v cmd/v && @@ -582,7 +582,7 @@ jobs: ## .\.github\workflows\windows-install-sdl.bat - name: Self tests (-fsanitize=address) run: | - .\v.exe -cflags "-fsanitize=address" test-self + .\v.exe -cflags -fsanitize=address test-self tests-sanitize-address-gcc: runs-on: ubuntu-20.04 @@ -608,7 +608,7 @@ jobs: run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self - name: Self tests (V compiled with -fsanitize=address) run: - ./v -cflags -fsanitize=address -o v cmd/v && + ./v -cflags -fsanitize=address,pointer-compare,pointer-subtract -o v cmd/v && ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler tests-sanitize-memory-clang: @@ -633,7 +633,9 @@ jobs: run: make -j4 && ./v -cc clang -cg -cflags -Werror -o v cmd/v - name: Self tests (-fsanitize=memory) run: ./v -cflags -fsanitize=memory test-self - + - name: Self tests (V compiled with -fsanitize=memory) + run: + ./v -cflags -fsanitize=memory -o v cmd/v && ./v -cc tcc test-self -msan-compiler # ubuntu-autofree-selfcompile: # runs-on: ubuntu-20.04 # timeout-minutes: 30 diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index d1957b220e..8ba7361570 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -156,6 +156,7 @@ const ( 'vlib/readline/readline_test.v', 'vlib/vweb/tests/vweb_test.v', ] + skip_with_msan_compiler = []string{} skip_test_files = []string{} skip_on_musl = [ 'vlib/v/tests/profile/profile_test.v', @@ -217,10 +218,14 @@ fn main() { mut sanitize_address := false mut sanitize_undefined := false mut asan_compiler := false + mut msan_compiler := false for arg in args { if '-asan-compiler' in arg { asan_compiler = true } + if '-msan-compiler' in arg { + msan_compiler = true + } if '-Werror' in arg { werror = true } @@ -249,6 +254,9 @@ fn main() { if asan_compiler { tsession.skip_files << skip_with_asan_compiler } + if msan_compiler { + tsession.skip_files << skip_with_msan_compiler + } // println(tsession.skip_files) if os.getenv('V_CI_MUSL').len > 0 { tsession.skip_files << skip_on_musl