Skip to content

Commit

Permalink
Stop running some python testsuites twice
Browse files Browse the repository at this point in the history
* Fix typos and remove error-prone for-loop introduced in #7407.
  • Loading branch information
areusch committed Feb 10, 2021
1 parent 79b6ef7 commit 78e3f4b
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 38 deletions.
13 changes: 9 additions & 4 deletions tests/scripts/setup-pytest-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ export TVM_PYTEST_RESULT_DIR="${TVM_PATH}/build/pytest-results"
mkdir -p "${TVM_PYTEST_RESULT_DIR}"

function run_pytest() {
test_suite_name="$1"
local ffi_type="$1"
shift
for ffi_type in ${TVM_PYTEST_FFI_TYPES:-ctypes cython}; do
TVM_FFI=${ffi_type} python3 -m pytest \
local test_suite_name="$1"
shift
if [ -z "${ffi_type}" -o -z "${test_suite_name}" ]; then
echo "error: run_pytest called incorrectly: run_pytest ${ffi_type} ${test_suite_name} $@"
echo "usage: run_pytest <FFI_TYPE> <TEST_SUITE_NAME> [pytest args...]"
exit 2
fi
TVM_FFI=${ffi_type} python3 -m pytest \
-o "junit_suite_name=${test_suite_name}-${ffi_type}" \
"--junit-xml=${TVM_PYTEST_RESULT_DIR}/${test_suite_name}-${ffi_type}.xml" \
"$@"
done
}
3 changes: 1 addition & 2 deletions tests/scripts/task_python_arm_compute_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ source tests/scripts/setup-pytest-env.sh
find . -type f -path "*.pyc" | xargs rm -f
make cython3

TVM_PYTEST_FFI_TYPES=ctypes run_pytest python-arm_compute_lib \
tests/python/contrib/test_arm_compute_lib
run_pytest ctypes python-arm_compute_lib tests/python/contrib/test_arm_compute_lib
2 changes: 1 addition & 1 deletion tests/scripts/task_python_ethosn_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ source tests/scripts/setup-pytest-env.sh
find . -type f -path "*.pyc" | xargs rm -f
make cython3

TVM_PYTEST_FFI_TYPES=ctypes run_pytest python-ethosn tests/python/contrib/test_ethosn
run_pytest ctypes python-ethosn tests/python/contrib/test_ethosn
14 changes: 7 additions & 7 deletions tests/scripts/task_python_frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ find . -type f -path "*.pyc" | xargs rm -f
make cython3

echo "Running relay MXNet frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-mxnet tests/python/frontend/mxnet
run_pytest cython python-frontend-mxnet tests/python/frontend/mxnet

echo "Running relay ONNX frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-onnx tests/python/frontend/onnx
run_pytest cython python-frontend-onnx tests/python/frontend/onnx

echo "Running relay CoreML frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-coreml tests/python/frontend/coreml
run_pytest cython python-frontend-coreml tests/python/frontend/coreml

echo "Running relay Tensorflow frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-tensorflow tests/python/frontend/tensorflow
run_pytest cython python-frontend-tensorflow tests/python/frontend/tensorflow

echo "Running relay caffe2 frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-caffe2 tests/python/frontend/caffe2
run_pytest cython python-frontend-caffe2 tests/python/frontend/caffe2

echo "Running relay DarkNet frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-darknet tests/python/frontend/darknet
run_pytest cython python-frontend-darknet tests/python/frontend/darknet

echo "Running relay PyTorch frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-pytorch tests/python/frontend/pytorch
run_pytest cython python-frontend-pytorch tests/python/frontend/pytorch
6 changes: 3 additions & 3 deletions tests/scripts/task_python_frontend_cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ find . -type f -path "*.pyc" | xargs rm -f
make cython3

echo "Running relay TFLite frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-tflite tests/python/frontend/tflite
run_pytest cython python-frontend-tflite tests/python/frontend/tflite

echo "Running relay Keras frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-keras tests/python/frontend/keras
run_pytest cython python-frontend-keras tests/python/frontend/keras

echo "Running relay Caffe frontend test..."
TVM_PYTHON_FFI_TYPES=cython run_pytest python-frontend-caffe tests/python/frontend/caffe
run_pytest cython python-frontend-caffe tests/python/frontend/caffe
18 changes: 10 additions & 8 deletions tests/scripts/task_python_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export LD_LIBRARY_PATH="build:${LD_LIBRARY_PATH:-}"
export TVM_BIND_THREADS=0
export TVM_NUM_THREADS=2

# NOTE: also set by task_python_integration_gpuonly.sh.
if [ -z "${TVM_INTEGRATION_TESTSUITE_NAME:-}" ]; then
TVM_INTEGRATION_TESTSUITE_NAME=python-integration
fi
Expand All @@ -43,28 +44,29 @@ rm -rf lib
make
cd ../..

run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests
run_pytest cython ${TVM_INTEGRATION_TESTSUITE_NAME}-extensions apps/extension/tests

# Test dso plugin
cd apps/dso_plugin_module
rm -rf lib
make
cd ../..
run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module
run_pytest cython ${TVM_INTEGRATION_TESTSUITE_NAME}-dso_plugin_module apps/dso_plugin_module

# Do not enable TensorFlow op
# TVM_FFI=cython sh prepare_and_test_tfop_module.sh
# TVM_FFI=ctypes sh prepare_and_test_tfop_module.sh

TVM_PYTEST_FFI_TYPES=ctypes run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME} tests/python/integration
TVM_PYTEST_FFI_TYPES=ctypes run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME} tests/python/integration
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-contrib tests/python/contrib

TVM_TEST_TARGETS="${TVM_RELAY_TEST_TARGETS:-llvm;cuda}" \
TVM_PYTEST_FFI_TYPES=ctypes \
run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-relay tests/python/relay

# Command line driver test
TVM_PYTEST_FFI_TYPES=ctypes run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-driver tests/python/driver
run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-driver tests/python/driver

# Do not enable OpenGL
# run_pytest ${TVM_INTEGRATION_TESTSUITE_NAME}-webgl tests/webgl
# run_pytest ctypes ${TVM_INTEGRATION_TESTSUITE_NAME}-webgl tests/webgl
2 changes: 1 addition & 1 deletion tests/scripts/task_python_microtvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ source tests/scripts/setup-pytest-env.sh
find . -type f -path "*.pyc" | xargs rm -f

make cython3
run_pytest python-microtvm-qemu tests/micro/qemu
run_pytest ctypes python-microtvm-qemu tests/micro/qemu
2 changes: 1 addition & 1 deletion tests/scripts/task_python_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ make cython3
# cleanup pycache
find . -type f -path "*.pyc" | xargs rm -f

TVM_PYTEST_FFI_TYPES=cython run_pytest python-topi-nightly tests/python/topi/nightly
run_pytest cython python-topi-nightly tests/python/topi/nightly
2 changes: 1 addition & 1 deletion tests/scripts/task_python_topi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ make cython3
# cleanup pycache
find . -type f -path "*.pyc" | xargs rm -f

TVM_PYTHON_FFI_TYPES=cython run_pytest python-topi tests/python/topi/
run_pytest cython python-topi tests/python/topi/
10 changes: 8 additions & 2 deletions tests/scripts/task_python_unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ source tests/scripts/setup-pytest-env.sh
find . -type f -path "*.pyc" | xargs rm -f
make cython3

# NOTE: also set by task_python_unittest_gpuonly.sh.
if [ -z "${TVM_UNITTEST_TESTSUITE_NAME:-}" ]; then
TVM_UNITTEST_TESTSUITE_NAME=python-unittest
fi

run_pytest ${TVM_UNITTEST_TESTSUITE_NAME}-platform-minimal-test tests/python/all-platform-minimal-test
run_pytest ${TVM_UNITTEST_TESTSUITE_NAME} tests/python/unittest
# First run minimal test on both ctypes and cython.
run_pytest ctypes ${TVM_UNITTEST_TESTSUITE_NAME}-platform-minimal-test tests/python/all-platform-minimal-test
run_pytest cython ${TVM_UNITTEST_TESTSUITE_NAME}-platform-minimal-test tests/python/all-platform-minimal-test

# Then run all unittests on both ctypes and cython.
run_pytest ctypes ${TVM_UNITTEST_TESTSUITE_NAME} tests/python/unittest
run_pytest cython ${TVM_UNITTEST_TESTSUITE_NAME} tests/python/unittest
6 changes: 2 additions & 4 deletions tests/scripts/task_python_vta_fsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ cp ${VTA_HW_PATH}/config/fsim_sample.json ${VTA_HW_PATH}/config/vta_config.json

# Run unit tests in functional/fast simulator
echo "Running unittest in fsim..."
TVM_PYTEST_FFI_TYPES=cython run_pytest python-vta-fsim-unittest \
${TVM_PATH}/vta/tests/python/unittest
run_pytest cython python-vta-fsim-unittest ${TVM_PATH}/vta/tests/python/unittest

# Run unit tests in functional/fast simulator
echo "Running integration test in fsim..."
TVM_PYTEST_FFI_TYPES=cython run_pytest python-vta-fsim-integration \
${TVM_PATH}/vta/tests/python/integration
run_pytest cython python-vta-fsim-integration ${TVM_PATH}/vta/tests/python/integration
6 changes: 2 additions & 4 deletions tests/scripts/task_python_vta_tsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ make -C ${VTA_HW_PATH}/hardware/chisel USE_THREADS=0 lib

# Run unit tests in cycle accurate simulator
echo "Running unittest in tsim..."
TVM_PYTEST_FFI_TYPES=cython run_pytest python-vta-tsim-unittest \
${TVM_PATH}/vta/tests/python/unittest
run_pytest cython python-vta-tsim-unittest ${TVM_PATH}/vta/tests/python/unittest

# Run unit tests in cycle accurate simulator
echo "Running integration test in tsim..."
TVM_PYTEST_FFI_TYPES=cython run_pytest python-vta-tsim-integration \
${TVM_PATH}/vta/tests/python/integration
run_pytest cython python-vta-tsim-integration ${TVM_PATH}/vta/tests/python/integration

# Reset default fsim simulation
cp ${VTA_HW_PATH}/config/fsim_sample.json ${VTA_HW_PATH}/config/vta_config.json

0 comments on commit 78e3f4b

Please sign in to comment.