1set -ex 2 3LOCAL_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 4ROOT_DIR=$(cd "$LOCAL_DIR"/../.. && pwd) 5TEST_DIR="$ROOT_DIR/test" 6gtest_reports_dir="${TEST_DIR}/test-reports/cpp" 7pytest_reports_dir="${TEST_DIR}/test-reports/python" 8 9# Figure out which Python to use 10PYTHON="$(which python)" 11if [[ "${BUILD_ENVIRONMENT}" =~ py((2|3)\.?[0-9]?\.?[0-9]?) ]]; then 12 PYTHON=$(which "python${BASH_REMATCH[1]}") 13fi 14 15if [[ "${BUILD_ENVIRONMENT}" == *rocm* ]]; then 16 # HIP_PLATFORM is auto-detected by hipcc; unset to avoid build errors 17 unset HIP_PLATFORM 18 if which sccache > /dev/null; then 19 # Save sccache logs to file 20 sccache --stop-server || true 21 rm -f ~/sccache_error.log || true 22 SCCACHE_ERROR_LOG=~/sccache_error.log SCCACHE_IDLE_TIMEOUT=0 sccache --start-server 23 24 # Report sccache stats for easier debugging 25 sccache --zero-stats 26 fi 27fi 28 29# /usr/local/caffe2 is where the cpp bits are installed to in cmake-only 30# builds. In +python builds the cpp tests are copied to /usr/local/caffe2 so 31# that the test code in .ci/test.sh is the same 32INSTALL_PREFIX="/usr/local/caffe2" 33 34mkdir -p "$gtest_reports_dir" || true 35mkdir -p "$pytest_reports_dir" || true 36mkdir -p "$INSTALL_PREFIX" || true 37