blob: 63e64443250dd4a8e45590ab3b47a0c5932f159f [file] [log] [blame]
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Run all(ish) IREE tests with CTest. Designed for CI, but can be run manually.
# Assumes that the project has already been built at ${REPO_ROOT}/build (e.g.
# with build_tools/cmake/clean_build.sh)
set -x
set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
# Respect the user setting, but default to as many jobs as we have cores.
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:-$(nproc)}
# Respect the user setting, but default to turning off the vulkan tests
# and turning on the llvmaot ones.
export IREE_VULKAN_DISABLE=${IREE_VULKAN_DISABLE:-0}
export IREE_LLVMAOT_DISABLE=${IREE_LLVMAOT_DISABLE:-0}
# CUDA is off by default.
export IREE_CUDA_DISABLE=${IREE_CUDA_DISABLE:-1}
# The VK_KHR_shader_float16_int8 extension is optional prior to Vulkan 1.2.
# We test on SwiftShader, which does not support this extension.
export IREE_VULKAN_F16_DISABLE=${IREE_VULKAN_F16_DISABLE:-1}
# Tests to exclude by label. In addition to any custom labels (which are carried
# over from Bazel tags), every test should be labeled with the directory it is
# in.
declare -a label_exclude_args=(
# Exclude specific labels.
# Put the whole label with anchors for exact matches.
# For example:
# ^nokokoro$
^nokokoro$
# Exclude all tests in a directory.
# Put the whole directory with anchors for exact matches.
# For example:
# ^bindings/python/iree/runtime$
# Exclude all tests in some subdirectories.
# Put the whole parent directory with only a starting anchor.
# Use a trailing slash to avoid prefix collisions.
# For example:
# ^bindings/
)
if [[ "${IREE_VULKAN_DISABLE?}" == 1 ]]; then
label_exclude_args+=("^driver=vulkan$")
fi
if [[ "${IREE_LLVMAOT_DISABLE?}" == 1 ]]; then
label_exclude_args+=("^driver=dylib$")
fi
if [[ "${IREE_CUDA_DISABLE?}" == 1 ]]; then
label_exclude_args+=("^driver=cuda$")
fi
if [[ "${IREE_VULKAN_F16_DISABLE?}" == 1 ]]; then
label_exclude_args+=("^vulkan_uses_vk_khr_shader_float16_int8$")
fi
# Join on "|"
label_exclude_regex="($(IFS="|" ; echo "${label_exclude_args[*]?}"))"
cd ${ROOT_DIR?}/build
ctest --output-on-failure --label-exclude "${label_exclude_regex?}"