Commit c89b34ce authored by james.wei@intel.com's avatar james.wei@intel.com

as we will use sdcard to store test data, so add sd card when creating avd.

And when testing with emulator, sometimes the test broken due to push failed because /sdcard/ is not ready. 

Adding WaitForSdCardReady to make the test more reliable. 

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10702162

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146311 0039d316-1c4b-4281-b951-d872f2087c98
parent f59b0879
......@@ -319,6 +319,23 @@ class AndroidCommands(object):
if out.strip() != 'remount succeeded':
raise errors.MsgException('Remount failed: %s' % out)
def WaitForSdCardReady(self, timeout_time):
"""Wait for the SD card ready before pushing data into it."""
logging.info('Waiting for SD card ready...')
sdcard_ready = False
attempts = 0
wait_period = 5
while not sdcard_ready and attempts * wait_period < timeout_time:
output = self.RunShellCommand('ls /sdcard/')
if len(output) > 0:
sdcard_ready = True
else:
time.sleep(wait_period)
attempts += 1
if not sdcard_ready:
raise errors.WaitForResponseTimedOutError(
'SD card not ready after %s seconds' % timeout_time)
# It is tempting to turn this function into a generator, however this is not
# possible without using a private (local) adb_shell instance (to ensure no
# other command interleaves usage of it), which would defeat the main aim of
......
......@@ -248,6 +248,8 @@ class SingleTestRunner(BaseTestRunner):
if test_data and not self.fast_and_loose:
# Due to the large size of certain test data, we use sdcard to store the
# test data and create symbolic links to map them to data/local/tmp/.
# Before that, make sure SD card is ready.
self.adb.WaitForSdCardReady(20)
for data in test_data:
self.CopyTestData([data], '/sdcard/')
self.LinkSdCardPathsToTempDir(test_data)
......
......@@ -126,10 +126,10 @@ fi
# check whether current AVD has correct configuration and it takes almost no
# time to create a new one. Create one ARM AVD and one x86 AVD.
"${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name avd_armeabi \
--abi armeabi-v7a --target ${SDK_TARGET_ID} --force <<< "no"
--abi armeabi-v7a --target ${SDK_TARGET_ID} -c 64M --force <<< "no"
"${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name avd_x86 \
--abi x86 --target ${SDK_TARGET_ID} --force <<< "no"
--abi x86 --target ${SDK_TARGET_ID} -c 64M --force <<< "no"
# Install Android NDK if it doesn't exist.
if [[ ! -d "${ANDROID_NDK_ROOT}" ]]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment