-
Notifications
You must be signed in to change notification settings - Fork 377
Add infrastructure for HIP catch tests; add unit/compiler tests #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
External/HIP/HipCatchTests.cmake
Outdated
| # Generate enhanced summary script with individual test tracking | ||
| set(_summary_script "${CMAKE_CURRENT_BINARY_DIR}/catch_tests/summary_${CATEGORY}_${SUBDIR}_${VARIANT_SUFFIX}.sh") | ||
| file(WRITE "${_summary_script}" "#!/bin/bash\n") | ||
| file(APPEND "${_summary_script}" "# Enhanced summary script for Catch2 TEST_CASE statistics\n") | ||
| file(APPEND "${_summary_script}" "cd ${CMAKE_CURRENT_BINARY_DIR}\n") | ||
| file(APPEND "${_summary_script}" "echo \"\"\n") | ||
| file(APPEND "${_summary_script}" "echo \"========================================\"\n") | ||
| file(APPEND "${_summary_script}" "echo \"Detailed Test Summary:\"\n") | ||
| file(APPEND "${_summary_script}" "TOTAL_FILES=0\n") | ||
| file(APPEND "${_summary_script}" "TOTAL_TESTS=0\n") | ||
| file(APPEND "${_summary_script}" "PASSED_TESTS=0\n") | ||
| file(APPEND "${_summary_script}" "FAILED_TESTS=0\n") | ||
| file(APPEND "${_summary_script}" "SKIPPED_TESTS=0\n") | ||
| file(APPEND "${_summary_script}" "CRASHED_TESTS=0\n") | ||
| file(APPEND "${_summary_script}" "# Arrays to track test names for triage\n") | ||
| file(APPEND "${_summary_script}" "FAILED_LIST=\"\"\n") | ||
| file(APPEND "${_summary_script}" "SKIPPED_LIST=\"\"\n") | ||
| file(APPEND "${_summary_script}" "CRASHED_LIST=\"\"\n") | ||
| file(APPEND "${_summary_script}" "for test in catch_tests/catch_${CATEGORY}_${SUBDIR}_*-${VARIANT_SUFFIX}; do\n") | ||
| file(APPEND "${_summary_script}" " if [ -x \"\$test\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " TOTAL_FILES=\$((TOTAL_FILES + 1))\n") | ||
| file(APPEND "${_summary_script}" " TEST_BASENAME=\$(basename \"\$test\")\n") | ||
| file(APPEND "${_summary_script}" " # Get test names from --list-tests\n") | ||
| file(APPEND "${_summary_script}" " LIST_OUTPUT=\$(\"\$test\" --list-tests 2>&1)\n") | ||
| file(APPEND "${_summary_script}" " FILE_TOTAL=\$(echo \"\$LIST_OUTPUT\" | tail -1 | grep -o '^[0-9]*' || echo 0)\n") | ||
| file(APPEND "${_summary_script}" " TOTAL_TESTS=\$((TOTAL_TESTS + FILE_TOTAL))\n") | ||
| file(APPEND "${_summary_script}" " # Extract individual test names (lines starting with spaces after 'All available test cases:')\n") | ||
| file(APPEND "${_summary_script}" " TEST_NAMES=\$(echo \"\$LIST_OUTPUT\" | grep '^ ' | sed 's/^ //')\n") | ||
| file(APPEND "${_summary_script}" " # Parse the corresponding .test.out file for results\n") | ||
| file(APPEND "${_summary_script}" " OUT_FILE=\"Output/\${TEST_BASENAME}.test.out\"\n") | ||
| file(APPEND "${_summary_script}" " if [ -f \"\$OUT_FILE\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " CASES_PASSED=0\n") | ||
| file(APPEND "${_summary_script}" " CASES_FAILED=0\n") | ||
| file(APPEND "${_summary_script}" " PARSED=0\n") | ||
| file(APPEND "${_summary_script}" " FILE_FAILED_NAMES=\"\"\n") | ||
| file(APPEND "${_summary_script}" " FILE_SKIPPED_NAMES=\"\"\n") | ||
| file(APPEND "${_summary_script}" " FILE_CRASHED_NAMES=\"\"\n") | ||
| file(APPEND "${_summary_script}" " # Parse Catch2 output - try multiple formats (prefer final summary over intermediate)\n") | ||
| file(APPEND "${_summary_script}" " # Format 1: 'All tests passed (N assertion in M test cases)' - final summary, most accurate\n") | ||
| file(APPEND "${_summary_script}" " ALL_PASSED_LINE=\$(grep 'All tests passed' \"\$OUT_FILE\" 2>/dev/null | tail -1 || echo \"\")\n") | ||
| file(APPEND "${_summary_script}" " if [ -n \"\$ALL_PASSED_LINE\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " PARSED=1\n") | ||
| file(APPEND "${_summary_script}" " CASES_PASSED=\$(echo \"\$ALL_PASSED_LINE\" | grep -o 'in [0-9]* test case' | grep -o '[0-9]*' || echo 0)\n") | ||
| file(APPEND "${_summary_script}" " CASES_FAILED=0\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " # Format 2: 'test cases: X | Y passed | Z failed' - use LAST occurrence (final summary)\n") | ||
| file(APPEND "${_summary_script}" " if [ \$PARSED -eq 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " SUMMARY_LINE=\$(grep '^test cases:' \"\$OUT_FILE\" 2>/dev/null | tail -1 || echo \"\")\n") | ||
| file(APPEND "${_summary_script}" " if [ -n \"\$SUMMARY_LINE\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " PARSED=1\n") | ||
| file(APPEND "${_summary_script}" " CASES_PASSED=\$(echo \"\$SUMMARY_LINE\" | grep -o '[0-9]* passed' | grep -o '[0-9]*' || echo 0)\n") | ||
| file(APPEND "${_summary_script}" " CASES_FAILED=\$(echo \"\$SUMMARY_LINE\" | grep -o '[0-9]* failed' | grep -o '[0-9]*' || echo 0)\n") | ||
| file(APPEND "${_summary_script}" " CASES_TOTAL=\$(echo \"\$SUMMARY_LINE\" | sed 's/test cases: \\([0-9]*\\).*/\\1/')\n") | ||
| file(APPEND "${_summary_script}" " if [ \$CASES_PASSED -eq 0 ] && [ \$CASES_FAILED -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " CASES_PASSED=\$((CASES_TOTAL - CASES_FAILED))\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " # Update totals if we parsed something\n") | ||
| file(APPEND "${_summary_script}" " if [ \$PARSED -eq 1 ]; then\n") | ||
| file(APPEND "${_summary_script}" " # Detect runtime skips by parsing 'is skipped' messages\n") | ||
| file(APPEND "${_summary_script}" " RUNTIME_SKIPPED=\$(grep -i 'is skipped' \"\$OUT_FILE\" 2>/dev/null | wc -l)\n") | ||
| file(APPEND "${_summary_script}" " if [ \$RUNTIME_SKIPPED -gt 0 ] && [ \$CASES_PASSED -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " if [ \$RUNTIME_SKIPPED -gt \$CASES_PASSED ]; then\n") | ||
| file(APPEND "${_summary_script}" " RUNTIME_SKIPPED=\$CASES_PASSED\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " CASES_PASSED=\$((CASES_PASSED - RUNTIME_SKIPPED))\n") | ||
| file(APPEND "${_summary_script}" " SKIPPED_TESTS=\$((SKIPPED_TESTS + RUNTIME_SKIPPED))\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " # Find failed and skipped test names by cross-referencing --list-tests with output\n") | ||
| file(APPEND "${_summary_script}" " # Catch2 console reporter shows 'TestName passed' for tests that passed\n") | ||
| file(APPEND "${_summary_script}" " FAILED_COUNT=\$CASES_FAILED\n") | ||
| file(APPEND "${_summary_script}" " SKIPPED_COUNT=\$RUNTIME_SKIPPED\n") | ||
| file(APPEND "${_summary_script}" " if [ -n \"\$TEST_NAMES\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " while IFS= read -r tname; do\n") | ||
| file(APPEND "${_summary_script}" " [ -z \"\$tname\" ] && continue\n") | ||
| file(APPEND "${_summary_script}" " # Trim trailing whitespace from test name\n") | ||
| file(APPEND "${_summary_script}" " tname=\$(echo \"\$tname\" | sed 's/[[:space:]]*\$//')\n") | ||
| file(APPEND "${_summary_script}" " [ -z \"\$tname\" ] && continue\n") | ||
| file(APPEND "${_summary_script}" " # Check if this test passed\n") | ||
| file(APPEND "${_summary_script}" " if grep -q \"^\$tname passed\" \"\$OUT_FILE\" 2>/dev/null; then\n") | ||
| file(APPEND "${_summary_script}" " : # Test passed, nothing to track\n") | ||
| file(APPEND "${_summary_script}" " elif [ \$SKIPPED_COUNT -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " # Test didn't pass - count as skipped first\n") | ||
| file(APPEND "${_summary_script}" " FILE_SKIPPED_NAMES=\"\${FILE_SKIPPED_NAMES}\${tname}|\"\n") | ||
| file(APPEND "${_summary_script}" " SKIPPED_COUNT=\$((SKIPPED_COUNT - 1))\n") | ||
| file(APPEND "${_summary_script}" " elif [ \$FAILED_COUNT -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " # Test didn't pass and no more skips - count as failed\n") | ||
| file(APPEND "${_summary_script}" " FILE_FAILED_NAMES=\"\${FILE_FAILED_NAMES}\${tname}|\"\n") | ||
| file(APPEND "${_summary_script}" " FAILED_COUNT=\$((FAILED_COUNT - 1))\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " done <<< \"\$TEST_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " PASSED_TESTS=\$((PASSED_TESTS + CASES_PASSED))\n") | ||
| file(APPEND "${_summary_script}" " FAILED_TESTS=\$((FAILED_TESTS + CASES_FAILED))\n") | ||
| file(APPEND "${_summary_script}" " # Categorize incomplete tests using exit code\n") | ||
| file(APPEND "${_summary_script}" " INCOMPLETE=\$((FILE_TOTAL - CASES_PASSED - CASES_FAILED - RUNTIME_SKIPPED))\n") | ||
| file(APPEND "${_summary_script}" " FILE_EXIT=\$(grep '^EXIT_CODE:' \"\$OUT_FILE\" 2>/dev/null | tail -1 | grep -o '[0-9]*' || echo 1)\n") | ||
| file(APPEND "${_summary_script}" " if [ \$INCOMPLETE -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " if [ \"\$FILE_EXIT\" -eq 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " SKIPPED_TESTS=\$((SKIPPED_TESTS + INCOMPLETE))\n") | ||
| file(APPEND "${_summary_script}" " else\n") | ||
| file(APPEND "${_summary_script}" " CRASHED_TESTS=\$((CRASHED_TESTS + INCOMPLETE))\n") | ||
| file(APPEND "${_summary_script}" " # Track crashed test names - tests that didn't pass and weren't explicitly categorized\n") | ||
| file(APPEND "${_summary_script}" " if [ -n \"\$TEST_NAMES\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " while IFS= read -r tname; do\n") | ||
| file(APPEND "${_summary_script}" " [ -z \"\$tname\" ] && continue\n") | ||
| file(APPEND "${_summary_script}" " tname=\$(echo \"\$tname\" | sed 's/[[:space:]]*\$//')\n") | ||
| file(APPEND "${_summary_script}" " [ -z \"\$tname\" ] && continue\n") | ||
| file(APPEND "${_summary_script}" " # Check if this test passed, was skipped, or was failed\n") | ||
| file(APPEND "${_summary_script}" " if ! grep -q \"^\$tname passed\" \"\$OUT_FILE\" 2>/dev/null; then\n") | ||
| file(APPEND "${_summary_script}" " # Not passed - check if already in skipped or failed\n") | ||
| file(APPEND "${_summary_script}" " if [[ \"\$FILE_SKIPPED_NAMES\" != *\"\$tname|\"* ]] && [[ \"\$FILE_FAILED_NAMES\" != *\"\$tname|\"* ]]; then\n") | ||
| file(APPEND "${_summary_script}" " FILE_CRASHED_NAMES=\"\${FILE_CRASHED_NAMES}\${tname}|\"\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " done <<< \"\$TEST_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " # Accumulate test names for triage lists (names are | delimited)\n") | ||
| file(APPEND "${_summary_script}" " IFS='|' read -ra FAILED_ARR <<< \"\$FILE_FAILED_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " for name in \"\${FAILED_ARR[@]}\"; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$name\" ] && FAILED_LIST=\"\${FAILED_LIST}\${name} [\${TEST_BASENAME}]\\n\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" " IFS='|' read -ra SKIPPED_ARR <<< \"\$FILE_SKIPPED_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " for name in \"\${SKIPPED_ARR[@]}\"; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$name\" ] && SKIPPED_LIST=\"\${SKIPPED_LIST}\${name} [\${TEST_BASENAME}]\\n\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" " IFS='|' read -ra CRASHED_ARR <<< \"\$FILE_CRASHED_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " for name in \"\${CRASHED_ARR[@]}\"; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$name\" ] && CRASHED_LIST=\"\${CRASHED_LIST}\${name} [\${TEST_BASENAME}]\\n\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " else\n") | ||
| file(APPEND "${_summary_script}" " # No output file - test crashed before producing output\n") | ||
| file(APPEND "${_summary_script}" " if [ \$FILE_TOTAL -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " CRASHED_TESTS=\$((CRASHED_TESTS + FILE_TOTAL))\n") | ||
| file(APPEND "${_summary_script}" " # Add all test names to crashed list\n") | ||
| file(APPEND "${_summary_script}" " if [ -n \"\$TEST_NAMES\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " while IFS= read -r tname; do\n") | ||
| file(APPEND "${_summary_script}" " [ -z \"\$tname\" ] && continue\n") | ||
| file(APPEND "${_summary_script}" " tname=\$(echo \"\$tname\" | sed 's/[[:space:]]*\$//')\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$tname\" ] && CRASHED_LIST=\"\${CRASHED_LIST}\${tname} [\${TEST_BASENAME}]\\n\"\n") | ||
| file(APPEND "${_summary_script}" " done <<< \"\$TEST_NAMES\"\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" " fi\n") | ||
| file(APPEND "${_summary_script}" "done\n") | ||
| file(APPEND "${_summary_script}" "echo \" Test Suites: \$TOTAL_FILES\"\n") | ||
| file(APPEND "${_summary_script}" "echo \" Total Tests: \$TOTAL_TESTS\"\n") | ||
| file(APPEND "${_summary_script}" "echo \" Passed: \$PASSED_TESTS\"\n") | ||
| file(APPEND "${_summary_script}" "echo \" Failed: \$FAILED_TESTS\"\n") | ||
| file(APPEND "${_summary_script}" "if [ \$SKIPPED_TESTS -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " echo \" Skipped: \$SKIPPED_TESTS\"\n") | ||
| file(APPEND "${_summary_script}" "fi\n") | ||
| file(APPEND "${_summary_script}" "if [ \$CRASHED_TESTS -gt 0 ]; then\n") | ||
| file(APPEND "${_summary_script}" " echo \" Crashed/Error: \$CRASHED_TESTS\"\n") | ||
| file(APPEND "${_summary_script}" "fi\n") | ||
| file(APPEND "${_summary_script}" "# Print triage lists\n") | ||
| file(APPEND "${_summary_script}" "if [ -n \"\$FAILED_LIST\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " echo \"\"\n") | ||
| file(APPEND "${_summary_script}" " echo \"Failed Tests:\"\n") | ||
| file(APPEND "${_summary_script}" " echo -e \"\$FAILED_LIST\" | while IFS= read -r line; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$line\" ] && echo \" - \$line\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" "fi\n") | ||
| file(APPEND "${_summary_script}" "if [ -n \"\$SKIPPED_LIST\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " echo \"\"\n") | ||
| file(APPEND "${_summary_script}" " echo \"Skipped Tests:\"\n") | ||
| file(APPEND "${_summary_script}" " echo -e \"\$SKIPPED_LIST\" | while IFS= read -r line; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$line\" ] && echo \" - \$line\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" "fi\n") | ||
| file(APPEND "${_summary_script}" "if [ -n \"\$CRASHED_LIST\" ]; then\n") | ||
| file(APPEND "${_summary_script}" " echo \"\"\n") | ||
| file(APPEND "${_summary_script}" " echo \"Crashed/Error Tests:\"\n") | ||
| file(APPEND "${_summary_script}" " echo -e \"\$CRASHED_LIST\" | while IFS= read -r line; do\n") | ||
| file(APPEND "${_summary_script}" " [ -n \"\$line\" ] && echo \" - \$line\"\n") | ||
| file(APPEND "${_summary_script}" " done\n") | ||
| file(APPEND "${_summary_script}" "fi\n") | ||
| file(APPEND "${_summary_script}" "echo \"========================================\"\n") | ||
| execute_process(COMMAND chmod +x "${_summary_script}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super familiar with cmake, but this looks odd to me, is this really common practice for providing a test script? Embedding it like this in the cmake file looks like it might hurt maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, by edfbebc I extracted the corresponding logic into a separate template file. It should improve readability and maintainability.
| ) | ||
|
|
||
| # Special handling for hipSquareGenericTarget test - add generic target architectures | ||
| if("${TEST_NAME}" MATCHES "hipSquareGenericTarget" AND "${CATEGORY}" STREQUAL "unit" AND "${SUBDIR}" STREQUAL "compiler") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to refer to a test where in line 164 there is a function to special case. Why is this duplicate here?
I am not familiar with the CMake here, so, this just appears a bit odd to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly. Some tests do several runs - one with main executable (which include the specific target set in AMDGPU_ARCHS), others with preset generic targets only (like gfx9-generic) and compare the results. Function at line 164 is a helper function to create helper executable for generic targets only. On the other hand code at line 389 processes the main executable. N.B. if the specific target is not a part of preset generic targets, the corresponding test is skipped.
And thanks for the question -- it helped me to find out a duplication in setting of generic targets -- in the upcoming commit I will get rid of the duplication!
| -DGENERIC_COMPRESSED | ||
| --std=c++17 | ||
| -x hip | ||
| -mcode-object-version=6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and some other places: Should we really hard-code the COV? What's the benefit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, COV is inherited from original HIP Catch test suite and we need it to support generic targets (like gfx9-generic), they are not supported by COV 5. And some tests run twice with specific target and generic targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 26c61e1
| -DNO_GENERIC_TARGET_ONLY_TEST | ||
| --std=c++17 | ||
| -x hip | ||
| -mcode-object-version=6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for generic targets, see above.
| # Create wrapper script that runs LIT then shows summary | ||
| set(_lit_wrapper "${CMAKE_CURRENT_BINARY_DIR}/catch_tests/lit_wrapper_${CATEGORY}_${SUBDIR}_${VARIANT_SUFFIX}.sh") | ||
| file(WRITE "${_lit_wrapper}" "#!/bin/bash\n") | ||
| file(APPEND "${_lit_wrapper}" "cd ${CMAKE_CURRENT_BINARY_DIR}\n") | ||
| string(REPLACE ";" " " _test_list_str "${_subdir_variant_tests}") | ||
| file(APPEND "${_lit_wrapper}" "${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} ${_lit_verbosity_flags} ${_test_list_str}\n") | ||
| file(APPEND "${_lit_wrapper}" "LIT_EXIT=\$?\n") | ||
| file(APPEND "${_lit_wrapper}" "${_summary_script}\n") | ||
| file(APPEND "${_lit_wrapper}" "exit \$LIT_EXIT\n") | ||
| execute_process(COMMAND chmod +x "${_lit_wrapper}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also be a script that lives along the CMake instead of being created on-the-fly. Or is there a good reason to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, by 26c61e1 I made a template (the same way as dealt with the summary script). Or do you prefer a real bash script instead of template?
External/HIP/HipCatchTests.cmake
Outdated
| # Add hipTestMain sources (required for catch2 integration) | ||
| list(APPEND _test_sources | ||
| "${HIP_CATCH_TESTS_DIR}/hipTestMain/main.cc" | ||
| "${HIP_CATCH_TESTS_DIR}/hipTestMain/hip_test_context.cc" | ||
| "${HIP_CATCH_TESTS_DIR}/hipTestMain/hip_test_features.cc" | ||
| ) | ||
|
|
||
| # Check if sources exist | ||
| set(_valid_sources "") | ||
| foreach(_src ${_test_sources}) | ||
| if(EXISTS "${_src}") | ||
| list(APPEND _valid_sources "${_src}") | ||
| else() | ||
| message(STATUS "Source file not found: ${_src}") | ||
| endif() | ||
| endforeach() | ||
|
|
||
| if(NOT _valid_sources) | ||
| message(STATUS "No valid sources found for ${TEST_NAME}, skipping") | ||
| return() | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to check if the sources exist?
If the sources do not exist, shouldn't this be an error instead of a STATUS message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed by 26c61e1
| # Special handling for hipSquareGenericTarget test - add generic target architectures | ||
| if("${TEST_NAME}" MATCHES "hipSquareGenericTarget" AND "${CATEGORY}" STREQUAL "unit" AND "${SUBDIR}" STREQUAL "compiler") | ||
| target_compile_options(${_test_exe} PRIVATE | ||
| -mcode-object-version=6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for generic targets, see above.
Introduce support for HIP Catch tests in
External/HIPtests.HIP Catch tests-DENABLE_HIP_CATCH_TESTS=ONin cmakeSee External/HIP/CATCH_TESTS_README.md for details