Geoffrey Martin-Noble | 552d3f8 | 2021-05-25 17:56:09 -0700 | [diff] [blame] | 1 | # Copyright 2020 The IREE Authors |
Geoffrey Martin-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 2 | # |
Geoffrey Martin-Noble | 552d3f8 | 2021-05-25 17:56:09 -0700 | [diff] [blame] | 3 | # 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-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 6 | |
| 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-Noble | 553a75b | 2020-03-09 10:59:32 -0700 | [diff] [blame] | 9 | # with build_tools/cmake/clean_build.sh) |
Geoffrey Martin-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 10 | |
| 11 | set -x |
| 12 | set -e |
| 13 | |
Stella Laurenzo | 804266f | 2021-06-02 15:50:04 -0700 | [diff] [blame] | 14 | if [ -z "$BUILD_DIR" ]; then |
| 15 | BUILD_DIR="$(git rev-parse --show-toplevel)/build" |
| 16 | fi |
Geoffrey Martin-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 17 | |
| 18 | # Respect the user setting, but default to as many jobs as we have cores. |
| 19 | export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:-$(nproc)} |
| 20 | |
Scott Todd | cba0bc4 | 2022-03-16 13:03:09 -0700 | [diff] [blame] | 21 | # Respect the user setting, but default to turning on vulkan. |
Geoffrey Martin-Noble | f941efb | 2020-09-15 13:16:05 -0700 | [diff] [blame] | 22 | export IREE_VULKAN_DISABLE=${IREE_VULKAN_DISABLE:-0} |
Thomas | 35505fc | 2021-03-04 08:52:02 -0800 | [diff] [blame] | 23 | # CUDA is off by default. |
| 24 | export IREE_CUDA_DISABLE=${IREE_CUDA_DISABLE:-1} |
Thomas | 10f5eaf | 2021-03-31 10:22:20 -0700 | [diff] [blame] | 25 | # 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. |
| 27 | export IREE_VULKAN_F16_DISABLE=${IREE_VULKAN_F16_DISABLE:-1} |
Geoffrey Martin-Noble | a927976 | 2020-02-18 10:46:51 -0800 | [diff] [blame] | 28 | |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 29 | # Tests to exclude by label. In addition to any custom labels (which are carried |
phoenix-meadowlark | daaf388 | 2020-05-21 10:45:45 -0700 | [diff] [blame] | 30 | # over from Bazel tags), every test should be labeled with the directory it is |
| 31 | # in. |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 32 | declare -a label_exclude_args=( |
| 33 | # Exclude specific labels. |
| 34 | # Put the whole label with anchors for exact matches. |
| 35 | # For example: |
Geoffrey Martin-Noble | 1f2a229 | 2020-06-10 11:45:31 -0700 | [diff] [blame] | 36 | # ^nokokoro$ |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 37 | ^nokokoro$ |
| 38 | |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 39 | # Exclude all tests in a directory. |
| 40 | # Put the whole directory with anchors for exact matches. |
| 41 | # For example: |
Phoenix Meadowlark | b327096 | 2021-03-18 09:20:38 -0700 | [diff] [blame] | 42 | # ^bindings/python/iree/runtime$ |
phoenix-meadowlark | daaf388 | 2020-05-21 10:45:45 -0700 | [diff] [blame] | 43 | |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 44 | # 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-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 49 | ) |
| 50 | |
Geoffrey Martin-Noble | 1f2a229 | 2020-06-10 11:45:31 -0700 | [diff] [blame] | 51 | if [[ "${IREE_VULKAN_DISABLE?}" == 1 ]]; then |
| 52 | label_exclude_args+=("^driver=vulkan$") |
| 53 | fi |
Thomas | 35505fc | 2021-03-04 08:52:02 -0800 | [diff] [blame] | 54 | if [[ "${IREE_CUDA_DISABLE?}" == 1 ]]; then |
| 55 | label_exclude_args+=("^driver=cuda$") |
| 56 | fi |
Thomas | 10f5eaf | 2021-03-31 10:22:20 -0700 | [diff] [blame] | 57 | if [[ "${IREE_VULKAN_F16_DISABLE?}" == 1 ]]; then |
| 58 | label_exclude_args+=("^vulkan_uses_vk_khr_shader_float16_int8$") |
| 59 | fi |
Geoffrey Martin-Noble | 1f2a229 | 2020-06-10 11:45:31 -0700 | [diff] [blame] | 60 | |
Geoffrey Martin-Noble | b5b46cb | 2020-04-01 12:12:18 -0700 | [diff] [blame] | 61 | # Join on "|" |
| 62 | label_exclude_regex="($(IFS="|" ; echo "${label_exclude_args[*]?}"))" |
Geoffrey Martin-Noble | 5007a96 | 2020-02-11 10:04:08 -0800 | [diff] [blame] | 63 | |
Stella Laurenzo | 804266f | 2021-06-02 15:50:04 -0700 | [diff] [blame] | 64 | cd "$BUILD_DIR" |
Stella Laurenzo | 02cfcd1 | 2021-11-14 13:20:53 -0800 | [diff] [blame] | 65 | echo "******************** Running main project ctests ************************" |
Geoffrey Martin-Noble | aad9fd1 | 2021-08-04 16:52:54 -0700 | [diff] [blame] | 66 | ctest --timeout 900 --output-on-failure --label-exclude "${label_exclude_regex?}" |
Stella Laurenzo | 02cfcd1 | 2021-11-14 13:20:53 -0800 | [diff] [blame] | 67 | |
| 68 | echo "******************** llvm-external-projects tests ***********************" |
Geoffrey Martin-Noble | 0f80995 | 2022-02-11 12:12:07 -0800 | [diff] [blame] | 69 | cmake --build . --target check-iree-dialects -- -k 0 |