| 
 | 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 | +BUILD_TOOL=$1  | 
 | 10 | +if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then  | 
 | 11 | +    echo "Running unittests for ${BUILD_TOOL} ..."  | 
 | 12 | +else  | 
 | 13 | +  echo "Missing build tool (require buck2 or cmake), exiting..."  | 
 | 14 | +  exit 1  | 
 | 15 | +fi  | 
 | 16 | + | 
 | 17 | +BUILD_MODE=$2  | 
 | 18 | +if [[ $BUILD_MODE =~ ^(Debug|Release)$ ]]; then  | 
 | 19 | +    echo "Running tests in build mode ${BUILD_MODE} ..."  | 
 | 20 | +else  | 
 | 21 | +    echo "Unsupported build mode ${BUILD_MODE}, options are Debug or Release."  | 
 | 22 | +    exit 1  | 
 | 23 | +fi  | 
 | 24 | + | 
 | 25 | +bash .ci/scripts/setup-conda.sh  | 
 | 26 | +eval "$(conda shell.bash hook)"  | 
 | 27 | + | 
 | 28 | +# Create temp directory for sccache shims  | 
 | 29 | +export TMP_DIR=$(mktemp -d)  | 
 | 30 | +export PATH="${TMP_DIR}:$PATH"  | 
 | 31 | +trap 'rm -rfv ${TMP_DIR}' EXIT  | 
 | 32 | + | 
 | 33 | +# Setup MacOS dependencies as there is no Docker support on MacOS atm  | 
 | 34 | +PYTHON_EXECUTABLE=python \  | 
 | 35 | +EXECUTORCH_BUILD_PYBIND=ON \  | 
 | 36 | +CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \  | 
 | 37 | +${CONDA_RUN} --no-capture-output \  | 
 | 38 | +.ci/scripts/setup-macos.sh "${BUILD_TOOL}" "${BUILD_MODE}"  | 
 | 39 | + | 
 | 40 | +# Install llama3_2_vision dependencies.  | 
 | 41 | +PYTHON_EXECUTABLE=python \  | 
 | 42 | +${CONDA_RUN} --no-capture-output \  | 
 | 43 | +./examples/models/llama3_2_vision/install_requirements.sh  | 
 | 44 | + | 
 | 45 | +if [[ "$BUILD_TOOL" == "cmake" ]]; then  | 
 | 46 | +    .ci/scripts/unittest-macos-cmake.sh  | 
 | 47 | +elif [[ "$BUILD_TOOL" == "buck2" ]]; then  | 
 | 48 | +    .ci/scripts/unittest-buck2.sh  | 
 | 49 | +else  | 
 | 50 | +    echo "Unknown build tool $BUILD_TOOL"  | 
 | 51 | +    exit 1  | 
 | 52 | +fi  | 
0 commit comments