mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 10:22:15 -05:00
a0ee0b1561
.gitignore: added files created by new targets. build.xml: removed targets install and reinstall. modified target help to depend on android_rules.help and only explain targets defined here. updated target javadoc. added targets lint-xml, lint-html, and monkey. added private target -pre-clean to remove files created by new targets. tests/AndroidManifest.xml: updated note on running the tests. tests/ant.properties: removed test.runner as target test is now overridden. tests/build.xml: removed target test-report as it is now integrated with overridden target test. overrode target test to disable deleting coverage.em and use the new test runner. overrode target help to depend on android_rules.help and only explain targets defined here. added targets javadoc, lint-xml, lint-html, and artifacts. added private target -pre-clean to remove files created by new targets. tests/clean-tests.sh: new sh script to run through all the tests.
60 lines
2.0 KiB
Bash
Executable File
60 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# clean and run all the tests on an emulator -- only one emulator should be running (a device can be attached).
|
|
# will start and stop an emulator if no emulator is running.
|
|
# name of emulator is given as an argument (no spaces in the name!), or "api7" if not given.
|
|
# starting the emulator requires daemonize which requires a Unix-like system: http://software.clapper.org/daemonize/
|
|
|
|
# clean
|
|
ant all clean || exit 99
|
|
|
|
# see if emulator is running, and uninstall package if so
|
|
EMULATOR_ALREADY_RUNNING=false
|
|
if adb devices | grep emulator | grep device$; then
|
|
ant -Dadb.device.arg=-e uninstall || exit 98
|
|
EMULATOR_ALREADY_RUNNING=true
|
|
fi
|
|
|
|
# build project and test project
|
|
time ant emma debug artifacts || exit 1
|
|
|
|
# start emulator if not running, and uninstall package
|
|
if [ $EMULATOR_ALREADY_RUNNING == false ] ; then
|
|
if [ -z $1 ]; then
|
|
AVD_NAME=api7
|
|
else
|
|
AVD_NAME=$1
|
|
fi
|
|
|
|
echo starting emulator ${AVD_NAME}
|
|
daemonize -o /tmp/${AVD_NAME}.stdout -e /tmp/${AVD_NAME}.stderr -p /tmp/${AVD_NAME}.pid -l /tmp/${AVD_NAME}.lock \
|
|
$ANDROID_HOME/tools/emulator-arm -avd ${AVD_NAME} -no-audio -no-window -no-snapshot-save || exit 97
|
|
ps ux | grep -f /tmp/${AVD_NAME}.pid | grep emulator || exit 96
|
|
adb kill-server
|
|
time adb start-server
|
|
adb devices
|
|
#sleep 7
|
|
adb devices | grep emulator || exit 95
|
|
echo adb -e wait-for-device
|
|
time adb -e wait-for-device
|
|
adb devices | grep device$ || exit 94
|
|
ant -Dadb.device.arg=-e uninstall || exit 98
|
|
fi
|
|
|
|
# install project and test project, run tests
|
|
time ant -Dadb.device.arg=-e emma installd test || exit 2
|
|
|
|
# lint, javadoc, monkey
|
|
cd ..
|
|
time ant lint-xml || exit 3
|
|
time ant javadoc || exit 4
|
|
time ant -Dmonkey.count=200 -Dmonkey.seed=0 monkey || exit 5
|
|
|
|
# kill emulator if this script started it
|
|
if [ $EMULATOR_ALREADY_RUNNING == false ] ; then
|
|
adb emu kill || exit 93
|
|
sleep 1
|
|
! ps ux | grep -f /tmp/${AVD_NAME}.pid | grep emulator || exit 92
|
|
rm -f /tmp/${AVD_NAME}.stdout /tmp/${AVD_NAME}.stderr /tmp/${AVD_NAME}.pid /tmp/${AVD_NAME}.lock
|
|
fi
|