1#!/bin/bash
2
3#disable for now, as it is still not well tested
4#set -e
5
6echo "starting boot test at "
7date
8uname -a
9
10echo $TARGET_PRODUCT
11
12time_out="600"
13op_no_accel=""
14unamestr=`uname`
15if [[ "$unamestr" == 'Linux' ]]; then
16    export PATH=prebuilts/android-emulator/linux-x86_64:$PATH
17    op_no_accel="-no-accel"
18    if [[ -e '/dev/kvm' ]]; then
19        echo "Has /dev/kvm"
20        if [[ -r '/dev/kvm' ]]; then
21            echo "KVM readable"
22            if [[ -w '/dev/kvm' ]]; then
23                echo "KVM writable, enable acceleration"
24                op_no_accel=""
25            fi
26        else
27            echo "KVM not readable"
28        fi
29    else
30        echo "does not have KVM"
31    fi
32elif [[ "$unamestr" == 'Darwin' ]]; then
33    export PATH=prebuilts/android-emulator/darwin-x86_64:$PATH
34else
35    echo "Cannot determine OS type, quit"
36    exit 1
37fi
38
39if [[ $op_no_accel != "" ]]; then
40echo "disable smp since there is no acceleration"
41echo hw.cpu.ncore=1 >> $ANDROID_PRODUCT_OUT/config.ini
42fi
43
44echo $ANDROID_PRODUCT_OUT
45
46which emulator
47emulator -version
48emulator -accel-check
49
50{
51    sleep 600
52    echo "kill emulator after 10 minutes"
53    pkill -9 qemu-system
54} &
55
56emulator -gpu swiftshader_indirect -no-window -show-kernel -verbose -quit-after-boot $time_out \
57             -wipe-data -no-snapshot $op_no_accel -skin 480x800x32 -logcat *:I -no-boot-anim
58
59echo "ending boot test at "
60date
61echo "done"
62exit 0
63