Skip to content

Commit

Permalink
Merge branch 'master' into ci/bit_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis committed Jul 26, 2023
2 parents 8d32722 + b945f79 commit e73a36b
Show file tree
Hide file tree
Showing 524 changed files with 24,619 additions and 5,986 deletions.
70 changes: 12 additions & 58 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ commands:
- run:
name: "Install compiler"
command: cmake/setup/compiler_install.sh <<parameters.compiler_id>> <<parameters.compiler_version>>
- run:
name: "Install dependencies"
command: |
sudo apt-get update
sudo apt-get install -y m4 texinfo bison
- run:
name: "Cmake"
working_directory: ~/build
Expand Down Expand Up @@ -118,31 +113,8 @@ commands:
default: true
steps:
- run:
name: "Core unit tests"
working_directory: ~/build
command: |
ulimit -s unlimited
cmd/test/core_test
- run:
name: "Infra unit tests"
working_directory: ~/build
command: cmd/test/infra_test
- run:
name: "Node unit tests"
working_directory: ~/build
command: cmd/test/node_test
- run:
name: "RpcDaemon unit tests"
working_directory: ~/build
command: cmd/test/rpcdaemon_test
- run:
name: "Sentry unit tests"
working_directory: ~/build
command: cmd/test/sentry_test
- run:
name: "Sync unit tests"
working_directory: ~/build
command: cmd/test/sync_test
name: "Unit tests"
command: make "SILKWORM_BUILD_DIR=$HOME/build" run_unit_tests
- when:
condition: <<parameters.ethereum_tests>>
steps:
Expand Down Expand Up @@ -231,6 +203,7 @@ jobs:
environment:
BUILD_CMAKE_ARGS: -DSILKWORM_SANITIZE=address,undefined
ASAN_OPTIONS: alloc_dealloc_mismatch=0 # https://github.com/llvm/llvm-project/issues/59432
UBSAN_OPTIONS: print_stacktrace=1
machine:
image: ubuntu-2204:2023.04.2
resource_class: xlarge
Expand All @@ -255,41 +228,22 @@ jobs:
compiler_id: clang
compiler_version: <<pipeline.parameters.clang_version_latest>>
- run:
name: "Core unit tests"
working_directory: ~/build
command: |
cmd/test/core_test
mv default.profraw core_test.profraw
- run:
name: "Node unit tests"
working_directory: ~/build
command: |
cmd/test/node_test
mv default.profraw node_test.profraw
name: "Unit tests"
command: make "SILKWORM_BUILD_DIR=$HOME/build" SILKWORM_CLANG_COVERAGE=ON run_unit_tests
- run:
name: "Ethereum EL tests"
working_directory: ~/build
no_output_timeout: 30m
command: |
cmd/test/ethereum
mv default.profraw ethereum.profraw
command: LLVM_PROFILE_FILE=ethereum.profraw ~/build/cmd/test/ethereum
- run:
name: "Coverage"
working_directory: ~/build
command: |
llvm-profdata merge *.profraw -o profdata
llvm-cov export -instr-profile profdata -format=lcov cmd/test/node_test -object cmd/test/ethereum > silkworm.lcov
- run:
name: "Upload to Codecov"
command: |
sudo pip install codecov==2.1.13
counter=1
until "$codecov" --required --file ~/build/silkworm.lcov -X gcov || [ $counter = 5 ]; do
counter=$((counter+1))
sleep 1
echo "Try #$counter..."
done
llvm-cov export -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' -format=lcov > /tmp/silkworm.lcov
llvm-cov report -instr-profile profdata ~/build/cmd/silkworm '-ignore-filename-regex=(third_party|silkworm/interfaces|test)' > /tmp/report.txt
- store_artifacts:
path: /tmp/silkworm.lcov
- store_artifacts:
path: /tmp/report.txt

linux-clang-tidy:
environment:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ jobs:
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ matrix.config.build_type }} -j 2

- name: Test
- name: Unit tests
run: make "SILKWORM_BUILD_DIR=${{runner.workspace}}/build" run_unit_tests

- name: Ethereum EL tests
working-directory: ${{runner.workspace}}/build
run: |
cmd/test/core_test
cmd/test/infra_test
cmd/test/node_test
cmd/test/rpcdaemon_test
cmd/test/sentry_test
cmd/test/sync_test
cmd/test/ethereum --threads 4
42 changes: 6 additions & 36 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,48 +58,18 @@ jobs:
working-directory: C:\build
run: cmake ${{runner.workspace}}\silkworm -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}

- name: Build silkworm
- name: Build unit tests
working-directory: C:\build
# Skip silkworm to avoid fatal error C1002: compiler is out of heap space in pass 2
# run: cmake --build . --config ${{ matrix.config.build_type }} --target silkworm -j 2
run: echo "Skip silkworm build to avoid fatal error C1002 compiler is out of heap space in pass 2"

- name: Build core_test
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target core_test -j 2

- name: Build infra_test
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target infra_test -j 2

- name: Build node_test
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target node_test -j 2

- name: Build rpcdaemon_test
working-directory: C:\build
# Skip rpcdaemon_test to avoid fatal error C1002: compiler is out of heap space in pass 2
# run: cmake --build . --config ${{ matrix.config.build_type }} --target rpcdaemon_test -j 2
run: echo "Skip rpcdaemon_test build to avoid fatal error C1002 compiler is out of heap space in pass 2"

- name: Build sentry_test
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target sentry_test -j 2

- name: Build sync_test
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target sync_test -j 2
run: cmake --build . --config ${{ matrix.config.build_type }} --target all_unit_tests -j 1

- name: Build Ethereum EL tests
working-directory: C:\build
run: cmake --build . --config ${{ matrix.config.build_type }} --target ethereum -j 2

- name: Test
- name: Unit tests
run: cmake -DSILKWORM_BUILD_DIR=C:\build -P cmake\run_unit_tests.cmake

- name: Ethereum EL tests
working-directory: C:\build
run: |
cmd/test/${{ matrix.config.build_type }}/core_test
cmd/test/${{ matrix.config.build_type }}/infra_test
cmd/test/${{ matrix.config.build_type }}/node_test
cmd/test/${{ matrix.config.build_type }}/sentry_test
cmd/test/${{ matrix.config.build_type }}/sync_test
cmd/test/${{ matrix.config.build_type }}/ethereum --threads 4
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@
[submodule "third_party/stun-msg"]
path = third_party/stun-msg
url = https://github.com/battlmonstr/stun-msg.git
[submodule "third_party/execution-apis"]
path = third_party/execution-apis
url = https://github.com/ethereum/execution-apis.git
branch = main
[submodule "third_party/picohttpparser"]
path = third_party/picohttpparser
url = https://github.com/h2o/picohttpparser
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
limitations under the License.
]]

# ethash requires cmake 3.16.2
cmake_minimum_required(VERSION 3.16.2)
cmake_minimum_required(VERSION 3.19.0)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/evmone/evmc/.git)
message(FATAL_ERROR "Git submodules not initialized, execute:\n git submodule update --init --recursive")
Expand Down Expand Up @@ -98,3 +97,15 @@ if(NOT SILKWORM_HAS_PARENT)
add_subdirectory(cmd)
add_subdirectory(examples)
endif()

# All unit tests target
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/get_all_targets.cmake)
get_all_targets(UNIT_TEST_TARGETS)
list(FILTER UNIT_TEST_TARGETS INCLUDE REGEX "_test$")
list(REMOVE_ITEM UNIT_TEST_TARGETS backend_kv_test benchmark_test sentry_client_test)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
# avoid fatal error C1002: compiler is out of heap space
list(REMOVE_ITEM UNIT_TEST_TARGETS rpcdaemon_test)
endif()
message(STATUS "UNIT_TEST_TARGETS: ${UNIT_TEST_TARGETS}")
add_custom_target(all_unit_tests DEPENDS ${UNIT_TEST_TARGETS})
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.PHONY: help fmt lint lint_copyright
.PHONY: help fmt lint lint_copyright run_unit_tests test

help:
@echo "Targets:"
@echo "make fmt - reformat the code"
@echo "make lint - run code checks"
@echo "make test - run built unit tests"

fmt:
@cmake -P cmake/cmake_format.cmake
Expand All @@ -13,3 +14,8 @@ lint_copyright:
@cmake -P cmake/copyright.cmake

lint: lint_copyright

run_unit_tests:
@cmake/run_unit_tests.sh $(SILKWORM_BUILD_DIR) $(SILKWORM_CLANG_COVERAGE)

test: run_unit_tests
Loading

0 comments on commit e73a36b

Please sign in to comment.