react-native/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh
Nicholas Tate 8c7b32d5f1 Container Testing Updates
Summary:
ericvicenti - Here are necessary updates for the the testing container workflow.

normanjoyner

Temporarily disabled E2E tests on the Containership Jenkins pipeline because they seemed to be sporadically failing and slow down the run rate of CI tests.

* Run all stages and parallel branches in testing suite even if one
fails (just mark the overall job as failed)
* Added update to docker tag name to convert spaces to hyphens to cover
edge case where the project name may have spaces
* Updated buck to more recent version in the base image
* Remove duplicate module provider from `.flowconfig`
* Correctly exit with status code from failed instrumentation tests
* Add JSCHeaders to prepare for testing on stage branches
* Fix bug in filtering of failed instrumentation tests
* Turn down retry count to 1 for E2E tests and temporarily disable
* Add retry3 count to the apk install from buck
* Updated base image to install android SDKs through grepping since the
IDs update frequ
Closes https://github.com/facebook/react-native/pull/13032

Differential Revision: D4799015

Pulled By: ericvicenti

fbshipit-source-id: bbac9303e8ca4fe8be0e8b230a2f863c71c3366c
2017-03-29 17:56:14 -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/circle-ci-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 $?