From ff2bf0f6fcdf3a4b50b326b9a8bd3ac834c184d9 Mon Sep 17 00:00:00 2001 From: Mikhail Sherstennikov Date: Mon, 8 Jan 2024 16:15:11 +0200 Subject: [PATCH] Testing Signed-off-by: Mikhail Sherstennikov --- .github/workflows/evm-compiler-push.yml | 29 +++++++++++++++++ llvm/projects/evm-tests/CMakeLists.txt | 23 +++++++++++++ .../evm-tests}/evm_test.rb | 0 llvm/projects/evm-tests/run_evm_tests.sh | 32 +++++++++++++++++++ llvm/projects/evm-tests/test.cpp | 0 llvm/tools/CMakeLists.txt | 2 +- llvm/tools/evm-test/CMakeLists.txt | 18 +++++------ 7 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/evm-compiler-push.yml create mode 100644 llvm/projects/evm-tests/CMakeLists.txt rename llvm/{tools/evm-test => projects/evm-tests}/evm_test.rb (100%) create mode 100755 llvm/projects/evm-tests/run_evm_tests.sh delete mode 100644 llvm/projects/evm-tests/test.cpp diff --git a/.github/workflows/evm-compiler-push.yml b/.github/workflows/evm-compiler-push.yml new file mode 100644 index 000000000000..1c107ed7d846 --- /dev/null +++ b/.github/workflows/evm-compiler-push.yml @@ -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/actions-setup-cmake@v1.13 + 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 \ No newline at end of file diff --git a/llvm/projects/evm-tests/CMakeLists.txt b/llvm/projects/evm-tests/CMakeLists.txt new file mode 100644 index 000000000000..42cb907b5271 --- /dev/null +++ b/llvm/projects/evm-tests/CMakeLists.txt @@ -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 git@github.com:NilFoundation/evmone.git + GIT_TAG 2de80207495b3a05304962f6517691e979326ddc + CONFIGURE_COMMAND ${CMAKE_COMMAND} -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 +) diff --git a/llvm/tools/evm-test/evm_test.rb b/llvm/projects/evm-tests/evm_test.rb similarity index 100% rename from llvm/tools/evm-test/evm_test.rb rename to llvm/projects/evm-tests/evm_test.rb diff --git a/llvm/projects/evm-tests/run_evm_tests.sh b/llvm/projects/evm-tests/run_evm_tests.sh new file mode 100755 index 000000000000..ad591dca822b --- /dev/null +++ b/llvm/projects/evm-tests/run_evm_tests.sh @@ -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 diff --git a/llvm/projects/evm-tests/test.cpp b/llvm/projects/evm-tests/test.cpp deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/llvm/tools/CMakeLists.txt b/llvm/tools/CMakeLists.txt index 9ae54f0dc85b..5576fc3bf367 100644 --- a/llvm/tools/CMakeLists.txt +++ b/llvm/tools/CMakeLists.txt @@ -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 diff --git a/llvm/tools/evm-test/CMakeLists.txt b/llvm/tools/evm-test/CMakeLists.txt index 1218c3fd25cf..e27dc6fd9a1b 100644 --- a/llvm/tools/evm-test/CMakeLists.txt +++ b/llvm/tools/evm-test/CMakeLists.txt @@ -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 +#)