Skip to content

Commit

Permalink
supported on CI and support timeout, support pass_rate
Browse files Browse the repository at this point in the history
  • Loading branch information
AshburnLee committed Jun 22, 2024
1 parent 9903112 commit f7b54b6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-test-a770.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ on:
description: Custom run name
type: string
default: "Build and test on A770"
enable_unskip:
description: Ignore pytest.skip
type: boolean
default: false

schedule:
# Every midnight PST (UTC-8)
- cron: "0 8 * * *"
Expand All @@ -56,3 +61,4 @@ jobs:
upload_test_reports: ${{ inputs.upload_test_reports }}
ignore_errors: ${{ inputs.ignore_errors }}
run_name: ${{ inputs.run_name }}
enable_unskip: ${{ (github.event_name == 'workflow_dispatch' && inputs.enable_unskip) || 'false' }}
5 changes: 5 additions & 0 deletions .github/workflows/build-test-no-ipex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: Custom run name
type: string
default: "Build and test upstream pytorch with no IPEX"
enable_unskip:
description: Ignore pytest.skip
type: boolean
default: false
schedule:
# Every midnight PST (UTC-8)
- cron: "0 8 * * *"
Expand All @@ -47,3 +51,4 @@ jobs:
upload_test_reports: ${{ inputs.upload_test_reports }}
ignore_errors: ${{ inputs.ignore_errors }}
run_name: ${{ inputs.run_name }}
enable_unskip: ${{ (github.event_name == 'workflow_dispatch' && inputs.enable_unskip) || 'false' }}
7 changes: 6 additions & 1 deletion .github/workflows/build-test-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ on:
description: Custom run name
type: string
default: "Build and test"
enable_unskip:
description: Ignore pytest.skip
type: boolean
default: false

permissions: read-all

env:
TRITON_DISABLE_LINE_INFO: 1
TORCH_XPU_OPS_COMMIT: 39522db63ce045f52c9d61a286018c266cd00479
TEST_UNSKIP: ${{ inputs.enable_unskip }}

jobs:
print_inputs:
Expand Down Expand Up @@ -118,7 +123,7 @@ jobs:
run: |
export DEBUG=1
cd python
pip install wheel pytest pytest-xdist pytest-rerunfailures pytest-select
pip install wheel pytest pytest-xdist pytest-rerunfailures pytest-select pytest-timeout
pip install --no-build-isolation '.[build,tests,tutorials]'
pip install git+https://github.com/kwasd/pytest-capturewarnings-ng.git@v1.2.0
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ on:
description: Custom run name
type: string
default: "Build and test"
enable_unskip:
description: Ignore pytest.skip
type: boolean
default: false

pull_request:
branches:
- llvm-target
Expand Down Expand Up @@ -109,3 +114,4 @@ jobs:
upload_test_reports: ${{ inputs.upload_test_reports || false }}
ignore_errors: ${{ inputs.ignore_errors || false }}
run_name: ${{ inputs.run_name }}
enable_unskip: ${{ (github.event_name == 'workflow_dispatch' && inputs.enable_unskip) || 'false' }}
11 changes: 8 additions & 3 deletions scripts/pass_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ def parse_report(report_path: pathlib.Path) -> ReportStats:
except FileNotFoundError:
pass
stats.fixme += len(testsuite_fixme_tests)
deselected = get_deselected(report_path)
stats.skipped += deselected
stats.total += deselected

test_unskip = os.getenv('TEST_UNSKIP')
if test_unskip is None or test_unskip not in ("true", "false"):
raise ValueError("Error: please set TEST_UNSKIP true or false")
if test_unskip == 'false':
deselected = get_deselected(report_path)
stats.skipped += deselected
stats.total += deselected
stats.passed = stats.total - stats.failed - stats.skipped - stats.xfailed
return stats

Expand Down
12 changes: 8 additions & 4 deletions scripts/pytest-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ pytest() {
mkdir -p "$CURRENT_SKIPLIST_DIR"
# skip comments in the skiplist
sed -e '/^#/d' "$TRITON_TEST_SKIPLIST_DIR/$TRITON_TEST_SUITE.txt" > "$CURRENT_SKIPLIST_DIR/$TRITON_TEST_SUITE.txt"
pytest_extra_args+=(
"--deselect-from-file=$CURRENT_SKIPLIST_DIR/$TRITON_TEST_SUITE.txt"
"--select-fail-on-missing"
)
if [[ $TEST_UNSKIP = false ]]; then
pytest_extra_args+=(
"--deselect-from-file=$CURRENT_SKIPLIST_DIR/$TRITON_TEST_SUITE.txt"
"--select-fail-on-missing"
)
else
pytest_extra_args+=("--timeout=500")
fi
fi

python3 -u -m pytest "${pytest_extra_args[@]}" "$@" || $TRITON_TEST_IGNORE_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-triton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export TRITON_PROJ=$BASE/intel-xpu-backend-for-triton
export TRITON_PROJ_BUILD=$TRITON_PROJ/python/build
export SCRIPTS_DIR=$(cd $(dirname "$0") && pwd)

python3 -m pip install lit pytest pytest-xdist pytest-rerunfailures pytest-select setuptools==69.5.1
python3 -m pip install lit pytest pytest-xdist pytest-rerunfailures pytest-select pytest-timeout setuptools==69.5.1

if [ "$TRITON_TEST_WARNING_REPORTS" == true ]; then
python3 -m pip install git+https://github.com/kwasd/pytest-capturewarnings-ng@v1.2.0
Expand Down

0 comments on commit f7b54b6

Please sign in to comment.