xref: /aosp_15_r20/external/pytorch/.circleci/scripts/binary_macos_test.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2set -eux -o pipefail
3
4source "/Users/distiller/project/env"
5export "PATH=$workdir/miniconda/bin:$PATH"
6pkg="$workdir/final_pkgs/$(ls $workdir/final_pkgs)"
7
8# Create a new test env
9# TODO cut all this out into a separate test job and have an entirely different
10# miniconda
11if [[ "$PACKAGE_TYPE" != libtorch ]]; then
12  source deactivate || true
13  conda create -qyn test python="$DESIRED_PYTHON"
14  source activate test >/dev/null
15fi
16
17# Install the package
18if [[ "$PACKAGE_TYPE" == libtorch ]]; then
19  pkg="$(ls $workdir/final_pkgs/*-latest.zip)"
20  unzip "$pkg" -d /tmp
21  cd /tmp/libtorch
22elif [[ "$PACKAGE_TYPE" == conda ]]; then
23  conda install -y "$pkg"
24else
25  pip install "$pkg" -v
26fi
27
28# Test
29if [[ "$PACKAGE_TYPE" == libtorch ]]; then
30  $workdir/builder/check_binary.sh
31else
32  pushd "$workdir/pytorch"
33  $workdir/builder/run_tests.sh "$PACKAGE_TYPE" "$DESIRED_PYTHON" "$DESIRED_CUDA"
34fi
35