From 7886d6c48881da195fd9aab293e18c458278aa15 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Thu, 28 Aug 2025 19:16:39 -0700 Subject: [PATCH 01/15] [CI] Add Reproduce Command for UT --- .github/actions/linux-uttest/action.yml | 10 ++++++++ .github/scripts/check-ut.py | 2 ++ .github/scripts/ut_result_check.sh | 31 +++++++++++++++++++++++++ .github/workflows/_linux_ut.yml | 14 +++++++++-- 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/.github/actions/linux-uttest/action.yml b/.github/actions/linux-uttest/action.yml index c6ac2eb2b5..f1b8d7e67e 100644 --- a/.github/actions/linux-uttest/action.yml +++ b/.github/actions/linux-uttest/action.yml @@ -20,6 +20,8 @@ runs: cd pytorch/third_party/torch-xpu-ops/test/regressions pytest --junit-xml=${{ github.workspace }}/ut_log/op_regression.xml \ 2> ${log_dir}/op_regression_test_error.log |tee ${log_dir}/op_regression_test.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - name: op_regression_dev1 shell: timeout 300 bash -xe {0} if: ${{ inputs.ut_name == 'op_regression_dev1' || inputs.ut_name == 'basic' }} @@ -30,6 +32,8 @@ runs: timeout 180 pytest test_operation_on_device_1.py \ --junit-xml=${{ github.workspace }}/ut_log/op_regression_dev1.xml \ 2> ${log_dir}/op_regression_dev1_test_error.log |tee ${log_dir}/op_regression_dev1_test.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - name: op_transformers shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'op_transformers' || inputs.ut_name == 'basic' }} @@ -41,6 +45,8 @@ runs: pytest test/test_transformers.py -k xpu \ --junit-xml=${{ github.workspace }}/ut_log/op_transformers.xml \ 2> ${log_dir}/op_transformers_test_error.log |tee ${log_dir}/op_transformers_test.log + echo -e "File Path: cd pytorch" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "Reproduce Command: pytest -sv test/failed_case -k xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - name: op_extended shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'op_extended' || inputs.ut_name == 'basic' }} @@ -53,6 +59,8 @@ runs: 2> ${log_dir}/op_extended_test_error.log |tee ${log_dir}/op_extended_test.log ls -al cp *.xml ${{ github.workspace }}/ut_log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu/extended" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - name: op_ut shell: timeout 18000 bash -xe {0} if: ${{ inputs.ut_name == 'op_ut' }} @@ -89,6 +97,8 @@ runs: tee ${{ github.workspace }}/ut_log/op_ut/op_ut_with_only_test.log ls -al cp *.xml ${{ github.workspace }}/ut_log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - name: torch_xpu shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'torch_xpu' }} diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index c9afb73eb8..1d403ae8e3 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -192,6 +192,8 @@ def determine_category(ut): return 'op_regression_dev1' elif ut == 'op_extended': return 'op_extended' + elif ut == 'op_transformers': + return 'op_transformers' elif 'op_ut' in ut: return 'op_ut' else: diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index cc3131ccef..f4848f7801 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -136,6 +136,15 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' num_failed=$(wc -l < "./${ut_suite}_failed.log") fi num_passed=$(wc -l < "./${ut_suite}_passed.log") + echo -e "=========================================================================" + echo -e "Provide the reproduce command for ${ut_suite}" + echo -e "=========================================================================" + if [[ $num_failed -gt 0 ]]; then + echo -e "Need reproduce command" + cat "./reproduce.log" + else + echo -e "Not need reproduce command" + fi if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]]; then echo -e "[ERROR] UT ${ut_suite} test Fail" exit 1 @@ -168,6 +177,17 @@ if [[ "${ut_suite}" == 'op_ut' ]]; then num_failed_with_skip=$(wc -l < "./${ut_suite}_with_skip_test_failed.log") fi echo -e "=========================================================================" + echo -e "Provide the reproduce command for ${ut_suite} with skip" + echo -e "=========================================================================" + if [[ $num_failed_with_skip -gt 0 ]]; then + echo -e "Need reproduce command" + if [[ -f "reproduce.log" ]]; then + cat "./reproduce.log" + fi + else + echo -e "Not need reproduce command" + fi + echo -e "=========================================================================" echo -e "Show Failed cases in ${ut_suite} with only" echo -e "=========================================================================" cat "./${ut_suite}_with_only_test_failed.log" @@ -184,6 +204,17 @@ if [[ "${ut_suite}" == 'op_ut' ]]; then else num_failed_with_only=$(wc -l < "./${ut_suite}_with_only_test_failed.log") fi + echo -e "=========================================================================" + echo -e "Provide the reproduce command for ${ut_suite} with only" + echo -e "=========================================================================" + if [[ $num_failed_with_only -gt 0 ]]; then + echo -e "Need reproduce command" + if [[ -f "reproduce.log" ]]; then + cat "./reproduce.log" + fi + else + echo -e "Not need reproduce command" + fi ((num_failed=num_failed_with_skip+num_failed_with_only)) num_passed_with_skip=$(wc -l < "./${ut_suite}_with_skip_test_passed.log") num_passed_with_only=$(wc -l < "./${ut_suite}_with_only_test_passed.log") diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 146db6c72e..1499569482 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -188,13 +188,23 @@ jobs: # get distributed known issues gh --repo intel/torch-xpu-ops issue view $UT_SKIP_ISSUE --json body -q .body |sed -E '/^(#|$)/d' > Known_issue.log.tmp # get skipped known issues - gh api "repos/${{ github.repository }}/issues?labels=skipped" \ - --jq '.[] | select(.pull_request == null) | "Issue #\(.number): \(.title)\n\(.body)\n"' > issues.log + count=$(gh api "repos/${{ github.repository }}/issues?labels=skipped" --jq 'length') + if [ "$count" -gt 0 ]; then + echo -e "$count issues with skipped label found" + gh api "repos/${{ github.repository }}/issues?labels=skipped" \ + --jq '.[] | select(.pull_request == null) | "Issue #\(.number): \(.title)\n\(.body)\n"' > issues.log + fi if [ "${{ inputs.ut }}" == "basic" ];then ut_list="op_regression op_transformers op_extended op_regression_dev1" else ut_list="${{ inputs.ut }}" fi + + # Provide Reproduce Command + if [[ -f "${{ github.workspace }}/ut_log/reproduce.log" ]]; then + cp ${{ github.workspace }}/ut_log/reproduce.log ./ + fi + cp ${{ github.workspace }}/.github/scripts/ut_result_check.sh ./ for ut_name in ${ut_list} do From cf430586fd07b63da83f6baddebcd4e9d03f78a4 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Thu, 28 Aug 2025 19:18:41 -0700 Subject: [PATCH 02/15] fix the typo issue --- .github/scripts/ut_result_check.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index f4848f7801..f2ab2ea23b 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -141,7 +141,9 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "=========================================================================" if [[ $num_failed -gt 0 ]]; then echo -e "Need reproduce command" - cat "./reproduce.log" + if [[ -f "reproduce.log" ]]; then + cat "./reproduce.log" + fi else echo -e "Not need reproduce command" fi From cec5582f40ae37c06f34f9ee5a617b8b429aa5fb Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Fri, 29 Aug 2025 00:41:52 -0700 Subject: [PATCH 03/15] using xml info to check results --- .github/scripts/check-ut.py | 76 ++++++++++++++- .github/scripts/ut_result_check.sh | 150 +++-------------------------- .github/workflows/_linux_ut.yml | 27 +++++- 3 files changed, 113 insertions(+), 140 deletions(-) diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index 1d403ae8e3..d1e65facfc 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -3,6 +3,7 @@ import os import re from junitparser import JUnitXml, Error, Failure, Skipped +from collections import defaultdict parser = argparse.ArgumentParser(description='Test results analyzer') parser.add_argument('input_files', nargs='+', help='JUnit XML files or log files') @@ -10,6 +11,9 @@ failures = [] summaries = [] +failures_by_category = defaultdict(list) +passed_cases = [] +passed_by_category = defaultdict(list) error_types = [ "RuntimeError", @@ -38,6 +42,14 @@ def get_name(case): return case.get('name', '') return ' '.join(case.name.split()) +def get_category_from_case(case): + if isinstance(case, dict): + return case.get('category', 'unknown') + else: + if hasattr(case, '_file_category'): + return case._file_category + return 'unknown' + def get_result(case): if isinstance(case, dict): return case.get('status', 'failed') @@ -108,6 +120,7 @@ def print_failures(failure_list=None): print_header = True for case in failures: print_md_row({ + 'Category': get_category_from_case(case), 'Class name': get_classname(case), 'Test name': get_name(case), 'Status': get_result(case), @@ -116,13 +129,37 @@ def print_failures(failure_list=None): }, print_header, failure_list=failure_list) print_header = False +def generate_failures_log(): + if not failures: + print("No failures found, skipping log file creation.") + return + + for case in failures: + category = get_category_from_case(case) + failures_by_category[category].append(case) + + for category, category_failures in failures_by_category.items(): + if not category_failures: + continue + + log_filename = f"failures_{category}.log" + + with open(log_filename, "w", encoding='utf-8') as log_file: + for case in category_failures: + class_name = get_classname(case) + test_name = get_name(case) + log_file.write(f"{category},{class_name},{test_name}\n") + + print(f"Failures log for {category} has been written to {log_filename}") + def parse_log_file(log_file): with open(log_file, encoding='utf-8') as f: content = f.read() ut_name = os.path.splitext(os.path.basename(log_file))[0] + category = determine_category(ut_name) summary = { - 'Category': determine_category(ut_name), + 'Category': category, 'UT': ut_name, 'Test cases': 0, 'Passed': 0, @@ -170,13 +207,16 @@ def parse_log_file(log_file): for match in error_matches: error_msg.append(match.group(0).strip()) - failures.append({ + failure_case = { 'classname': ut_name, 'name': f"{case_match.group(2)}:{test_name}", 'error': " ".join(error_msg), 'status': 'failed', - 'source': 'Log' - }) + 'source': 'Log', + 'category': category + } + failures.append(failure_case) + failures_by_category[category].append(failure_case) failures_number += 1 if failures_number > summary['Failures']: @@ -227,10 +267,35 @@ def process_xml_file(xml_file): for case in suite: if get_result(case) not in ["passed", "skipped"]: + case._file_category = category failures.append(case) + elif get_result(case) == "passed": + case._file_category = category + passed_cases.append(case) + passed_by_category[category].append(case) except Exception as e: print(f"Error processing {xml_file}: {e}", file=sys.stderr) +def generate_passed_log(): + if not passed_cases: + print("No passed cases found, skipping log file creation.") + return + + for category, category_passed in passed_by_category.items(): + if not category_passed: + continue + + log_filename = f"passed_{category}.log" + + with open(log_filename, "w", encoding='utf-8') as log_file: + for case in category_passed: + class_name = get_classname(case) + test_name = get_name(case) + status = get_result(case) + log_file.write(f"{category},{class_name},{test_name}\n") + + print(f"Passed log for {category} has been written to {log_filename}") + def print_summary(): print("### Results Summary") print_header = True @@ -278,6 +343,9 @@ def main(): with open("ut_failure_list.csv", "w") as failure_list: print_failures(failure_list=failure_list) + + generate_failures_log() + generate_passed_log() print_summary() diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index f2ab2ea23b..8da27ae986 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -9,10 +9,6 @@ compare_and_filter_logs() { local file_known_issue="$2" local output_file="${3:-${file_UT%.*}_filtered.log}" local filtered_content="${file_UT%.*}_removed.log" - local temp_file="temp_parts.log" - local temp_file_labeled="temp_parts_labeled.log" - local temp_output="${3:-${file_UT%.*}_filtered_temp.log}" - local temp_final="${file_UT%.*}_final_temp.log" if [[ $# -lt 2 ]]; then echo "[ERROR] Need 2 files to compare" @@ -34,38 +30,6 @@ compare_and_filter_logs() { # Keep the filtered UT cases grep -noFf "$file_known_issue" "$file_UT" > "$filtered_content" echo "Filtered cases file: $filtered_content" - true > "$temp_file" - true > "$temp_file_labeled" - true > "$temp_output" - true > "$temp_final" - grep -E '\.py$|,' "$output_file" > "$temp_output" - while IFS= read -r line; do - IFS=',' read -ra parts <<< "$line" - for part in "${parts[@]}"; do - part_trimmed=$(echo "$part" | xargs) - if [[ -n "$part_trimmed" ]] && ! grep -qF "$part_trimmed" "$file_known_issue"; then - echo "$part_trimmed" >> "$temp_file" - echo -e "\n\033[1;33m[Check the failed cases in summary line]\033[0m" - echo -e "\033[1;33mCase not found in ${file_known_issue}: '${part_trimmed}' (from line: '${line}')\033[0m" - else - echo -e "\n\033[1;33m[Check the failed cases in summary line]\033[0m" - echo -e "\n\033[1;32m${part_trimmed} found in ${file_known_issue} (from line: '${line}')\033[0m" - fi - done - done < "$temp_output" - - awk '{print $0 " [in summary line]"}' "$temp_file" > "$temp_file_labeled" - grep -vE '\.py$|,' "$output_file" > "$temp_final" - cat "$temp_file_labeled" >> "$temp_final" - mv "$temp_final" "$output_file" - - echo -e "\n\033[1;31m[New failed cases Summary]\033[0m" - if [[ -z "$(tr -d ' \t\n\r\f' < "$output_file" 2>/dev/null)" ]]; then - echo -e "\033[1;32mNo new failed cases found\033[0m" - else - echo -e "\n\033[1;31mNew failed cases, not in known issues\033[0m" - cat "$output_file" - fi if [[ -s "$filtered_content" ]]; then echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" @@ -79,7 +43,13 @@ compare_and_filter_logs() { echo -e "\n\033[1;32mNo Skipped Cases\033[0m" fi - rm -f ${temp_output} ${temp_file} ${temp_final} + echo -e "\n\033[1;31m[New failed cases Summary]\033[0m" + if [[ -z "$(tr -d ' \t\n\r\f' < "$output_file" 2>/dev/null)" ]]; then + echo -e "\033[1;32mNo new failed cases found\033[0m" + else + echo -e "\n\033[1;31mNew failed cases, not in known issues\033[0m" + cat "$output_file" + fi } check_passed_known_issues() { @@ -101,41 +71,26 @@ check_passed_known_issues() { fi } -get_pass_fail_log() { - local p_row="$1" - local p_col="$2" - local ut_log="$3" - grep -E "${p_row}" "${ut_log}" | awk -v p="${p_col}" '{ - for (i=1;i<=NF;i++) { - if ($i ~ p) { - print $i; - } - } - }' -} -if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' ]]; then - get_pass_fail_log ".FAILED" "::.*::" "${ut_suite}"_test.log > ./"${ut_suite}"_failed.log - grep -E "Timeout" "${ut_suite}"_test.log | grep "test" >> ./"${ut_suite}"_failed.log - get_pass_fail_log "PASSED" "::.*::" "${ut_suite}"_test.log > ./"${ut_suite}"_passed.log +if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut']]; then echo -e "=========================================================================" echo -e "Show Failed cases in ${ut_suite}" echo -e "=========================================================================" - cat "./${ut_suite}_failed.log" + cat "./failures_${ut_suite}.log" echo -e "=========================================================================" echo -e "Checking Failed cases in ${ut_suite}" echo -e "=========================================================================" - compare_and_filter_logs "${ut_suite}"_failed.log Known_issue.log + compare_and_filter_logs failures_${ut_suite}.log Known_issue.log echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" - check_passed_known_issues "${ut_suite}"_passed.log Known_issue.log - if [[ -f "${ut_suite}_failed_filtered.log" ]]; then - num_failed=$(wc -l < "./${ut_suite}_failed_filtered.log") + check_passed_known_issues passed_${ut_suite}.log Known_issue.log + if [[ -f "failures_${ut_suite}_filtered.log" ]]; then + num_failed=$(wc -l < "./failures_${ut_suite}_filtered.log") else - num_failed=$(wc -l < "./${ut_suite}_failed.log") + num_failed=$(wc -l < "./failures_${ut_suite}.log") fi - num_passed=$(wc -l < "./${ut_suite}_passed.log") + num_passed=$(wc -l < "./passed_${ut_suite}.log") echo -e "=========================================================================" echo -e "Provide the reproduce command for ${ut_suite}" echo -e "=========================================================================" @@ -154,80 +109,7 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "[PASS] UT ${ut_suite} test Pass" fi fi -if [[ "${ut_suite}" == 'op_ut' ]]; then - get_pass_fail_log ".FAILED" "::.*::" op_ut_with_skip_test.log > ./"${ut_suite}"_with_skip_test_failed.log - grep -E "Timeout" op_ut_with_skip_test.log | grep "test" >> ./"${ut_suite}"_with_skip_test_failed.log - get_pass_fail_log "PASSED" "::.*::" op_ut_with_skip_test.log > ./"${ut_suite}"_with_skip_test_passed.log - get_pass_fail_log ".FAILED" "::.*::" op_ut_with_only_test.log > ./"${ut_suite}"_with_only_test_failed.log - grep -E "Timeout" op_ut_with_only_test.log | grep "test" >> ./"${ut_suite}"_with_only_test_failed.log - get_pass_fail_log "PASSED" "::.*::" op_ut_with_only_test.log > ./"${ut_suite}"_with_only_test_passed.log - echo -e "=========================================================================" - echo -e "Show Failed cases in ${ut_suite} with skip" - echo -e "=========================================================================" - cat "./${ut_suite}_with_skip_test_failed.log" - echo -e "=========================================================================" - echo -e "Checking Failed cases in ${ut_suite} with skip" - echo -e "=========================================================================" - compare_and_filter_logs "${ut_suite}"_with_skip_test_failed.log Known_issue.log - echo -e "=========================================================================" - echo -e "Checking New passed cases in Known issue list for ${ut_suite} with skip" - echo -e "=========================================================================" - check_passed_known_issues "${ut_suite}"_with_skip_test_passed.log Known_issue.log - if [[ -f "${ut_suite}_with_skip_test_failed_filtered.log" ]]; then - num_failed_with_skip=$(wc -l < "./${ut_suite}_with_skip_test_failed_filtered.log") - else - num_failed_with_skip=$(wc -l < "./${ut_suite}_with_skip_test_failed.log") - fi - echo -e "=========================================================================" - echo -e "Provide the reproduce command for ${ut_suite} with skip" - echo -e "=========================================================================" - if [[ $num_failed_with_skip -gt 0 ]]; then - echo -e "Need reproduce command" - if [[ -f "reproduce.log" ]]; then - cat "./reproduce.log" - fi - else - echo -e "Not need reproduce command" - fi - echo -e "=========================================================================" - echo -e "Show Failed cases in ${ut_suite} with only" - echo -e "=========================================================================" - cat "./${ut_suite}_with_only_test_failed.log" - echo -e "=========================================================================" - echo -e "Checking Failed cases in ${ut_suite} with only" - echo -e "=========================================================================" - compare_and_filter_logs "${ut_suite}"_with_only_test_failed.log Known_issue.log - echo -e "=========================================================================" - echo -e "Checking New passed cases in Known issue list for ${ut_suite} with only" - echo -e "=========================================================================" - check_passed_known_issues "${ut_suite}"_with_only_test_passed.log Known_issue.log - if [[ -f "${ut_suite}_with_only_test_failed_filtered.log" ]]; then - num_failed_with_only=$(wc -l < "./${ut_suite}_with_only_test_failed_filtered.log") - else - num_failed_with_only=$(wc -l < "./${ut_suite}_with_only_test_failed.log") - fi - echo -e "=========================================================================" - echo -e "Provide the reproduce command for ${ut_suite} with only" - echo -e "=========================================================================" - if [[ $num_failed_with_only -gt 0 ]]; then - echo -e "Need reproduce command" - if [[ -f "reproduce.log" ]]; then - cat "./reproduce.log" - fi - else - echo -e "Not need reproduce command" - fi - ((num_failed=num_failed_with_skip+num_failed_with_only)) - num_passed_with_skip=$(wc -l < "./${ut_suite}_with_skip_test_passed.log") - num_passed_with_only=$(wc -l < "./${ut_suite}_with_only_test_passed.log") - ((num_passed=num_passed_with_skip+num_passed_with_only)) - if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]]; then - echo -e "[ERROR] UT ${ut_suite} test Fail" - exit 1 - else - echo -e "[PASS] UT ${ut_suite} test Pass" - fi -fi + if [[ "${ut_suite}" == 'torch_xpu' ]]; then echo "Pytorch XPU binary UT checking" cd ../../pytorch || exit diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 1499569482..1d50bb7fbe 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -140,6 +140,24 @@ jobs: run: | pip install junitparser python ./.github/scripts/check-ut.py ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true + + # Check the failure logs + failure_files=(${{ github.workspace }}/failures*.log) + if [ -e "${failure_files[0]}" ]; then + echo -e "Exist Failure logs" + echo "Found Failure logs as below: " + for file in "${failure_files[@]}"; do + echo " - $file" + done + cp "${failure_files[@]}" ${{ github.workspace }}/ut_log + echo -e "Failure logs Copied" + else + echo -e "No Failure logs" + fi + + # Copied the passed logs + cp passed*.log ${{ github.workspace }}/ut_log + if [ -e ut_failure_list.csv ];then cp ut_failure_list.csv ${{ github.workspace }}/ut_log/ut_failure_list.csv || true fi @@ -185,6 +203,11 @@ jobs: run: | ls -al ${{ github.workspace }}/ut_log cd ${{ github.workspace }}/ut_log/${{ inputs.ut }} + + for log_file in "${{ github.workspace }}/ut_log"/{failures,passed}_"${{ inputs.ut }}".log; do + [[ -f "$log_file" ]] && cp "$log_file" ./ + done + # get distributed known issues gh --repo intel/torch-xpu-ops issue view $UT_SKIP_ISSUE --json body -q .body |sed -E '/^(#|$)/d' > Known_issue.log.tmp # get skipped known issues @@ -199,7 +222,7 @@ jobs: else ut_list="${{ inputs.ut }}" fi - + # Provide Reproduce Command if [[ -f "${{ github.workspace }}/ut_log/reproduce.log" ]]; then cp ${{ github.workspace }}/ut_log/reproduce.log ./ @@ -211,7 +234,7 @@ jobs: cp Known_issue.log.tmp Known_issue.log awk -v r="${ut_name}" 'BEGIN{ print_row = 0 }{ if ( ! ( $0 ~ /[a-zA-Z0-9]/ ) ) { print_row = 0 }; - if ( print_row == 1 && $NF ~ r ) { print $1 }; + if ( print_row == 1 && $1 ~ r ) { print $0 }; if ( $0 ~ /Cases:/ ) { print_row = 1 }; }' issues.log >> Known_issue.log bash ut_result_check.sh ${ut_name} From 8cc30884c5807e4c1abdc2dd2a88df03de1a634d Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Fri, 29 Aug 2025 00:48:24 -0700 Subject: [PATCH 04/15] align the lint check --- .github/scripts/check-ut.py | 12 +++++------- .github/scripts/ut_result_check.sh | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index d1e65facfc..bc1fb2f510 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -141,15 +141,14 @@ def generate_failures_log(): for category, category_failures in failures_by_category.items(): if not category_failures: continue - + log_filename = f"failures_{category}.log" - with open(log_filename, "w", encoding='utf-8') as log_file: for case in category_failures: class_name = get_classname(case) test_name = get_name(case) log_file.write(f"{category},{class_name},{test_name}\n") - + print(f"Failures log for {category} has been written to {log_filename}") def parse_log_file(log_file): @@ -284,16 +283,15 @@ def generate_passed_log(): for category, category_passed in passed_by_category.items(): if not category_passed: continue - + log_filename = f"passed_{category}.log" - with open(log_filename, "w", encoding='utf-8') as log_file: for case in category_passed: class_name = get_classname(case) test_name = get_name(case) status = get_result(case) log_file.write(f"{category},{class_name},{test_name}\n") - + print(f"Passed log for {category} has been written to {log_filename}") def print_summary(): @@ -345,7 +343,7 @@ def main(): print_failures(failure_list=failure_list) generate_failures_log() - generate_passed_log() + generate_passed_log() print_summary() diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 8da27ae986..703a977740 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -72,7 +72,7 @@ check_passed_known_issues() { } -if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut']]; then +if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut' ]]; then echo -e "=========================================================================" echo -e "Show Failed cases in ${ut_suite}" echo -e "=========================================================================" From ce8d2e7feb54af81a1920bad67834cf2b9fa33b9 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Fri, 29 Aug 2025 02:25:41 -0700 Subject: [PATCH 05/15] add test case number check --- .github/scripts/check-ut.py | 39 +++++++++++++++++++++ .github/scripts/ut_result_check.sh | 55 +++++++++++++++++++++++++++++- .github/workflows/_linux_ut.yml | 7 ++-- 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index bc1fb2f510..8125e39505 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -14,6 +14,13 @@ failures_by_category = defaultdict(list) passed_cases = [] passed_by_category = defaultdict(list) +category_totals = defaultdict(lambda: { + 'Test cases': 0, + 'Passed': 0, + 'Skipped': 0, + 'Failures': 0, + 'Errors': 0 +}) error_types = [ "RuntimeError", @@ -222,6 +229,13 @@ def parse_log_file(log_file): summary['Failures'] = failures_number summary['Passed'] = summary['Test cases'] - summary['Failures'] - summary['Skipped'] + # Update category totals + category_totals[category]['Test cases'] += summary['Test cases'] + category_totals[category]['Passed'] += summary['Passed'] + category_totals[category]['Skipped'] += summary['Skipped'] + category_totals[category]['Failures'] += summary['Failures'] + category_totals[category]['Errors'] += summary['Errors'] + return summary def determine_category(ut): @@ -264,6 +278,13 @@ def process_xml_file(xml_file): } summaries.append(suite_summary) + # Update category totals + category_totals[category]['Test cases'] += suite_summary['Test cases'] + category_totals[category]['Passed'] += suite_summary['Passed'] + category_totals[category]['Skipped'] += suite_summary['Skipped'] + category_totals[category]['Failures'] += suite_summary['Failures'] + category_totals[category]['Errors'] += suite_summary['Errors'] + for case in suite: if get_result(case) not in ["passed", "skipped"]: case._file_category = category @@ -294,6 +315,23 @@ def generate_passed_log(): print(f"Passed log for {category} has been written to {log_filename}") +def generate_category_totals_log(): + """Generate log files with category totals""" + for category, totals in category_totals.items(): + if totals['Test cases'] == 0: + continue + + log_filename = f"category_{category}.log" + with open(log_filename, "w", encoding='utf-8') as log_file: + log_file.write(f"Category: {category}\n") + log_file.write(f"Test cases: {totals['Test cases']}\n") + log_file.write(f"Passed: {totals['Passed']}\n") + log_file.write(f"Skipped: {totals['Skipped']}\n") + log_file.write(f"Failures: {totals['Failures']}\n") + log_file.write(f"Errors: {totals['Errors']}\n") + + print(f"Category totals log for {category} has been written to {log_filename}") + def print_summary(): print("### Results Summary") print_header = True @@ -344,6 +382,7 @@ def main(): generate_failures_log() generate_passed_log() + generate_category_totals_log() print_summary() diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 703a977740..0f58592a21 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -3,6 +3,7 @@ ut_suite="${1:-op_regression}" # op_regression / op_extended / op_ut / torch_x # usage # compare_and_filter_logs [output.log] +all_pass="" compare_and_filter_logs() { local file_UT="$1" @@ -71,6 +72,54 @@ check_passed_known_issues() { fi } +check_test_cases() { + local log_file="$1" + declare -A expected_cases=( + ["op_extended"]=5349 + ["op_regression"]=244 + ["op_regression_dev1"]=1 + ["op_transformers"]=237 + ["op_ut"]=120408 + ) + + if [[ ! -f "$log_file" ]]; then + echo "False" + echo "[ERROR] Need test file $log_file" >&2 + return 1 + fi + + all_pass="true" + local current_category="" + + while IFS= read -r line; do + if [[ $line =~ ^Category:\ ([^[:space:]]+) ]]; then + current_category="${BASH_REMATCH[1]}" + elif [[ $line =~ Test\ cases:\ ([0-9]+) ]] && [[ -n "$current_category" ]]; then + actual_cases="${BASH_REMATCH[1]}" + expected_cases_value="${expected_cases[$current_category]}" + + if [[ -n "$expected_cases_value" ]]; then + threshold=$(echo "$expected_cases_value * 0.95" | bc -l | awk '{print int($1+0.5)}') + + echo "Category: $current_category" + echo "Expected number: $expected_cases_value" + echo "Current number: $actual_cases" + echo "Threshold(95%): $threshold" + + if [[ "$actual_cases" -lt "$threshold" ]]; then + echo " Status: ❌ Abnormal (reduction exceeds 5%)" + all_pass="false" + else + reduction=$(echo "scale=2; ($actual_cases/$expected_cases_value - 1) * 100" | bc -l) + echo " Status: ✅ Normal (reduction ${reduction}%)" + fi + echo "----------------------------------------" + fi + current_category="" + fi + done < "$log_file" +} + if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' || "${ut_suite}" == 'op_extended' || "${ut_suite}" == 'op_transformers' || "${ut_suite}" == 'op_ut' ]]; then echo -e "=========================================================================" @@ -85,6 +134,10 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" check_passed_known_issues passed_${ut_suite}.log Known_issue.log + echo -e "=========================================================================" + echo -e "Checking Test case number for ${ut_suite}" + echo -e "=========================================================================" + check_test_cases category_${ut_suite}.log if [[ -f "failures_${ut_suite}_filtered.log" ]]; then num_failed=$(wc -l < "./failures_${ut_suite}_filtered.log") else @@ -102,7 +155,7 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' else echo -e "Not need reproduce command" fi - if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]]; then + if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]] || [[ "$all_pass" == 'false']]; then echo -e "[ERROR] UT ${ut_suite} test Fail" exit 1 else diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 1d50bb7fbe..124eac04c5 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -158,6 +158,9 @@ jobs: # Copied the passed logs cp passed*.log ${{ github.workspace }}/ut_log + # Copied the Summary logs + cp category*.log ${{ github.workspace }}/ut_log + if [ -e ut_failure_list.csv ];then cp ut_failure_list.csv ${{ github.workspace }}/ut_log/ut_failure_list.csv || true fi @@ -204,8 +207,8 @@ jobs: ls -al ${{ github.workspace }}/ut_log cd ${{ github.workspace }}/ut_log/${{ inputs.ut }} - for log_file in "${{ github.workspace }}/ut_log"/{failures,passed}_"${{ inputs.ut }}".log; do - [[ -f "$log_file" ]] && cp "$log_file" ./ + for log_file in "${{ github.workspace }}/ut_log"/{failures,passed,category}_"${{ inputs.ut }}".log; do + [[ -f "$log_file" ]] && cp "$log_file" ./ done # get distributed known issues From 26c5ddc67e7ef51fc84ce9484546d530ea118baa Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Fri, 29 Aug 2025 02:28:33 -0700 Subject: [PATCH 06/15] align the lint check --- .github/scripts/check-ut.py | 2 +- .github/scripts/ut_result_check.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index 8125e39505..f91ec10673 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -382,7 +382,7 @@ def main(): generate_failures_log() generate_passed_log() - generate_category_totals_log() + generate_category_totals_log() print_summary() diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 0f58592a21..297a260fd0 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -155,7 +155,7 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' else echo -e "Not need reproduce command" fi - if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]] || [[ "$all_pass" == 'false']]; then + if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]] || [[ "$all_pass" == 'false' ]]; then echo -e "[ERROR] UT ${ut_suite} test Fail" exit 1 else From 9630dd8f5c965835eaae1a7168d35a7897dc3a27 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Fri, 29 Aug 2025 02:30:29 -0700 Subject: [PATCH 07/15] align the lint check --- .github/scripts/ut_result_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 297a260fd0..d3ae4605ea 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -97,7 +97,7 @@ check_test_cases() { elif [[ $line =~ Test\ cases:\ ([0-9]+) ]] && [[ -n "$current_category" ]]; then actual_cases="${BASH_REMATCH[1]}" expected_cases_value="${expected_cases[$current_category]}" - + if [[ -n "$expected_cases_value" ]]; then threshold=$(echo "$expected_cases_value * 0.95" | bc -l | awk '{print int($1+0.5)}') From 40815d334eb244026c19c3dee76204e42c3f4bb3 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Sun, 31 Aug 2025 19:00:43 -0700 Subject: [PATCH 08/15] fix the wrong check stage --- .github/scripts/check-ut.py | 6 ---- .github/workflows/_linux_ut.yml | 51 +++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/scripts/check-ut.py b/.github/scripts/check-ut.py index f91ec10673..b90ba4353c 100644 --- a/.github/scripts/check-ut.py +++ b/.github/scripts/check-ut.py @@ -156,8 +156,6 @@ def generate_failures_log(): test_name = get_name(case) log_file.write(f"{category},{class_name},{test_name}\n") - print(f"Failures log for {category} has been written to {log_filename}") - def parse_log_file(log_file): with open(log_file, encoding='utf-8') as f: content = f.read() @@ -313,8 +311,6 @@ def generate_passed_log(): status = get_result(case) log_file.write(f"{category},{class_name},{test_name}\n") - print(f"Passed log for {category} has been written to {log_filename}") - def generate_category_totals_log(): """Generate log files with category totals""" for category, totals in category_totals.items(): @@ -330,8 +326,6 @@ def generate_category_totals_log(): log_file.write(f"Failures: {totals['Failures']}\n") log_file.write(f"Errors: {totals['Errors']}\n") - print(f"Category totals log for {category} has been written to {log_filename}") - def print_summary(): print("### Results Summary") print_header = True diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 124eac04c5..48c133ba92 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -85,6 +85,36 @@ jobs: run: | pip install junitparser python ./.github/scripts/check-ut.py ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true + + # Check the failure logs + if ls ${{ github.workspace }}/failures*.log 1> /dev/null 2>&1; then + echo -e "Exist Failure logs" + echo "Found Failure logs as below: " + for file in ${{ github.workspace }}/failures*.log; do + echo " - $file" + cp "$file" ${{ github.workspace }}/ut_log + done + echo -e "Failure logs Copied" + else + echo -e "No Failure logs" + fi + + # Copied the passed logs + if ls passed*.log 1> /dev/null 2>&1; then + cp passed*.log ${{ github.workspace }}/ut_log + echo -e "Passed logs Copied" + else + echo -e "No Passed logs" + fi + + # Copied the Summary logs + if ls category*.log 1> /dev/null 2>&1; then + cp category*.log ${{ github.workspace }}/ut_log + echo -e "Category logs Copied" + else + echo -e "No Category logs" + fi + if [ -e ut_failure_list.csv ];then cp ut_failure_list.csv ${{ github.workspace }}/ut_log/ut_failure_list.csv || true fi @@ -140,27 +170,6 @@ jobs: run: | pip install junitparser python ./.github/scripts/check-ut.py ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true - - # Check the failure logs - failure_files=(${{ github.workspace }}/failures*.log) - if [ -e "${failure_files[0]}" ]; then - echo -e "Exist Failure logs" - echo "Found Failure logs as below: " - for file in "${failure_files[@]}"; do - echo " - $file" - done - cp "${failure_files[@]}" ${{ github.workspace }}/ut_log - echo -e "Failure logs Copied" - else - echo -e "No Failure logs" - fi - - # Copied the passed logs - cp passed*.log ${{ github.workspace }}/ut_log - - # Copied the Summary logs - cp category*.log ${{ github.workspace }}/ut_log - if [ -e ut_failure_list.csv ];then cp ut_failure_list.csv ${{ github.workspace }}/ut_log/ut_failure_list.csv || true fi From 567d07b02cef50730b2988c9edd9869d9720bdfe Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Mon, 1 Sep 2025 18:43:30 -0700 Subject: [PATCH 09/15] fix the file name issue --- .github/workflows/_linux_ut.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 48c133ba92..227ab7f965 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -216,7 +216,7 @@ jobs: ls -al ${{ github.workspace }}/ut_log cd ${{ github.workspace }}/ut_log/${{ inputs.ut }} - for log_file in "${{ github.workspace }}/ut_log"/{failures,passed,category}_"${{ inputs.ut }}".log; do + for log_file in "${{ github.workspace }}/ut_log"/{failures,passed,category}_*.log; do [[ -f "$log_file" ]] && cp "$log_file" ./ done From e7ede604fd5d9eda7c8a4128551fdfcf5eb6e35e Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Mon, 1 Sep 2025 22:34:03 -0700 Subject: [PATCH 10/15] fix the reproduce file issue --- .github/actions/linux-uttest/action.yml | 20 ++++++++++---------- .github/scripts/ut_result_check.sh | 20 +++++++++++++++----- .github/workflows/_linux_ut.yml | 7 +------ 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/actions/linux-uttest/action.yml b/.github/actions/linux-uttest/action.yml index f1b8d7e67e..0f9406a79c 100644 --- a/.github/actions/linux-uttest/action.yml +++ b/.github/actions/linux-uttest/action.yml @@ -20,8 +20,8 @@ runs: cd pytorch/third_party/torch-xpu-ops/test/regressions pytest --junit-xml=${{ github.workspace }}/ut_log/op_regression.xml \ 2> ${log_dir}/op_regression_test_error.log |tee ${log_dir}/op_regression_test.log - echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_regression.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_regression.log - name: op_regression_dev1 shell: timeout 300 bash -xe {0} if: ${{ inputs.ut_name == 'op_regression_dev1' || inputs.ut_name == 'basic' }} @@ -32,8 +32,8 @@ runs: timeout 180 pytest test_operation_on_device_1.py \ --junit-xml=${{ github.workspace }}/ut_log/op_regression_dev1.xml \ 2> ${log_dir}/op_regression_dev1_test_error.log |tee ${log_dir}/op_regression_dev1_test.log - echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/regressions" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_regression_dev1.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_regression_dev1.log - name: op_transformers shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'op_transformers' || inputs.ut_name == 'basic' }} @@ -45,8 +45,8 @@ runs: pytest test/test_transformers.py -k xpu \ --junit-xml=${{ github.workspace }}/ut_log/op_transformers.xml \ 2> ${log_dir}/op_transformers_test_error.log |tee ${log_dir}/op_transformers_test.log - echo -e "File Path: cd pytorch" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - echo -e "Reproduce Command: pytest -sv test/failed_case -k xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "File Path: cd pytorch" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_transformers.log + echo -e "Reproduce Command: pytest -sv test/failed_case -k xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_transformers.log - name: op_extended shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'op_extended' || inputs.ut_name == 'basic' }} @@ -59,8 +59,8 @@ runs: 2> ${log_dir}/op_extended_test_error.log |tee ${log_dir}/op_extended_test.log ls -al cp *.xml ${{ github.workspace }}/ut_log - echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu/extended" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu/extended" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_extended.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_extended.log - name: op_ut shell: timeout 18000 bash -xe {0} if: ${{ inputs.ut_name == 'op_ut' }} @@ -97,8 +97,8 @@ runs: tee ${{ github.workspace }}/ut_log/op_ut/op_ut_with_only_test.log ls -al cp *.xml ${{ github.workspace }}/ut_log - echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce.log - echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce.log + echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log + echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log - name: torch_xpu shell: timeout 3600 bash -xe {0} if: ${{ inputs.ut_name == 'torch_xpu' }} diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index d3ae4605ea..05cb08457e 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -125,11 +125,19 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "=========================================================================" echo -e "Show Failed cases in ${ut_suite}" echo -e "=========================================================================" - cat "./failures_${ut_suite}.log" + if [[ -f "failures_${ut_suite}.log" ]]; then + cat "./failures_${ut_suite}.log" + else + echo -e "\033[1;32mNo failed cases\033[0m" + fi echo -e "=========================================================================" echo -e "Checking Failed cases in ${ut_suite}" echo -e "=========================================================================" - compare_and_filter_logs failures_${ut_suite}.log Known_issue.log + if [[ -f "failures_${ut_suite}.log" ]]; then + compare_and_filter_logs failures_${ut_suite}.log Known_issue.log + else + echo -e "\033[1;32mNo need to check failed cases\033[0m" + fi echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" @@ -140,8 +148,10 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' check_test_cases category_${ut_suite}.log if [[ -f "failures_${ut_suite}_filtered.log" ]]; then num_failed=$(wc -l < "./failures_${ut_suite}_filtered.log") - else + elif [[ -f "failures_${ut_suite}.log" ]]; then num_failed=$(wc -l < "./failures_${ut_suite}.log") + else + num_failed=0 fi num_passed=$(wc -l < "./passed_${ut_suite}.log") echo -e "=========================================================================" @@ -149,8 +159,8 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "=========================================================================" if [[ $num_failed -gt 0 ]]; then echo -e "Need reproduce command" - if [[ -f "reproduce.log" ]]; then - cat "./reproduce.log" + if [[ -f "reproduce_${ut_suite}.log" ]]; then + cat "./reproduce_${ut_suite}.log" fi else echo -e "Not need reproduce command" diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 227ab7f965..80c385b999 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -216,7 +216,7 @@ jobs: ls -al ${{ github.workspace }}/ut_log cd ${{ github.workspace }}/ut_log/${{ inputs.ut }} - for log_file in "${{ github.workspace }}/ut_log"/{failures,passed,category}_*.log; do + for log_file in "${{ github.workspace }}/ut_log"/{failures,passed,category,reproduce}_*.log; do [[ -f "$log_file" ]] && cp "$log_file" ./ done @@ -235,11 +235,6 @@ jobs: ut_list="${{ inputs.ut }}" fi - # Provide Reproduce Command - if [[ -f "${{ github.workspace }}/ut_log/reproduce.log" ]]; then - cp ${{ github.workspace }}/ut_log/reproduce.log ./ - fi - cp ${{ github.workspace }}/.github/scripts/ut_result_check.sh ./ for ut_name in ${ut_list} do From e3f7345b5e74611a286b9e2852a6025e55bd23e8 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Mon, 1 Sep 2025 23:11:45 -0700 Subject: [PATCH 11/15] udpate the result show --- .github/scripts/ut_result_check.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 05cb08457e..8042528f73 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -51,6 +51,8 @@ compare_and_filter_logs() { echo -e "\n\033[1;31mNew failed cases, not in known issues\033[0m" cat "$output_file" fi + + rm -f ${filtered_content} } check_passed_known_issues() { @@ -131,21 +133,22 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "\033[1;32mNo failed cases\033[0m" fi echo -e "=========================================================================" - echo -e "Checking Failed cases in ${ut_suite}" + echo -e "Checking Test case number for ${ut_suite}" echo -e "=========================================================================" - if [[ -f "failures_${ut_suite}.log" ]]; then - compare_and_filter_logs failures_${ut_suite}.log Known_issue.log - else - echo -e "\033[1;32mNo need to check failed cases\033[0m" - fi + check_test_cases category_${ut_suite}.log echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" check_passed_known_issues passed_${ut_suite}.log Known_issue.log echo -e "=========================================================================" - echo -e "Checking Test case number for ${ut_suite}" + echo -e "Checking Failed cases in ${ut_suite}" echo -e "=========================================================================" - check_test_cases category_${ut_suite}.log + if [[ -f "failures_${ut_suite}.log" ]]; then + compare_and_filter_logs failures_${ut_suite}.log Known_issue.log + else + echo -e "\033[1;32mNo need to check failed cases\033[0m" + fi + if [[ -f "failures_${ut_suite}_filtered.log" ]]; then num_failed=$(wc -l < "./failures_${ut_suite}_filtered.log") elif [[ -f "failures_${ut_suite}.log" ]]; then From 0b7fd2ca9201252db06365aaae66d3826cf69969 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Mon, 1 Sep 2025 23:13:52 -0700 Subject: [PATCH 12/15] update new pass check --- .github/scripts/ut_result_check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 8042528f73..2f4c3b5d9a 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -72,6 +72,8 @@ check_passed_known_issues() { else echo -e "\033[1;33mNo known issues are now passing\033[0m" fi + + rm -f ${output_file} } check_test_cases() { From 41018da70df4d105d0f0ea892d01acaf89215048 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Mon, 1 Sep 2025 23:18:48 -0700 Subject: [PATCH 13/15] align the lint check --- .github/scripts/ut_result_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index 2f4c3b5d9a..b49fdbfe99 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -150,7 +150,7 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' else echo -e "\033[1;32mNo need to check failed cases\033[0m" fi - + if [[ -f "failures_${ut_suite}_filtered.log" ]]; then num_failed=$(wc -l < "./failures_${ut_suite}_filtered.log") elif [[ -f "failures_${ut_suite}.log" ]]; then From 771bd93e7fb89e17a41b7efdc11e1e96e168166f Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Wed, 3 Sep 2025 19:17:17 -0700 Subject: [PATCH 14/15] adjust the result show --- .github/scripts/ut_result_check.sh | 68 +++++++++++++++++++----------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index b49fdbfe99..fbff14fd16 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -2,14 +2,13 @@ ut_suite="${1:-op_regression}" # op_regression / op_extended / op_ut / torch_xpu # usage -# compare_and_filter_logs [output.log] +# check_new_failed [output.log] all_pass="" -compare_and_filter_logs() { +check_new_failed() { local file_UT="$1" local file_known_issue="$2" local output_file="${3:-${file_UT%.*}_filtered.log}" - local filtered_content="${file_UT%.*}_removed.log" if [[ $# -lt 2 ]]; then echo "[ERROR] Need 2 files to compare" @@ -28,22 +27,6 @@ compare_and_filter_logs() { echo "Filtering $file_known_issue for $file_UT" grep -vFxf "$file_known_issue" "$file_UT" > "$output_file" - # Keep the filtered UT cases - grep -noFf "$file_known_issue" "$file_UT" > "$filtered_content" - echo "Filtered cases file: $filtered_content" - - if [[ -s "$filtered_content" ]]; then - echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" - awk -F':' '{ - line_number = $1 - $1 = "" - gsub(/^ /, "", $0) - printf "\033[33m%3d\033[0m: %s\n", line_number, $0 - }' "$filtered_content" - else - echo -e "\n\033[1;32mNo Skipped Cases\033[0m" - fi - echo -e "\n\033[1;31m[New failed cases Summary]\033[0m" if [[ -z "$(tr -d ' \t\n\r\f' < "$output_file" 2>/dev/null)" ]]; then echo -e "\033[1;32mNo new failed cases found\033[0m" @@ -51,8 +34,15 @@ compare_and_filter_logs() { echo -e "\n\033[1;31mNew failed cases, not in known issues\033[0m" cat "$output_file" fi +} - rm -f ${filtered_content} +check_filtered_logs() { + local file_UT="$1" + local file_known_issue="$2" + local filtered_content="${file_UT%.*}_removed.log" + # Keep the filtered UT cases + grep -noFf "$file_known_issue" "$file_UT" > "$filtered_content" + echo "Filtered cases file: $filtered_content" } check_passed_known_issues() { @@ -139,14 +129,29 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "=========================================================================" check_test_cases category_${ut_suite}.log echo -e "=========================================================================" + echo -e "Checking Filtered cases for ${ut_suite}" + echo -e "=========================================================================" + check_filtered_logs failures_${ut_suite}.log Known_issue.log + if [[ -f "failures_${ut_suite}_removed.log" ]]; then + echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" + awk -F':' '{ + line_number = $1 + $1 = "" + gsub(/^ /, "", $0) + printf "\033[33m%3d\033[0m: %s\n", line_number, $0 + }' "failures_${ut_suite}_removed.log" + else + echo -e "\n\033[1;32mNo Skipped Cases\033[0m" + fi + echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" check_passed_known_issues passed_${ut_suite}.log Known_issue.log echo -e "=========================================================================" - echo -e "Checking Failed cases in ${ut_suite}" + echo -e "Checking New Failed cases in ${ut_suite}" echo -e "=========================================================================" if [[ -f "failures_${ut_suite}.log" ]]; then - compare_and_filter_logs failures_${ut_suite}.log Known_issue.log + check_new_failed failures_${ut_suite}.log Known_issue.log else echo -e "\033[1;32mNo need to check failed cases\033[0m" fi @@ -215,13 +220,28 @@ if [[ "${ut_suite}" == 'xpu_distributed' ]]; then echo -e "=========================================================================" cat "./${ut_suite}_xpu_distributed_test_failed.log" echo -e "=========================================================================" - echo -e "Checking Failed cases in ${ut_suite} xpu distributed" + echo -e "Checking Filtered cases for ${ut_suite} xpu distributed" echo -e "=========================================================================" - compare_and_filter_logs "${ut_suite}"_xpu_distributed_test_failed.log Known_issue.log + check_filtered_logs "${ut_suite}"_xpu_distributed_test_failed.log Known_issue.log + if [[ -f "${ut_suite}_xpu_distributed_test_failed_removed.log" ]]; then + echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" + awk -F':' '{ + line_number = $1 + $1 = "" + gsub(/^ /, "", $0) + printf "\033[33m%3d\033[0m: %s\n", line_number, $0 + }' "${ut_suite}_xpu_distributed_test_failed_removed.log" + else + echo -e "\n\033[1;32mNo Skipped Cases\033[0m" + fi echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" echo -e "=========================================================================" check_passed_known_issues "${ut_suite}"_xpu_distributed_test_passed.log Known_issue.log + echo -e "=========================================================================" + echo -e "Checking Failed cases in ${ut_suite} xpu distributed" + echo -e "=========================================================================" + check_new_failed "${ut_suite}"_xpu_distributed_test_failed.log Known_issue.log if [[ -f "${ut_suite}_xpu_distributed_test_failed_filtered.log" ]]; then num_failed_xpu_distributed=$(wc -l < "./${ut_suite}_xpu_distributed_test_failed_filtered.log") else From 811d8fbe0e3c7d65adb3376e1f5839f74e6e4968 Mon Sep 17 00:00:00 2001 From: "Zhong, Ruijie" Date: Wed, 3 Sep 2025 20:44:52 -0700 Subject: [PATCH 15/15] fix the filtered issue --- .github/scripts/ut_result_check.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/scripts/ut_result_check.sh b/.github/scripts/ut_result_check.sh index fbff14fd16..efdd92dcbf 100644 --- a/.github/scripts/ut_result_check.sh +++ b/.github/scripts/ut_result_check.sh @@ -131,17 +131,22 @@ if [[ "${ut_suite}" == 'op_regression' || "${ut_suite}" == 'op_regression_dev1' echo -e "=========================================================================" echo -e "Checking Filtered cases for ${ut_suite}" echo -e "=========================================================================" - check_filtered_logs failures_${ut_suite}.log Known_issue.log - if [[ -f "failures_${ut_suite}_removed.log" ]]; then - echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" - awk -F':' '{ - line_number = $1 - $1 = "" - gsub(/^ /, "", $0) - printf "\033[33m%3d\033[0m: %s\n", line_number, $0 - }' "failures_${ut_suite}_removed.log" + if [[ -f "failures_${ut_suite}.log" ]]; then + check_filtered_logs failures_${ut_suite}.log Known_issue.log + num_filtered=$(wc -l < "./failures_${ut_suite}_removed.log") + if [[ $num_filtered -gt 0 ]]; then + echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" + awk -F':' '{ + line_number = $1 + $1 = "" + gsub(/^ /, "", $0) + printf "\033[33m%3d\033[0m: %s\n", line_number, $0 + }' "failures_${ut_suite}_removed.log" + else + echo -e "\n\033[1;32mNo Skipped Cases\033[0m" + fi else - echo -e "\n\033[1;32mNo Skipped Cases\033[0m" + echo -e "\033[1;32mNo need to check filtered cases\033[0m" fi echo -e "=========================================================================" echo -e "Checking New passed cases in Known issue list for ${ut_suite}" @@ -223,7 +228,8 @@ if [[ "${ut_suite}" == 'xpu_distributed' ]]; then echo -e "Checking Filtered cases for ${ut_suite} xpu distributed" echo -e "=========================================================================" check_filtered_logs "${ut_suite}"_xpu_distributed_test_failed.log Known_issue.log - if [[ -f "${ut_suite}_xpu_distributed_test_failed_removed.log" ]]; then + num_filtered_xpu_distributed=$(wc -l < "./${ut_suite}_xpu_distributed_test_failed_removed.log") + if [[ $num_filtered_xpu_distributed -gt 0 ]]; then echo -e "\n\033[1;31m[These failed cases are in skip list, will filter]\033[0m" awk -F':' '{ line_number = $1