Skip to content

Commit e6d502f

Browse files
committed
Improve test-op to do benchmarks
1 parent 754c602 commit e6d502f

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

.github/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,6 @@ tests:
146146
- 'pytest.ini'
147147
# NOTE: This directory also contains DSA, FLA operator tests
148148
- 'tests/**'
149+
- 'benchmark/**'
149150
# TODO: Move test scripts to tests/scripts
150151
- 'tools/**'

tools/test-op.sh

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,29 @@ fi
2727
# Test cases that needs to run quick cpu tests
2828
NO_QUICK_CPU_TESTS=(
2929
"tests/ks_tests.py"
30-
"tests/test_conv3d.py"
31-
"tests/test_convolution_ops.py"
32-
"tests/test_distribution_ops.py"
3330
"tests/test_enable_api.py"
3431
"tests/test_libentry.py"
3532
"tests/test_pointwise_type_promotion.py"
3633
"tests/test_quant.py"
3734
"tests/test_shape_utils.py"
3835
"tests/test_tensor_wrapper.py"
39-
"tests/test_vllm_ops.py"
4036
)
4137

4238
# Extract test cases from CHANGED_FILES
4339
TEST_CASES=()
40+
PERF_TEST_CASES=()
4441
TEST_CASES_CPU=()
4542
for item in $CHANGED_FILES; do
4643
case $item in
47-
# tests/test_DSA/*)
48-
# skip DSA test for now
49-
# ;;
5044
tests/test_quant.py)
5145
# skip because it always fail
5246
;;
53-
tests/*) TEST_CASES+=($item)
47+
tests/*)
48+
TEST_CASES+=($item)
49+
;;
50+
benchmark/*)
51+
PERF_TEST_CASES+=($item)
52+
;;
5453
esac
5554

5655
# filter out tests that do not need quick CPU mode tests
@@ -69,7 +68,7 @@ for item in $CHANGED_FILES; do
6968
done
7069

7170
# Skip tests if no tests file is found
72-
if [ ${#TEST_CASES[@]} -eq 0 ]; then
71+
if [ ${#TEST_CASES[@]} -eq 0 && ${#PERF_TEST_CASES[@]} -eq 0 ]; then
7372
exit 0
7473
fi
7574

@@ -78,13 +77,21 @@ coverage erase
7877

7978
echo "Running unit tests for ${TEST_CASES[@]}"
8079
# TODO(Qiming): Check if utils test should use a different data file
81-
coverage run -m pytest -s ${EXTRA_OPTS} ${TEST_CASES[@]}
80+
for item in "${TEST_CASES[@]}"; do
81+
coverage run -m pytest -s ${EXTRA_OPTS} ${item}
82+
done
8283

8384
# Run quick-cpu test if necessary
84-
if [[ ${#TEST_CASES_CPU[@]} -ne 0 ]]; then
85-
echo "Running quick-cpu mode unit tests for ${TEST_CASES_CPU[@]}"
86-
coverage run -m pytest -s ${EXTRA_OPTS} ${TEST_CASES_CPU[@]} --ref=cpu --quick
87-
fi
85+
for item in "${TEST_CASES_CPU[@]}"; do
86+
echo "Running quick-cpu mode unit tests for ${item}"
87+
coverage run -m pytest -s ${EXTRA_OPTS} ${item} --ref=cpu --quick
88+
done
89+
90+
# Run benchmark test if necessary
91+
for item in "${PERF_TEST_CASES[@]}"; do
92+
echo "Running benchmark tests for ${item}"
93+
pytest -s --level core --record log ${item}
94+
done
8895

8996
# Process coverage data only when full-range testing
9097
# Coverage data HTML dumped to `htmlcov/` by default

0 commit comments

Comments
 (0)