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