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