mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11823 from ethereum/fix-11822
Add UBSan build + test nightly CI.
This commit is contained in:
commit
72c5f4caca
@ -121,18 +121,7 @@ defaults:
|
|||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
command: ./.circleci/soltest_all.sh
|
command: ./.circleci/soltest_all.sh
|
||||||
|
|
||||||
- run_cmdline_tests: &run_cmdline_tests
|
- run_soltest_steps: &run_soltest_steps
|
||||||
name: command line tests
|
|
||||||
no_output_timeout: 30m
|
|
||||||
command: ./test/cmdlineTests.sh
|
|
||||||
|
|
||||||
- run_docs_pragma_min_version: &run_docs_pragma_min_version
|
|
||||||
name: docs pragma version check
|
|
||||||
command: ./scripts/docs_version_pragma_check.sh
|
|
||||||
|
|
||||||
- test_ubuntu1604_clang: &test_ubuntu1604_clang
|
|
||||||
docker:
|
|
||||||
- image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >>
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -141,21 +130,7 @@ defaults:
|
|||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
- test_ubuntu2004_clang: &test_ubuntu2004_clang
|
- run_soltest_all_steps: &run_soltest_all_steps
|
||||||
docker:
|
|
||||||
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- attach_workspace:
|
|
||||||
at: build
|
|
||||||
- run: *run_soltest
|
|
||||||
- store_test_results: *store_test_results
|
|
||||||
- store_artifacts: *artifacts_test_results
|
|
||||||
|
|
||||||
- test_ubuntu2004: &test_ubuntu2004
|
|
||||||
docker:
|
|
||||||
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
|
||||||
parallelism: 6
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -164,27 +139,48 @@ defaults:
|
|||||||
- store_test_results: *store_test_results
|
- store_test_results: *store_test_results
|
||||||
- store_artifacts: *artifacts_test_results
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
|
- run_cmdline_tests: &run_cmdline_tests
|
||||||
|
name: command line tests
|
||||||
|
no_output_timeout: 30m
|
||||||
|
command: ./test/cmdlineTests.sh
|
||||||
|
|
||||||
|
- run_cmdline_tests_steps: &run_cmdline_tests_steps
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: build
|
||||||
|
- run: *run_cmdline_tests
|
||||||
|
- store_test_results: *store_test_results
|
||||||
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
|
- run_docs_pragma_min_version: &run_docs_pragma_min_version
|
||||||
|
name: docs pragma version check
|
||||||
|
command: ./scripts/docs_version_pragma_check.sh
|
||||||
|
|
||||||
|
- test_ubuntu1604_clang: &test_ubuntu1604_clang
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >>
|
||||||
|
<<: *run_soltest_steps
|
||||||
|
|
||||||
|
- test_ubuntu2004_clang: &test_ubuntu2004_clang
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
|
<<: *run_soltest_steps
|
||||||
|
|
||||||
|
- test_ubuntu2004: &test_ubuntu2004
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
||||||
|
parallelism: 6
|
||||||
|
<<: *run_soltest_all_steps
|
||||||
|
|
||||||
- test_asan: &test_asan
|
- test_asan: &test_asan
|
||||||
<<: *test_ubuntu2004
|
<<: *test_ubuntu2004
|
||||||
steps:
|
<<: *run_soltest_steps
|
||||||
- checkout
|
|
||||||
- attach_workspace:
|
|
||||||
at: build
|
|
||||||
- run:
|
|
||||||
<<: *run_soltest
|
|
||||||
- store_test_results: *store_test_results
|
|
||||||
- store_artifacts: *artifacts_test_results
|
|
||||||
|
|
||||||
- test_asan_clang: &test_asan_clang
|
- test_ubuntu2004_clang_cli: &test_ubuntu2004_clang_cli
|
||||||
<<: *test_ubuntu2004_clang
|
docker:
|
||||||
steps:
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
- checkout
|
<<: *run_cmdline_tests_steps
|
||||||
- attach_workspace:
|
|
||||||
at: build
|
|
||||||
- run:
|
|
||||||
<<: *run_soltest
|
|
||||||
- store_test_results: *store_test_results
|
|
||||||
- store_artifacts: *artifacts_test_results
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Workflow Templates
|
# Workflow Templates
|
||||||
@ -239,6 +235,11 @@ defaults:
|
|||||||
requires:
|
requires:
|
||||||
- b_ubu_asan_clang
|
- b_ubu_asan_clang
|
||||||
|
|
||||||
|
- workflow_ubuntu2004_ubsan_clang: &workflow_ubuntu2004_ubsan_clang
|
||||||
|
<<: *workflow_trigger_on_tags
|
||||||
|
requires:
|
||||||
|
- b_ubu_ubsan_clang
|
||||||
|
|
||||||
- workflow_emscripten: &workflow_emscripten
|
- workflow_emscripten: &workflow_emscripten
|
||||||
<<: *workflow_trigger_on_tags
|
<<: *workflow_trigger_on_tags
|
||||||
requires:
|
requires:
|
||||||
@ -433,7 +434,7 @@ jobs:
|
|||||||
name: Python unit tests
|
name: Python unit tests
|
||||||
command: python.exe test/pyscriptTests.py
|
command: python.exe test/pyscriptTests.py
|
||||||
|
|
||||||
b_ubu_clang: &build_ubuntu2004_clang
|
b_ubu_clang: &b_ubu_clang
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
docker:
|
docker:
|
||||||
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
@ -447,8 +448,7 @@ jobs:
|
|||||||
- store_artifacts: *artifacts_solc
|
- store_artifacts: *artifacts_solc
|
||||||
- persist_to_workspace: *artifacts_executables
|
- persist_to_workspace: *artifacts_executables
|
||||||
|
|
||||||
|
b_ubu_asan_clang: &b_ubu_asan_clang
|
||||||
b_ubu_asan_clang: &build_ubuntu2004_clang
|
|
||||||
docker:
|
docker:
|
||||||
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
environment:
|
environment:
|
||||||
@ -462,7 +462,22 @@ jobs:
|
|||||||
- store_artifacts: *artifacts_solc
|
- store_artifacts: *artifacts_solc
|
||||||
- persist_to_workspace: *artifacts_executables
|
- persist_to_workspace: *artifacts_executables
|
||||||
|
|
||||||
b_ubu: &build_ubuntu2004
|
b_ubu_ubsan_clang: &b_ubu_ubsan_clang
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
|
environment:
|
||||||
|
CC: clang
|
||||||
|
CXX: clang++
|
||||||
|
CMAKE_OPTIONS: -DSANITIZE=undefined
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: *run_build
|
||||||
|
- run: *gitter_notify_failure
|
||||||
|
- store_artifacts: *artifacts_solc
|
||||||
|
- persist_to_workspace: *artifacts_executables
|
||||||
|
|
||||||
|
b_ubu: &b_ubu
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
docker:
|
docker:
|
||||||
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
||||||
@ -475,14 +490,14 @@ jobs:
|
|||||||
- store_artifacts: *artifacts_tools
|
- store_artifacts: *artifacts_tools
|
||||||
- persist_to_workspace: *artifacts_executables
|
- persist_to_workspace: *artifacts_executables
|
||||||
|
|
||||||
b_ubu_release: &build_ubuntu2004_release
|
b_ubu_release: &b_ubu_release
|
||||||
<<: *build_ubuntu2004
|
<<: *b_ubu
|
||||||
environment:
|
environment:
|
||||||
FORCE_RELEASE: ON
|
FORCE_RELEASE: ON
|
||||||
MAKEFLAGS: -j 10
|
MAKEFLAGS: -j 10
|
||||||
|
|
||||||
b_ubu_static:
|
b_ubu_static:
|
||||||
<<: *build_ubuntu2004
|
<<: *b_ubu
|
||||||
environment:
|
environment:
|
||||||
MAKEFLAGS: -j 10
|
MAKEFLAGS: -j 10
|
||||||
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON
|
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON
|
||||||
@ -495,7 +510,7 @@ jobs:
|
|||||||
- store_artifacts: *artifacts_solc
|
- store_artifacts: *artifacts_solc
|
||||||
|
|
||||||
b_ubu_codecov:
|
b_ubu_codecov:
|
||||||
<<: *build_ubuntu2004
|
<<: *b_ubu
|
||||||
environment:
|
environment:
|
||||||
COVERAGE: ON
|
COVERAGE: ON
|
||||||
CMAKE_BUILD_TYPE: Debug
|
CMAKE_BUILD_TYPE: Debug
|
||||||
@ -529,7 +544,7 @@ jobs:
|
|||||||
# Builds in C++20 mode and uses debug build in order to speed up.
|
# Builds in C++20 mode and uses debug build in order to speed up.
|
||||||
# Do *NOT* store any artifacts or workspace as we don't run tests on this build.
|
# Do *NOT* store any artifacts or workspace as we don't run tests on this build.
|
||||||
b_ubu_cxx20:
|
b_ubu_cxx20:
|
||||||
<<: *build_ubuntu2004
|
<<: *b_ubu
|
||||||
environment:
|
environment:
|
||||||
CMAKE_BUILD_TYPE: Debug
|
CMAKE_BUILD_TYPE: Debug
|
||||||
CMAKE_OPTIONS: -DCMAKE_CXX_STANDARD=20 -DUSE_CVC4=OFF
|
CMAKE_OPTIONS: -DCMAKE_CXX_STANDARD=20 -DUSE_CVC4=OFF
|
||||||
@ -538,7 +553,7 @@ jobs:
|
|||||||
- checkout
|
- checkout
|
||||||
- run: *run_build
|
- run: *run_build
|
||||||
|
|
||||||
b_ubu_ossfuzz: &build_ubuntu1604_clang
|
b_ubu_ossfuzz: &b_ubu_ossfuzz
|
||||||
docker:
|
docker:
|
||||||
- image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >>
|
- image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >>
|
||||||
environment:
|
environment:
|
||||||
@ -683,7 +698,7 @@ jobs:
|
|||||||
|
|
||||||
# x64 ASAN build, for testing for memory related bugs
|
# x64 ASAN build, for testing for memory related bugs
|
||||||
b_ubu_asan: &b_ubu_asan
|
b_ubu_asan: &b_ubu_asan
|
||||||
<<: *build_ubuntu2004
|
<<: *b_ubu
|
||||||
environment:
|
environment:
|
||||||
CMAKE_OPTIONS: -DSANITIZE=address
|
CMAKE_OPTIONS: -DSANITIZE=address
|
||||||
MAKEFLAGS: -j 10
|
MAKEFLAGS: -j 10
|
||||||
@ -768,13 +783,7 @@ jobs:
|
|||||||
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
||||||
environment:
|
environment:
|
||||||
TERM: xterm
|
TERM: xterm
|
||||||
steps:
|
<<: *run_cmdline_tests_steps
|
||||||
- checkout
|
|
||||||
- attach_workspace:
|
|
||||||
at: build
|
|
||||||
- run: *run_cmdline_tests
|
|
||||||
- store_test_results: *store_test_results
|
|
||||||
- store_artifacts: *artifacts_test_results
|
|
||||||
|
|
||||||
t_ubu_release_cli: &t_ubu_release_cli
|
t_ubu_release_cli: &t_ubu_release_cli
|
||||||
<<: *t_ubu_cli
|
<<: *t_ubu_cli
|
||||||
@ -784,14 +793,7 @@ jobs:
|
|||||||
environment:
|
environment:
|
||||||
TERM: xterm
|
TERM: xterm
|
||||||
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
||||||
steps:
|
<<: *run_cmdline_tests_steps
|
||||||
- checkout
|
|
||||||
- attach_workspace:
|
|
||||||
at: build
|
|
||||||
- run:
|
|
||||||
<<: *run_cmdline_tests
|
|
||||||
- store_test_results: *store_test_results
|
|
||||||
- store_artifacts: *artifacts_test_results
|
|
||||||
|
|
||||||
t_ubu_asan_constantinople:
|
t_ubu_asan_constantinople:
|
||||||
<<: *test_asan
|
<<: *test_asan
|
||||||
@ -802,13 +804,37 @@ jobs:
|
|||||||
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
||||||
|
|
||||||
t_ubu_asan_constantinople_clang:
|
t_ubu_asan_constantinople_clang:
|
||||||
<<: *test_asan_clang
|
<<: *test_ubuntu2004_clang
|
||||||
environment:
|
environment:
|
||||||
EVM: constantinople
|
EVM: constantinople
|
||||||
OPTIMIZE: 0
|
OPTIMIZE: 0
|
||||||
SOLTEST_FLAGS: --no-smt
|
SOLTEST_FLAGS: --no-smt
|
||||||
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
|
||||||
|
|
||||||
|
t_ubu_ubsan_clang:
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: build
|
||||||
|
- run: *run_soltest
|
||||||
|
- run: *gitter_notify_failure
|
||||||
|
- store_test_results: *store_test_results
|
||||||
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
|
t_ubu_ubsan_clang_cli:
|
||||||
|
docker:
|
||||||
|
- image: << pipeline.parameters.ubuntu-2004-clang-docker-image >>
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: build
|
||||||
|
- run: *run_cmdline_tests
|
||||||
|
- run: *gitter_notify_failure
|
||||||
|
- store_test_results: *store_test_results
|
||||||
|
- store_artifacts: *artifacts_test_results
|
||||||
|
|
||||||
t_ems_solcjs:
|
t_ems_solcjs:
|
||||||
docker:
|
docker:
|
||||||
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
|
||||||
@ -1208,6 +1234,11 @@ workflows:
|
|||||||
- t_ubu_asan_constantinople_clang: *workflow_ubuntu2004_asan_clang
|
- t_ubu_asan_constantinople_clang: *workflow_ubuntu2004_asan_clang
|
||||||
- t_ubu_asan_cli: *workflow_ubuntu2004_asan
|
- t_ubu_asan_cli: *workflow_ubuntu2004_asan
|
||||||
|
|
||||||
|
# UBSan build and tests
|
||||||
|
- b_ubu_ubsan_clang: *workflow_trigger_on_tags
|
||||||
|
- t_ubu_ubsan_clang: *workflow_ubuntu2004_ubsan_clang
|
||||||
|
- t_ubu_ubsan_clang_cli: *workflow_ubuntu2004_ubsan_clang
|
||||||
|
|
||||||
# Emscripten build and tests that take more than 15 minutes to execute
|
# Emscripten build and tests that take more than 15 minutes to execute
|
||||||
- b_ems: *workflow_trigger_on_tags
|
- b_ems: *workflow_trigger_on_tags
|
||||||
- t_ems_ext:
|
- t_ems_ext:
|
||||||
|
@ -192,11 +192,44 @@ endif ()
|
|||||||
|
|
||||||
if (SANITIZE)
|
if (SANITIZE)
|
||||||
# Perform case-insensitive string compare
|
# Perform case-insensitive string compare
|
||||||
string(TOLOWER "${SANITIZE}" san)
|
string(TOLOWER "${SANITIZE}" sanitizer)
|
||||||
# -fno-omit-frame-pointer gives more informative stack trace in case of an error
|
# -fno-omit-frame-pointer gives more informative stack trace in case of an error
|
||||||
# -fsanitize-address-use-after-scope throws an error when a variable is used beyond its scope
|
# -fsanitize-address-use-after-scope throws an error when a variable is used beyond its scope
|
||||||
if (san STREQUAL "address")
|
if (sanitizer STREQUAL "address")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope")
|
||||||
|
elseif (sanitizer STREQUAL "undefined")
|
||||||
|
# The following flags not used by fuzzer but used by us may create problems, so consider
|
||||||
|
# disabling them: alignment, pointer-overflow, unsigned-shift-base.
|
||||||
|
# Flags are alphabetically sorted
|
||||||
|
list(APPEND undefinedSanitizerChecks
|
||||||
|
alignment
|
||||||
|
array-bounds
|
||||||
|
bool
|
||||||
|
builtin
|
||||||
|
enum
|
||||||
|
float-divide-by-zero
|
||||||
|
function
|
||||||
|
integer-divide-by-zero
|
||||||
|
null
|
||||||
|
object-size
|
||||||
|
pointer-overflow
|
||||||
|
return
|
||||||
|
returns-nonnull-attribute
|
||||||
|
shift
|
||||||
|
signed-integer-overflow
|
||||||
|
unsigned-integer-overflow
|
||||||
|
unsigned-shift-base
|
||||||
|
unreachable
|
||||||
|
vla-bound
|
||||||
|
vptr
|
||||||
|
)
|
||||||
|
list(JOIN undefinedSanitizerChecks "," sanitizerChecks)
|
||||||
|
list(REMOVE_ITEM undefinedSanitizerChecks unsigned-integer-overflow)
|
||||||
|
# The fuzzer excludes reports of unsigned-integer-overflow. Hence, we remove it
|
||||||
|
# from the -fno-sanitize-recover checks. Consider reducing this list if we do not
|
||||||
|
# want to be notified about other failed checks.
|
||||||
|
list(JOIN undefinedSanitizerChecks "," dontRecoverFromChecks)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${sanitizerChecks} -fno-sanitize-recover=${dontRecoverFromChecks}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user