Skip to content

Commit e9b52ca

Browse files
committed
Discard auto_viz_demo's trace output in its CTest test
auto_viz's pipelines are built with trace_all, but auto_viz_demo.cpp never sets HL_TRACE_FILE, so Halide's default trace handler falls back to formatting every load/store/produce/consume event as plain text via halide_print. For even the small test image that's tens of millions of lines (multiple GB) of stdout. Direct execution is merely slow, but a test runner that captures/streams that output (e.g. `ctest -V`, as the buildbot uses) can burn through the entire test timeout on it. Point HL_TRACE_FILE at the null device for the auto_viz_demo test so it exercises the same binary trace-writing path (still a meaningful check that trace_all pipelines run) while discarding the output almost instantly.
1 parent 071797a commit e9b52ca

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/auto_viz/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ add_executable(auto_viz_demo auto_viz_demo.cpp)
4040
target_link_libraries(auto_viz_demo PRIVATE Halide::ImageIO ${variants})
4141

4242
# Test that the app actually works!
43+
#
44+
# The libraries above are built with trace_all, and auto_viz_demo.cpp never
45+
# installs a custom trace handler or points HL_TRACE_FILE anywhere, so by
46+
# default every load/store/produce/consume event is formatted as plain text
47+
# and printed via halide_print. For even this small test image that's tens of
48+
# millions of lines (multiple GB) of stdout, which is merely slow to produce
49+
# directly but can consume a CI test run's entire timeout once a test runner
50+
# is capturing/streaming that output (e.g. `ctest -V`). Route the trace to
51+
# the null device instead: this exercises the exact same tracing code path
52+
# (so the test remains a meaningful check that trace_all pipelines still run)
53+
# while discarding the output near-instantly.
54+
if (WIN32)
55+
set(_auto_viz_trace_sink "NUL")
56+
else ()
57+
set(_auto_viz_trace_sink "/dev/null")
58+
endif ()
59+
4360
set(IMAGE ${CMAKE_CURRENT_LIST_DIR}/../images/rgb_small.png)
4461
if (EXISTS ${IMAGE})
4562
configure_file(${IMAGE} rgb_small.png COPYONLY)
@@ -48,6 +65,7 @@ if (EXISTS ${IMAGE})
4865
auto_viz_demo
4966
PROPERTIES
5067
LABELS auto_viz
68+
ENVIRONMENT "HL_TRACE_FILE=${_auto_viz_trace_sink}"
5169
SKIP_REGULAR_EXPRESSION "\\[SKIP\\]"
5270
)
5371
endif ()

0 commit comments

Comments
 (0)