Merge "goldfish: add boot test script"
diff --git a/tools/emulator_boot_test.sh b/tools/emulator_boot_test.sh
new file mode 100755
index 0000000..418f8fb
--- /dev/null
+++ b/tools/emulator_boot_test.sh
@@ -0,0 +1,56 @@
+#!/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
+
+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