react-native/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh
Héctor Ramos 2472d915ab Consolidate CI/local test scripts
Summary:
Update `scripts/run-android-emulator.sh` to use same settings as Circle CI when creating and launching an AVD. This helps provide a known good configuration, useful for running Android tests locally.

Run `scripts/run-android-emulator.sh` and confirm AVD is created && launched
Run `scripts/run-android-emulator.sh` again and see message about AVD already running
Run `test_android` on CI and observe AVD is launched.

Run `runXcodeTests.sh` and confirm unit tests run.
Run CI and confirm iOS unit tests run.

[GENERAL][MINOR][`scripts`] - Consolidate CI/local test scripts
Closes https://github.com/facebook/react-native/pull/19228

Differential Revision: D8019888

Pulled By: hramos

fbshipit-source-id: 28b12c2e781ee80bcc90c22e691a5acb16232369
2018-05-15 17:27:52 -07:00

36 lines
1.2 KiB
Bash

#!/bin/bash
# for buck gen
mount -o remount,exec /dev/shm
AVD_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
# create virtual device
echo no | android create avd -n $AVD_UUID -f -t android-19 --abi default/armeabi-v7a
# emulator setup
emulator64-arm -avd $AVD_UUID -no-skin -no-audio -no-window -no-boot-anim &
bootanim=""
until [[ "$bootanim" =~ "stopped" ]]; do
sleep 5
bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)
echo "boot animation status=$bootanim"
done
set -x
# solve issue with max user watches limit
echo 65536 | tee -a /proc/sys/fs/inotify/max_user_watches
watchman shutdown-server
# integration tests
# build JS bundle for instrumentation tests
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# build test APK
source ./scripts/android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
# run installed apk with tests
node ./ContainerShip/scripts/run-android-ci-instrumentation-tests.js $*
exit $?