Skip to content

Commit 56c4b65

Browse files
committed
add debug printing
1 parent fb17e8b commit 56c4b65

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/call-build-ttmlir-toolchain.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ jobs:
212212
env:
213213
TTMLIR_TOOLCHAIN_DIR: ${{ github.workspace }}/ttmlir-toolchain
214214
CMAKE_BUILD_PARALLEL_LEVEL: 2
215+
TTLANG_CMAKE_DEBUG: 1 # TODO: remove after debugging
215216

216217
steps:
217218
- name: Checkout tt-lang

cmake/modules/TTLangUtils.cmake

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ function(ttlang_execute_with_env)
6060

6161
set(_exec_args
6262
COMMAND_ECHO STDOUT
63-
COMMAND_ERROR_IS_FATAL ANY
63+
RESULT_VARIABLE _result
64+
OUTPUT_VARIABLE _stdout
65+
ERROR_VARIABLE _stderr
6466
)
6567

6668
if(ARG_WORKING_DIRECTORY)
@@ -71,6 +73,20 @@ function(ttlang_execute_with_env)
7173
COMMAND /bin/bash -c ". ${ARG_ENV_SCRIPT} && ${ARG_COMMAND}"
7274
${_exec_args}
7375
)
76+
77+
# Print output if TTLANG_CMAKE_DEBUG is set or on failure
78+
if(DEFINED ENV{TTLANG_CMAKE_DEBUG} OR NOT _result EQUAL 0)
79+
if(_stdout)
80+
message(STATUS "Command output:\n${_stdout}")
81+
endif()
82+
if(_stderr)
83+
message(STATUS "Command stderr:\n${_stderr}")
84+
endif()
85+
endif()
86+
87+
if(NOT _result EQUAL 0)
88+
message(FATAL_ERROR "Command failed with exit code ${_result}")
89+
endif()
7490
endfunction()
7591

7692
# ttlang_collect_ttmlir_link_libs(OUTPUT_VAR)

0 commit comments

Comments
 (0)