Fix test_android test failure, add libpulse0 dep

Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/20377

Differential Revision: D8983760

Pulled By: hramos

fbshipit-source-id: d36cdb577b0eadc78e3274db755d05d440ae423f
This commit is contained in:
Héctor Ramos 2018-07-24 16:25:44 -07:00 committed by Facebook Github Bot
parent 70913a4623
commit dfcf9c50b6
2 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,6 @@
# inspired by https://github.com/Originate/guide/blob/master/android/guide/Continuous%20Integration.md
# shellcheck disable=SC1091
source "scripts/.tests.env"
function getAndroidPackages {
@ -8,7 +9,7 @@ function getAndroidPackages {
DEPS="$ANDROID_HOME/installed-dependencies"
# Package names can be obtained using `sdkmanager --list`
if [ ! -e $DEPS ] || [ ! $CI ]; then
if [ ! -e "$DEPS" ] || [ ! "$CI" ]; then
echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, $AVD_ABI system image..."
sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;$AVD_ABI"
echo "Installing build SDK for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
@ -22,7 +23,7 @@ function getAndroidPackages {
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_GOOGLE_API_LEVEL"
echo "Installing Android Support Repository"
sdkmanager "extras;android;m2repository"
$CI && touch $DEPS
$CI && touch "$DEPS"
fi
}
@ -31,7 +32,7 @@ function getAndroidNDK {
DEPS="$NDK_HOME/installed-dependencies"
if [ ! -e $DEPS ]; then
cd $NDK_HOME
cd $NDK_HOME || exit
echo "Downloading NDK..."
curl -o ndk.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
unzip -o -q ndk.zip
@ -44,25 +45,23 @@ function getAndroidNDK {
function createAVD {
AVD_PACKAGES="system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;$AVD_ABI"
echo "Creating AVD with packages $AVD_PACKAGES"
echo no | avdmanager create avd --name $AVD_NAME --force --package $AVD_PACKAGES --tag google_apis --abi $AVD_ABI
echo no | avdmanager create avd --name "$AVD_NAME" --force --package "$AVD_PACKAGES" --tag google_apis --abi "$AVD_ABI"
}
function launchAVD {
export PATH="$ANDROID_HOME/emulator:$PATH"
# The AVD name here should match the one created in createAVD
if [ $CI ]
if [ "$CI" ]
then
emulator -avd $AVD_NAME -no-audio -no-window
"$ANDROID_HOME/emulator/emulator" -avd "$AVD_NAME" -no-audio -no-window
else
emulator -avd $AVD_NAME
"$ANDROID_HOME/emulator/emulator" -avd "$AVD_NAME"
fi
}
function waitForAVD {
echo "Waiting for Android Virtual Device to finish booting..."
local bootanim=""
export PATH=$(dirname $(dirname $(which android)))/platform-tools:$PATH
export PATH=$(dirname $(dirname $(command -v android)))/platform-tools:$PATH
until [[ "$bootanim" =~ "stopped" ]]; do
sleep 5
bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)

View File

@ -13,7 +13,7 @@ fi
if ! [[ -d ~/vendor/apt/archives ]]; then
# It doesn't so download the packages
echo "Downloading build dependencies..."
sudo apt-get install --download-only ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev file -y
sudo apt-get install --download-only ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev libpulse0 file -y
# Then move them to our cache directory
sudo cp -R /var/cache/apt ~/vendor/
# Making sure our user has ownership, in order to cache