1*7594170eSAndroid Build Coastguard Worker#!/usr/bin/env bash 2*7594170eSAndroid Build Coastguard Worker 3*7594170eSAndroid Build Coastguard Worker# Copyright (C) 2023 The Android Open Source Project 4*7594170eSAndroid Build Coastguard Worker# 5*7594170eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 6*7594170eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 7*7594170eSAndroid Build Coastguard Worker# You may obtain a copy of the License at 8*7594170eSAndroid Build Coastguard Worker# 9*7594170eSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 10*7594170eSAndroid Build Coastguard Worker# 11*7594170eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 12*7594170eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 13*7594170eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*7594170eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 15*7594170eSAndroid Build Coastguard Worker# limitations under the License. 16*7594170eSAndroid Build Coastguard Worker 17*7594170eSAndroid Build Coastguard Worker# A script to test the end-to-end flow of atest on the Android CI. 18*7594170eSAndroid Build Coastguard Worker 19*7594170eSAndroid Build Coastguard Workerset -euo pipefail 20*7594170eSAndroid Build Coastguard Workerset -x 21*7594170eSAndroid Build Coastguard Worker 22*7594170eSAndroid Build Coastguard Workerfunction get_build_var() 23*7594170eSAndroid Build Coastguard Worker{ 24*7594170eSAndroid Build Coastguard Worker (${PWD}/build/soong/soong_ui.bash --dumpvar-mode --abs $1) 25*7594170eSAndroid Build Coastguard Worker} 26*7594170eSAndroid Build Coastguard Worker 27*7594170eSAndroid Build Coastguard Workerif [ ! -n "${ANDROID_BUILD_TOP}" ] ; then 28*7594170eSAndroid Build Coastguard Worker export ANDROID_BUILD_TOP=${PWD} 29*7594170eSAndroid Build Coastguard Workerfi 30*7594170eSAndroid Build Coastguard Worker 31*7594170eSAndroid Build Coastguard Workerif [ ! -n "${TARGET_PRODUCT}" ] || [ ! -n "${TARGET_BUILD_VARIANT}" ] ; then 32*7594170eSAndroid Build Coastguard Worker export \ 33*7594170eSAndroid Build Coastguard Worker TARGET_PRODUCT=aosp_x86_64 \ 34*7594170eSAndroid Build Coastguard Worker TARGET_BUILD_VARIANT=userdebug 35*7594170eSAndroid Build Coastguard Workerfi 36*7594170eSAndroid Build Coastguard Worker 37*7594170eSAndroid Build Coastguard Workerout=$(get_build_var PRODUCT_OUT) 38*7594170eSAndroid Build Coastguard Worker 39*7594170eSAndroid Build Coastguard Worker# ANDROID_BUILD_TOP is deprecated, so don't use it throughout the script. 40*7594170eSAndroid Build Coastguard Worker# But if someone sets it, we'll respect it. 41*7594170eSAndroid Build Coastguard Workercd ${ANDROID_BUILD_TOP:-.} 42*7594170eSAndroid Build Coastguard Worker 43*7594170eSAndroid Build Coastguard Worker# Use the versioned Python binaries in prebuilts/ for a reproducible 44*7594170eSAndroid Build Coastguard Worker# build with minimal reliance on host tools. 45*7594170eSAndroid Build Coastguard Workerexport PATH=${PWD}/prebuilts/build-tools/path/linux-x86:${PATH} 46*7594170eSAndroid Build Coastguard Worker 47*7594170eSAndroid Build Coastguard Workerexport \ 48*7594170eSAndroid Build Coastguard Worker ANDROID_PRODUCT_OUT=${out} \ 49*7594170eSAndroid Build Coastguard Worker OUT=${out} \ 50*7594170eSAndroid Build Coastguard Worker ANDROID_HOST_OUT=$(get_build_var HOST_OUT) \ 51*7594170eSAndroid Build Coastguard Worker ANDROID_TARGET_OUT_TESTCASES=$(get_build_var TARGET_OUT_TESTCASES) 52*7594170eSAndroid Build Coastguard Worker 53*7594170eSAndroid Build Coastguard Workerbuild/soong/soong_ui.bash --make-mode atest --skip-soong-tests 54*7594170eSAndroid Build Coastguard Worker 55*7594170eSAndroid Build Coastguard Worker${OUT_DIR}/host/linux-x86/bin/atest-dev --host atest_unittests 56