ci: test-self (V compiled with -fsanitize=memory) (#9423)

pull/9429/head
ka-weihe 2021-03-22 23:05:48 +01:00 committed by GitHub
parent a00c80b98f
commit 801da20fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -434,7 +434,7 @@ jobs:
./v -o v2 cmd/v -cflags -fsanitize=memory ./v -o v2 cmd/v -cflags -fsanitize=memory
./v -o v3 cmd/v -cflags -fsanitize=thread ./v -o v3 cmd/v -cflags -fsanitize=thread
./v -o v4 cmd/v -cflags -fsanitize=undefined ./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 ./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 ./v3 -o v.c cmd/v
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v4 -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 - name: Build V
run: make -j4 && ./v -cg -cflags -Werror -o v cmd/v run: make -j4 && ./v -cg -cflags -Werror -o v cmd/v
- name: Self tests (-fsanitize=address) - 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) - name: Self tests (V compiled with -fsanitize=address)
run: run:
./v -cflags -fsanitize=address -o v cmd/v && ./v -cflags -fsanitize=address -o v cmd/v &&
@ -582,7 +582,7 @@ jobs:
## .\.github\workflows\windows-install-sdl.bat ## .\.github\workflows\windows-install-sdl.bat
- name: Self tests (-fsanitize=address) - name: Self tests (-fsanitize=address)
run: | run: |
.\v.exe -cflags "-fsanitize=address" test-self .\v.exe -cflags -fsanitize=address test-self
tests-sanitize-address-gcc: tests-sanitize-address-gcc:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -608,7 +608,7 @@ jobs:
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self
- name: Self tests (V compiled with -fsanitize=address) - name: Self tests (V compiled with -fsanitize=address)
run: 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 ASAN_OPTIONS=detect_leaks=0 ./v -cc tcc test-self -asan-compiler
tests-sanitize-memory-clang: tests-sanitize-memory-clang:
@ -633,7 +633,9 @@ jobs:
run: make -j4 && ./v -cc clang -cg -cflags -Werror -o v cmd/v run: make -j4 && ./v -cc clang -cg -cflags -Werror -o v cmd/v
- name: Self tests (-fsanitize=memory) - name: Self tests (-fsanitize=memory)
run: ./v -cflags -fsanitize=memory test-self 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: # ubuntu-autofree-selfcompile:
# runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
# timeout-minutes: 30 # timeout-minutes: 30

View File

@ -156,6 +156,7 @@ const (
'vlib/readline/readline_test.v', 'vlib/readline/readline_test.v',
'vlib/vweb/tests/vweb_test.v', 'vlib/vweb/tests/vweb_test.v',
] ]
skip_with_msan_compiler = []string{}
skip_test_files = []string{} skip_test_files = []string{}
skip_on_musl = [ skip_on_musl = [
'vlib/v/tests/profile/profile_test.v', 'vlib/v/tests/profile/profile_test.v',
@ -217,10 +218,14 @@ fn main() {
mut sanitize_address := false mut sanitize_address := false
mut sanitize_undefined := false mut sanitize_undefined := false
mut asan_compiler := false mut asan_compiler := false
mut msan_compiler := false
for arg in args { for arg in args {
if '-asan-compiler' in arg { if '-asan-compiler' in arg {
asan_compiler = true asan_compiler = true
} }
if '-msan-compiler' in arg {
msan_compiler = true
}
if '-Werror' in arg { if '-Werror' in arg {
werror = true werror = true
} }
@ -249,6 +254,9 @@ fn main() {
if asan_compiler { if asan_compiler {
tsession.skip_files << skip_with_asan_compiler tsession.skip_files << skip_with_asan_compiler
} }
if msan_compiler {
tsession.skip_files << skip_with_msan_compiler
}
// println(tsession.skip_files) // println(tsession.skip_files)
if os.getenv('V_CI_MUSL').len > 0 { if os.getenv('V_CI_MUSL').len > 0 {
tsession.skip_files << skip_on_musl tsession.skip_files << skip_on_musl