From 21b3b1af438122f828049a25c5425b4340f587a5 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 15 Dec 2024 05:10:05 -0500 Subject: [PATCH 1/2] Fixing tets --- src/dev_tools/testRunner/testCases/status.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dev_tools/testRunner/testCases/status.csv b/src/dev_tools/testRunner/testCases/status.csv index acd1a5d094..5112c086d8 100644 --- a/src/dev_tools/testRunner/testCases/status.csv +++ b/src/dev_tools/testRunner/testCases/status.csv @@ -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 @@ -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 @@ -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 From 04bf7b454fa758946c34bfc9fab2fa11296d58c1 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 15 Dec 2024 05:57:40 -0500 Subject: [PATCH 2/2] Linting and cleaning CMakeLists.txt file --- .cmakelintrc | 2 + src/CMakeLists.txt | 115 +++++++++++++++++++------------ src/other/install/CMakeLists.txt | 6 +- 3 files changed, 78 insertions(+), 45 deletions(-) create mode 100644 .cmakelintrc diff --git a/.cmakelintrc b/.cmakelintrc new file mode 100644 index 0000000000..0bc5a1df0c --- /dev/null +++ b/.cmakelintrc @@ -0,0 +1,2 @@ +set filters=-linelength + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f189377d6..2a91773e83 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,29 +1,33 @@ -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( @@ -31,67 +35,92 @@ execute_process( 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) @@ -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) diff --git a/src/other/install/CMakeLists.txt b/src/other/install/CMakeLists.txt index df1dfc0d7d..57b3fc07ed 100644 --- a/src/other/install/CMakeLists.txt +++ b/src/other/install/CMakeLists.txt @@ -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)