Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Sherstennikov <[email protected]>
  • Loading branch information
shermike committed Jan 8, 2024
1 parent 453a50e commit ff2bf0f
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 10 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/evm-compiler-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: EVM compiler testing

on:
pull_request:
branches: [ evm-compiler ]

jobs:
common_tests:
runs-on: [self-hosted, tests-runner]
name: Common tests

steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_CHECKOUT_SECRET || github.token }}
- name: Set up cmake 3.22
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.x'
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
- name: Run regression EVM tests
run: |
bash llvm/projects/evm-tests/run_evm_tests.sh
# - name: Run LLVM codegen tests
# run: |
# ./bin/llvm-lit llvm/test/CodeGen/EVM/*.ll
23 changes: 23 additions & 0 deletions llvm/projects/evm-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include(ExternalProject)

set(EVM_TEST_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/evm_test.rb)
set(EVMONE_BUILD_DIR ${CMAKE_BINARY_DIR}/evmone-build)
set(EVMONE_SOURCE_DIR ${CMAKE_BINARY_DIR}/evmone-source)

set(EVMONE_CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Debug
-DEVMC_TOOLS=ON
-DEVMONE_TESTING=OFF
-DCMAKE_INSTALL_PREFIX=${EVMONE_BUILD_DIR}/install
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
)

ExternalProject_Add(evmone
GIT_REPOSITORY [email protected]:NilFoundation/evmone.git
GIT_TAG 2de80207495b3a05304962f6517691e979326ddc
CONFIGURE_COMMAND ${CMAKE_COMMAND} <SOURCE_DIR> -G ${CMAKE_GENERATOR} ${EVMONE_CMAKE_ARGS}
SOURCE_DIR ${EVMONE_SOURCE_DIR}
BINARY_DIR ${EVMONE_BUILD_DIR}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${EVMONE_BUILD_DIR} --target evmone evmc-tool
)
File renamed without changes.
32 changes: 32 additions & 0 deletions llvm/projects/evm-tests/run_evm_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash -e

set -x

SOURCE_DIR=$(realpath `dirname -- "$0"`)
NPROC=$(nproc)

pwd
ls

cmake --version
c++ --version

cmake ${SOURCE_DIR}/../../ -DCMAKE_BUILD_TYPE=Debug \
-G Ninja \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="EVM" \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=EVM \
-DCMAKE_INSTALL_PREFIX=./install \
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
-DDEFAULT_SYSROOT=/usr \
-DEVM_HOST=ON \
-DLLVM_DISTRIBUTION_COMPONENTS="clang;evm-stdlib;zkllvm-cxx-headers;zkllvm-c-headers"

cmake --build . --target install-distribution evmone -j${NPROC}
#ninja install-distribution -j${NPROC}
#ninja evmone -j${NPROC}

ruby ${SOURCE_DIR}/evm_test.rb \
--bin-dir ./bin \
--glob "${SOURCE_DIR}/common_tests/*.{s,cpp}" \
--no-ctor --clang-args "--sysroot=./install" --evmone evmone-build
Empty file removed llvm/projects/evm-tests/test.cpp
Empty file.
2 changes: 1 addition & 1 deletion llvm/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)

if (LLVM_TOOL_LLVM_DRIVER_BUILD)
# This is explicitly added at the end _after_ all tool projects so that it can
# scrape up tools from other projects into itself.
# scrape up tools from other projects icuckoldnto itself.
add_subdirectory(llvm-driver)
# This must be here otherwise CMake complains in add_llvm_tool_symlink that
# it can't add_custom_command that happens after llvm-driver is built because
Expand Down
18 changes: 9 additions & 9 deletions llvm/tools/evm-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

set(CLANG_ARGS --sysroot=${CMAKE_BINARY_DIR})
set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/cpp-stdlib/libcpp")
set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/cpp-stdlib/libc/include")
set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/evm-stdlib/include")

add_custom_target(evm-tests
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/evm_test.rb --bin-dir ${CMAKE_BINARY_DIR}/bin --glob \"${CMAKE_SOURCE_DIR}/test/CodeGen/EVM/runtime_tests/**/*.{c,cpp}\" --no-ctor --clang-args ${CLANG_ARGS}
DEPENDS clang evm-linker evm_test.rb evm-stdlib
)
#set(CLANG_ARGS --sysroot=${CMAKE_BINARY_DIR})
#set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/cpp-stdlib/libcpp")
#set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/cpp-stdlib/libc/include")
#set(CLANG_ARGS "${CLANG_ARGS} -I${CMAKE_SOURCE_DIR}/projects/evm-sdk/evm-stdlib/include")
#
#add_custom_target(evm-tests
# COMMAND ../../projects/evm-tests/evm_test.rb --bin-dir ${CMAKE_BINARY_DIR}/bin --glob \"${CMAKE_SOURCE_DIR}/test/CodeGen/EVM/runtime_tests/**/*.{c,cpp}\" --no-ctor --clang-args ${CLANG_ARGS}
# DEPENDS clang evm-linker ../../projects/evm-tests/evm_test.rb evm-stdlib
#)

0 comments on commit ff2bf0f

Please sign in to comment.