Skip to content

Commit

Permalink
Merge pull request #3925 from TrueBlocks/feature/send-3
Browse files Browse the repository at this point in the history
Fixing tets
  • Loading branch information
tjayrush authored Dec 15, 2024
2 parents 3e40869 + 04bf7b4 commit 801cbc0
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .cmakelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set filters=-linelength

115 changes: 72 additions & 43 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,97 +1,126 @@
cmake_minimum_required (VERSION 3.5)
cmake_minimum_required(VERSION 3.16)
if(POLICY CMP0175)
cmake_policy(SET CMP0175 NEW)
endif()

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
if(NOT WIN32)
string(ASCII 27 Esc)
set(COff "${Esc}[m")
set(CColor "${Esc}[1;35m") # magenta
endif()

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
project(trueBlocks)

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
message(STATUS "======== LOOKING FOR PYTHON ========================")
find_package(Python COMPONENTS Interpreter Development)

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
message(STATUS "======== LOOKING FOR CURL ========================")
find_package(CURL REQUIRED)

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
message(STATUS "======== LOOKING FOR GOLANG ========================")
find_program(GO_EXECUTABLE NAMES go)
if (NOT GO_EXECUTABLE)
if(NOT GO_EXECUTABLE)
message(STATUS "${CColor}GoLang not found!${COff}")
message(STATUS "${CColor}Please install Go from https://golang.org/doc/install.${COff}")
message(STATUS "${CColor}Please install Go from \
https://golang.org/doc/install.${COff}")
return()
endif()
execute_process(
COMMAND ${GO_EXECUTABLE} version
OUTPUT_VARIABLE GO_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "go([0-9]+)\\.([0-9]+)\\.[0-9]+" GO_VERSION_MATCH "${GO_VERSION_OUTPUT}")
if (NOT GO_VERSION_MATCH)
message(STATUS "${CColor}Could not determine GoLang version from output: ${GO_VERSION_OUTPUT}.${COff}")
message(STATUS "${CColor}Please install Go from https://golang.org/doc/install.${COff}")
string(REGEX MATCH "go([0-9]+)\\.([0-9]+)\\.[0-9]+"
GO_VERSION_MATCH "${GO_VERSION_OUTPUT}")

if(NOT GO_VERSION_MATCH)
message(STATUS "${CColor}Could not determine GoLang version from output: \
${GO_VERSION_OUTPUT}.${COff}")
message(STATUS "${CColor}Please install Go from \
https://golang.org/doc/install.${COff}")
return()
endif()
set(GO_MAJOR_VERSION ${CMAKE_MATCH_1})
set(GO_MINOR_VERSION ${CMAKE_MATCH_2})
# Go Version
if (GO_MAJOR_VERSION LESS 1 OR (GO_MAJOR_VERSION EQUAL 1 AND GO_MINOR_VERSION LESS 23))

if(GO_MAJOR_VERSION LESS 1 OR
(GO_MAJOR_VERSION EQUAL 1 AND GO_MINOR_VERSION LESS 23))
message(STATUS "${CColor}The build failed.${COff}")
message(STATUS "${CColor}Found ${GO_VERSION_OUTPUT}. Go Version 1.23 or higher is required.${COff}")
message(STATUS "${CColor}Please install or update Go from https://golang.org/doc/install.${COff}")
message(STATUS "${CColor}Found ${GO_VERSION_OUTPUT}. Go Version 1.23 or "
"higher is required.${COff}")
message(STATUS "${CColor}Please install or update Go from "
"https://golang.org/doc/install.${COff}")
return()
else()
message(STATUS "Found GoLang: ${GO_VERSION_OUTPUT}")
endif()

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
set(BIN_DIR ${CMAKE_SOURCE_DIR}/../bin)
set(EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/../bin/examples)

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
set(CMAKE_INSTALL_PREFIX "/usr/local/" CACHE PATH "Default install directory")

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
set(REPO_DIR ${CMAKE_SOURCE_DIR}/..)
set(SCRIPTS_DIR ${REPO_DIR}/scripts)

add_custom_target(lint COMMAND "golangci-lint" "run" "--out-format=colored-line-number" "--path-prefix=src/apps/chifra" "--timeout=5m" "./..." WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/apps/chifra")
add_custom_target(generate COMMAND ${BIN_DIR}/goMaker WORKING_DIRECTORY ${REPO_DIR})
add_custom_target(test-all COMMAND ${SCRIPTS_DIR}/test-all.sh WORKING_DIRECTORY ${REPO_DIR}/build)
add_custom_target(examples ALL COMMAND ${SCRIPTS_DIR}/build-examples.sh WORKING_DIRECTORY ${REPO_DIR})
add_custom_target(lint
COMMAND "golangci-lint" "run"
"--out-format=colored-line-number"
"--path-prefix=src/apps/chifra"
"--timeout=5m" "./..."
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/apps/chifra")

add_custom_target(generate
COMMAND ${BIN_DIR}/goMaker
WORKING_DIRECTORY ${REPO_DIR})

add_custom_target(test-all
COMMAND ${SCRIPTS_DIR}/test-all.sh
WORKING_DIRECTORY ${REPO_DIR}/build)

# ----------------------------------------------------------------------------------------
function(ADD_GO_INSTALLABLE_PROGRAM NAME MAIN_SRC DEST_DIR)
add_custom_target(examples ALL
COMMAND ${SCRIPTS_DIR}/build-examples.sh
WORKING_DIRECTORY ${REPO_DIR})

# ----------------------------------------------------------------------------
function(add_go_installable_program NAME MAIN_SRC DEST_DIR)
get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE)
file(GLOB SRC_FILE_LIST "${MAIN_SRC}/*.go")
set(EXE_NAME ${NAME})
if (WIN32)
if(WIN32)
set(EXE_NAME ${NAME}.exe)
endif()

add_custom_target(${NAME} ALL)
add_custom_command(TARGET ${NAME}
POST_BUILD
COMMAND go build
-o "${DEST_DIR}/${EXE_NAME}"
${CMAKE_GO_FLAGS} ${SRC_FILE_LIST}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS ${MAIN_SRC_ABS} ${MAIN_SRC})
endfunction(ADD_GO_INSTALLABLE_PROGRAM)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
endfunction()

# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------
add_subdirectory(other/install)

ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR})
ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR})
ADD_GO_INSTALLABLE_PROGRAM(indexManager ${CMAKE_SOURCE_DIR}/dev_tools/indexManager ${BIN_DIR})
if (NOT WIN32)
ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR})
ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR})
add_go_installable_program(chifra
${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR})
add_go_installable_program(goMaker
${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR})
add_go_installable_program(indexManager
${CMAKE_SOURCE_DIR}/dev_tools/indexManager ${BIN_DIR})

if(NOT WIN32)
add_go_installable_program(testRunner
${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR})
add_go_installable_program(sdkFuzzer
${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR})
add_dependencies(testRunner goMaker)
add_dependencies(sdkFuzzer goMaker)
add_dependencies(indexManager goMaker)
Expand All @@ -100,9 +129,9 @@ endif()

add_dependencies(examples chifra)

file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go")
file(GLOB CHIFRA_FOR_DOCKER_FILES
"${CMAKE_SOURCE_DIR}/apps/chifra/*.go")
add_custom_target(chifra-for-docker ALL
COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CHIFRA_FOR_DOCKER_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra
DEPENDS ${CHIFRA_FOR_DOCKER_FILES}
)
COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra
${CHIFRA_FOR_DOCKER_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra)
6 changes: 3 additions & 3 deletions src/dev_tools/testRunner/testCases/status.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,items_blocks_dup ,y ,mode
on ,both ,fast ,status ,apps ,cacheStatus ,items_logs ,y ,modes = logs & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_slurps ,y ,modes = slurps & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_state ,y ,modes = state & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_statements ,y ,modes = statements & max_records = 100
off ,both ,fast ,status ,apps ,cacheStatus ,items_statements ,y ,modes = statements & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_tokens ,y ,modes = tokens & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_traces ,y ,modes = traces & max_records = 100
on ,both ,fast ,status ,apps ,cacheStatus ,items_txs ,y ,modes = transactions & max_records = 100
Expand Down Expand Up @@ -56,7 +56,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,mode_blocks_dup ,y ,mode
on ,both ,fast ,status ,apps ,cacheStatus ,mode_logs ,y ,modes = logs & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_slurps ,y ,modes = slurps & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_state ,y ,modes = state & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_statements ,y ,modes = statements & verbose & max_records = 2
off ,both ,fast ,status ,apps ,cacheStatus ,mode_statements ,y ,modes = statements & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_tokens ,y ,modes = tokens & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_traces ,y ,modes = traces & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_txs ,y ,modes = transactions & verbose & max_records = 2
Expand All @@ -70,7 +70,7 @@ on ,both ,fast ,status ,apps ,cacheStatus ,mode_unripe ,y ,mode
on ,both ,fast ,status ,apps ,cacheStatus ,mode_maps ,y ,modes = maps & verbose & max_records = 2

on ,both ,fast ,status ,apps ,cacheStatus ,mode_some ,y ,modes = some & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_all ,y ,modes = all & verbose & max_records = 2
off ,both ,fast ,status ,apps ,cacheStatus ,mode_all ,y ,modes = all & verbose & max_records = 2
on ,both ,fast ,status ,apps ,cacheStatus ,mode_three ,y ,modes = abis & modes = monitors & modes = transactions & verbose & max_records = 2

on ,both ,fast ,status ,apps ,cacheStatus ,explorer_1 ,y ,fmt = json & verbose & max_records = 2
Expand Down
6 changes: 4 additions & 2 deletions src/other/install/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
cmake_minimum_required (VERSION 3.5)
add_custom_target(init_configs ALL COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/init_configs.cmake)
cmake_minimum_required(VERSION 3.16)
add_custom_target(init_configs ALL
COMMAND ${CMAKE_COMMAND}
-P ${CMAKE_CURRENT_SOURCE_DIR}/init_configs.cmake)

0 comments on commit 801cbc0

Please sign in to comment.