Makefile testing Add Makefile CI: configure-based dependency detection, build, and test#442
Open
sshi-amd wants to merge 40 commits intoROCm:amd-stagingfrom
Open
Makefile testing Add Makefile CI: configure-based dependency detection, build, and test#442sshi-amd wants to merge 40 commits intoROCm:amd-stagingfrom
sshi-amd wants to merge 40 commits intoROCm:amd-stagingfrom
Conversation
Signed-off-by: zichguan-amd <zichuan.guan@amd.com> (cherry picked from commit b185e37)
- Replace HIP_ARCHITECTURES (unused by individual example Makefiles) with CXXFLAGS="--offload-arch=..." which is how hipcc receives the target arch - Add if: cancelled guard so Makefile build runs even when ctest fails, preventing test failures from masking Makefile build results Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded `ROCM_INSTALL_DIR ?= /opt/rocm` with `ROCM_INSTALL_DIR := $(or $(ROCM_PATH),/opt/rocm)` across all 378 leaf Makefiles. This allows TheRock CI to set ROCM_PATH in the environment while preserving /opt/rocm as the default fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Makefile build unconditionally tried to compile all libraries, failing when optional dependencies (rocALUTION, MIVisionX, rocAL, hipTensor, MIGraphX, rocCV) aren't installed in the CI environment. Add wildcard header checks to mirror the CMake find_package() behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add RPP to conditional header checks (rpp/rpp.h missing in wheel env) - Skip rocProfiler-SDK openmp_target example when ENABLE_OPENMP=OFF (wheel installs lack amdllvm needed for OpenMP offloading) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set HIPCC_COMPILE_FLAGS_APPEND env var in CI to ensure all hipcc compilations target the correct GPU architecture. This fixes ~370 leaf Makefiles that don't pass --offload-arch, without affecting g++/amdclang++ examples since only hipcc reads this env var. Guard openmp_target behind an amdclang++ existence check so tarball installs that lack amdclang++ don't fail the Makefile build. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skip opengl_interop, vulkan_interop, and sobel_filter when glfw3/vulkan pkg-config packages are not available. Guard rocDecode and rocJPEG behind header existence checks, matching the pattern used for other optional libraries like hipTensor, MIGraphX, and rocAL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pkg-config is not installed in SLES and AlmaLinux CI containers, causing make to exit with code 2. Use $(wildcard ...) header detection instead, matching the pattern already used in Libraries/Makefile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two failures in the Makefile build step: 1. rocDecode examples link against FFmpeg (-lavcodec, -lavformat, -lavutil) which is not installed in CI containers. The rocdecode header check alone is insufficient — also check for FFmpeg headers before including rocDecode in the build. 2. rocProfiler-SDK/code_object_tracing fails with undefined symbol pthread_join — add missing -lpthread to the link command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add configure.sh and Common/require_deps.mk to detect external dependencies (FFmpeg, OpenCV, GLFW3, Vulkan, glslangValidator) before build. Each leaf Makefile declares REQUIRED_DEPS and cleanly skips when dependencies are missing, preventing link-time failures in CI. - configure.sh: probes deps via pkg-config with fallbacks, writes config.mk - require_deps.mk: checks REQUIRED_DEPS, sets SKIP_BUILD=1 if unmet - run_makefile_tests.sh: finds and runs Makefile-built executables with timeout and skip-file support - Update 27 leaf Makefiles (rocDecode, rocCV, RPP, opengl/vulkan_interop, sobel_filter) to use the new dependency gating - Remove FFmpeg guard from Libraries/Makefile (let leaves decide) - Update CI workflow: run configure.sh before make, run Makefile tests before CMake build - Fix rocProfiler-SDK/code_object_tracing: add -lpthread to ILDLIBS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The code_object_isa_decode example links -ldw and -lamd_comgr which are not available in all CI containers (e.g. AlmaLinux). Add LIBDW and AMD_COMGR to the configure detection system and skip the example when either is missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show (N/total) counter for each test like ctest does, e.g.: (1/42) RUN hip_device_query (1/42) PASS hip_device_query (2/42) SKIP rccl_allgather Also print total test count and skip file info upfront, and show a single summary line at the end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Run each test from its own directory so data files (test.jpg, graph4096.txt, etc.) are found via relative paths - Support TEST_ARGS variable in Makefiles for tests needing arguments (e.g. hip_bfs requires graph4096.txt as input) - Add AlmaLinux 8 skip entries for GLIBC_2.34 incompatible binaries (warp_size_reduction) and missing hipSPARSELt Tensile libraries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Only run Makefile-built tests that are also registered as ctest tests. This ensures the Makefile test runner exercises exactly the same set of examples that CMake validates, avoiding failures from examples that need special arguments, scripts, or aren't meant to run standalone. - Add --allow-file option to run_makefile_tests.sh: filters Makefile executables to only those present in the allow list - Move Makefile tests step after ctest in CI workflow - Extract ctest test names via `ctest -N` and pass as the allow file Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rocdecode_rocdec_decode requires -i <frames_dir> which is only available via ROCDECODE_TEST_FRAMES_DIR set during CMake configure. Add a MAKEFILE_SKIP_TESTS list to generate_skip_tests.py and a --makefile flag to include these skips. The CI Makefile tests step now regenerates the skip list with --makefile before running. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On SLES 15.7 the FFmpeg development headers exist at /usr/include/libavcodec/avcodec.h but the shared libraries are not installed, causing link failures. The header-only fallback in both configure.sh and require_deps.mk now also verifies the library is in ldconfig before reporting the dependency as available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The header-only fallback (checking /usr/include for headers) causes false positives on SLES where dev headers exist but libraries don't. Rely solely on pkg-config, which only succeeds when dev packages are properly installed with both headers and linkable libraries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…add -lstdc++fs rocdec_decode had inline pkg-config FFmpeg detection that bypassed the configure system. On SLES, pkg-config found .pc files but libraries couldn't actually be linked. Now uses HAVE_FFMPEG from config.mk/ require_deps.mk instead. Also adds -lstdc++fs to rocdec_decode and video_to_sequence for std::experimental::filesystem symbols needed on older toolchains. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ev packages On SLES, FFmpeg .pc files exist (runtime packages) but the actual libraries cannot be linked (-dev packages missing). pkg-config --exists succeeds but linking fails. Now both configure.sh and the require_deps.mk fallback verify that pkg-config libraries can actually be linked by compiling a trivial C program with the reported -l flags. Also integrates rocdec_decode with the configure system (HAVE_FFMPEG) instead of its own inline pkg-config detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The SLES wheel containers may not have cc/gcc. Try multiple compilers in order, including the ROCm-bundled clang as last resort. If no compiler is found, conservatively report the dependency as missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…format/-lavutil On SLES tarball, FFmpeg is installed under /usr/local/lib. pkg-config returns -L/usr/local/lib along with the -l flags, but the Makefiles were hardcoding just -lavcodec -lavformat -lavutil without the -L path. The ROCm linker (ld.lld) doesn't search /usr/local/lib by default, so linking failed. Now all 8 rocDecode Makefiles use $(FFMPEG_LIBS) which includes the correct -L path from pkg-config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace `ctest -N` + grep/sed (which listed *registered* tests) with `ctest --output-junit` + a Python script that parses the JUnit XML to extract tests that ctest *actually ran*. This ensures true parity between CMake and Makefile test sets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ails) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
--output-junit path was relative and may not resolve correctly with --test-dir. Use absolute path via GITHUB_WORKSPACE. Also handle missing XML gracefully (empty allow list if ctest didn't run). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Output now matches ctest style: - " Start N: test_name" before each test - "N/total Test #N: test_name .... Passed X.XX sec" with dot padding - Per-test timing in seconds - "X% tests passed, Y tests failed out of Z" summary - "Total Test time (real) = N.00 sec" footer - Skipped tests excluded from output (matching --exclude-from-file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Filter JUnit XML to only include passed tests (no <failure> element). Tests that failed in ctest won't be retried via the Makefile runner. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add instructions for running configure.sh before Make builds to detect external dependencies, and document run_makefile_tests.sh usage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move Test summary step after Makefile tests so it covers both - Add CMake and Makefile test results to the GitHub step summary - Upload Makefile test output as a separate artifact - Remove duplicate skipped-tests output from ctest step (now in summary) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collect Makefile-built executables into a staging directory and upload them as a separate artifact, matching the CMake build artifact upload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ensures subsequent steps (CMake, tests, uploads) still run even if the Makefile build fails, while still marking the workflow as failed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move CMake and Makefile build uploads to the same location, after both CMake and Makefile builds finish, so artifacts are logically grouped. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Mirror of #441 however different implementation
Technical Details
A
configure.shscript probes the system for external libraries (FFmpeg, OpenCV, etc.) via pkg-config and link tests, then writes aconfig.mkfile. Each leaf Makefile declares its dependencies (REQUIRED_DEPS := ffmpeg opencv) and includesCommon/require_deps.mk, which skips the build if any dependency is missing.configure.shthat probes for external dependencies (FFmpeg, OpenCV, GLFW3, Vulkan, libdw, amd_comgr) via pkg-config + link tests, writesconfig.mkCommon/require_deps.mk— leaf Makefiles declareREQUIRED_DEPS, build is skipped if dependencies are missingrun_makefile_tests.shtest runner with ctest-style output formatparse_ctest_results.pyto extract passed tests from ctest JUnit XML as the Makefile test allow listgenerate_skip_tests.pyfor per-GPU, per-distro, and Makefile-specific test skipsTest Plan
Ran through local CI on GFX 1100: https://github.com/sshi-amd/rocm-examples/actions/runs/23504530396
(some tests were skipped due to time and ones that are unpredictable (rocprof-systems-advanced))
Test Result
Added/Updated documentation?
Included Visual Studio files?
Submission Checklist