|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# This source code is licensed under the BSD-style license found in the |
| 6 | +# LICENSE file in the root directory of this source tree. |
| 7 | +set -eux |
| 8 | + |
| 9 | +SUITE=$1 |
| 10 | +FLOW=$2 |
| 11 | +ARTIFACT_DIR=$3 |
| 12 | + |
| 13 | +REPORT_FILE="$ARTIFACT_DIR/test-report-$FLOW-$SUITE.csv" |
| 14 | + |
| 15 | +echo "Running backend test job for suite $SUITE, flow $FLOW." |
| 16 | +echo "Saving job artifacts to $ARTIFACT_DIR." |
| 17 | + |
| 18 | +# The generic Linux job chooses to use base env, not the one setup by the image |
| 19 | +eval "$(conda shell.bash hook)" |
| 20 | +CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") |
| 21 | +conda activate "${CONDA_ENV}" |
| 22 | + |
| 23 | +export PYTHON_EXECUTABLE=python |
| 24 | + |
| 25 | +# CMake options to use, in addition to the defaults. |
| 26 | +EXTRA_BUILD_ARGS="" |
| 27 | + |
| 28 | +if [[ "$FLOW" == *qnn* ]]; then |
| 29 | + # Setup QNN sdk and deps - note that this is a bit hacky due to the nature of the |
| 30 | + # Qualcomm build. TODO (gjcomer) Clean this up once the QNN pybinding integration is |
| 31 | + # cleaned up. |
| 32 | + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake |
| 33 | + PYTHON_EXECUTABLE=python source .ci/scripts/build-qnn-sdk.sh |
| 34 | + QNN_X86_LIB_DIR=`realpath build-x86/lib/` |
| 35 | + export LD_LIBRARY_PATH"=$QNN_X86_LIB_DIR:$QNN_SDK_ROOT/lib/x86_64-linux-clang/:${LD_LIBRARY_PATH:-}" |
| 36 | + |
| 37 | + # TODO Get SDK root from install scripts |
| 38 | + EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_QNN=ON -DQNN_SDK_ROOT=$QNN_SDK_ROOT" |
| 39 | +fi |
| 40 | + |
| 41 | +if [[ "$FLOW" == *vulkan* ]]; then |
| 42 | + # Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate. |
| 43 | + source .ci/scripts/setup-vulkan-linux-deps.sh |
| 44 | + |
| 45 | + EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_VULKAN=ON" |
| 46 | +fi |
| 47 | + |
| 48 | +if [[ "$FLOW" == *arm* ]]; then |
| 49 | + # Setup ARM deps. |
| 50 | + .ci/scripts/setup-arm-baremetal-tools.sh |
| 51 | +fi |
| 52 | + |
| 53 | +# We need the runner to test the built library. |
| 54 | +PYTHON_EXECUTABLE=python CMAKE_ARGS="$EXTRA_BUILD_ARGS" .ci/scripts/setup-linux.sh --build-tool cmake --build-mode Release --editable true |
| 55 | + |
| 56 | +EXIT_CODE=0 |
| 57 | +python -m executorch.backends.test.suite.runner $SUITE --flow $FLOW --report "$REPORT_FILE" || EXIT_CODE=$? |
| 58 | + |
| 59 | +# Generate markdown summary. |
| 60 | +python -m executorch.backends.test.suite.generate_markdown_summary "$REPORT_FILE" > ${GITHUB_STEP_SUMMARY:-"step_summary.md"} --exit-code $EXIT_CODE |
0 commit comments