blob: 24079bb703baf764e06caa64e16f51772f516201 [file] [log] [blame]
Geoffrey Martin-Noble552d3f82021-05-25 17:56:09 -07001# Copyright 2020 The IREE Authors
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -08002#
Geoffrey Martin-Noble552d3f82021-05-25 17:56:09 -07003# Licensed under the Apache License v2.0 with LLVM Exceptions.
4# See https://llvm.org/LICENSE.txt for license information.
5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -08006
7# Run all(ish) IREE tests with CTest. Designed for CI, but can be run manually.
8# Assumes that the project has already been built at ${REPO_ROOT}/build (e.g.
Geoffrey Martin-Noble553a75b2020-03-09 10:59:32 -07009# with build_tools/cmake/clean_build.sh)
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -080010
11set -x
12set -e
13
Stella Laurenzo804266f2021-06-02 15:50:04 -070014if [ -z "$BUILD_DIR" ]; then
15 BUILD_DIR="$(git rev-parse --show-toplevel)/build"
16fi
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -080017
18# Respect the user setting, but default to as many jobs as we have cores.
19export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:-$(nproc)}
20
Scott Toddcba0bc42022-03-16 13:03:09 -070021# Respect the user setting, but default to turning on vulkan.
Geoffrey Martin-Noblef941efb2020-09-15 13:16:05 -070022export IREE_VULKAN_DISABLE=${IREE_VULKAN_DISABLE:-0}
Thomas35505fc2021-03-04 08:52:02 -080023# CUDA is off by default.
24export IREE_CUDA_DISABLE=${IREE_CUDA_DISABLE:-1}
Thomas10f5eaf2021-03-31 10:22:20 -070025# The VK_KHR_shader_float16_int8 extension is optional prior to Vulkan 1.2.
26# We test on SwiftShader, which does not support this extension.
27export IREE_VULKAN_F16_DISABLE=${IREE_VULKAN_F16_DISABLE:-1}
Geoffrey Martin-Noblea9279762020-02-18 10:46:51 -080028
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070029# Tests to exclude by label. In addition to any custom labels (which are carried
phoenix-meadowlarkdaaf3882020-05-21 10:45:45 -070030# over from Bazel tags), every test should be labeled with the directory it is
31# in.
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070032declare -a label_exclude_args=(
33 # Exclude specific labels.
34 # Put the whole label with anchors for exact matches.
35 # For example:
Geoffrey Martin-Noble1f2a2292020-06-10 11:45:31 -070036 # ^nokokoro$
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070037 ^nokokoro$
38
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070039 # Exclude all tests in a directory.
40 # Put the whole directory with anchors for exact matches.
41 # For example:
Phoenix Meadowlarkb3270962021-03-18 09:20:38 -070042 # ^bindings/python/iree/runtime$
phoenix-meadowlarkdaaf3882020-05-21 10:45:45 -070043
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070044 # Exclude all tests in some subdirectories.
45 # Put the whole parent directory with only a starting anchor.
46 # Use a trailing slash to avoid prefix collisions.
47 # For example:
48 # ^bindings/
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -080049)
50
Geoffrey Martin-Noble1f2a2292020-06-10 11:45:31 -070051if [[ "${IREE_VULKAN_DISABLE?}" == 1 ]]; then
52 label_exclude_args+=("^driver=vulkan$")
53fi
Thomas35505fc2021-03-04 08:52:02 -080054if [[ "${IREE_CUDA_DISABLE?}" == 1 ]]; then
55 label_exclude_args+=("^driver=cuda$")
56fi
Thomas10f5eaf2021-03-31 10:22:20 -070057if [[ "${IREE_VULKAN_F16_DISABLE?}" == 1 ]]; then
58 label_exclude_args+=("^vulkan_uses_vk_khr_shader_float16_int8$")
59fi
Geoffrey Martin-Noble1f2a2292020-06-10 11:45:31 -070060
Geoffrey Martin-Nobleb5b46cb2020-04-01 12:12:18 -070061# Join on "|"
62label_exclude_regex="($(IFS="|" ; echo "${label_exclude_args[*]?}"))"
Geoffrey Martin-Noble5007a962020-02-11 10:04:08 -080063
Stella Laurenzo804266f2021-06-02 15:50:04 -070064cd "$BUILD_DIR"
Stella Laurenzo02cfcd12021-11-14 13:20:53 -080065echo "******************** Running main project ctests ************************"
Geoffrey Martin-Nobleaad9fd12021-08-04 16:52:54 -070066ctest --timeout 900 --output-on-failure --label-exclude "${label_exclude_regex?}"
Stella Laurenzo02cfcd12021-11-14 13:20:53 -080067
68echo "******************** llvm-external-projects tests ***********************"
Geoffrey Martin-Noble0f809952022-02-11 12:12:07 -080069cmake --build . --target check-iree-dialects -- -k 0