summaryrefslogtreecommitdiffstats
path: root/core/tests/overlaytests
diff options
context:
space:
mode:
authorMÃ¥rten Kongstad <marten.kongstad@sonyericsson.com>2012-02-08 10:30:50 +0100
committerZoran Jovanovic <zoran.jovanovic@sonyericsson.com>2012-02-16 16:52:11 +0100
commit2c7ea732a6dd22bcf72b08bc8f272d95fbee60fb (patch)
tree5c61932c5a01ef9c600c49038c18a5b2b7ab0512 /core/tests/overlaytests
parent249e3ed5400e5c7ab2e9aa8017f612d79d2e8089 (diff)
downloadframeworks_base-2c7ea732a6dd22bcf72b08bc8f272d95fbee60fb.zip
frameworks_base-2c7ea732a6dd22bcf72b08bc8f272d95fbee60fb.tar.gz
frameworks_base-2c7ea732a6dd22bcf72b08bc8f272d95fbee60fb.tar.bz2
Improve robustness of resource overlay test suite.
Test runner will now create directory /vendor/overlay/framework, if missing. Also, move wallpaper from drawable to drawable-nodpi for it to actually take effect on ICS code. Change-Id: I7615345e847c5fca91aedc459f6aa3316a45aab5
Diffstat (limited to 'core/tests/overlaytests')
-rw-r--r--core/tests/overlaytests/OverlayTestOverlay/res/drawable-nodpi/default_wallpaper.jpg (renamed from core/tests/overlaytests/OverlayTestOverlay/res/drawable/default_wallpaper.jpg)bin399 -> 399 bytes
-rwxr-xr-xcore/tests/overlaytests/runtests.sh44
2 files changed, 42 insertions, 2 deletions
diff --git a/core/tests/overlaytests/OverlayTestOverlay/res/drawable/default_wallpaper.jpg b/core/tests/overlaytests/OverlayTestOverlay/res/drawable-nodpi/default_wallpaper.jpg
index 0d944d0..0d944d0 100644
--- a/core/tests/overlaytests/OverlayTestOverlay/res/drawable/default_wallpaper.jpg
+++ b/core/tests/overlaytests/OverlayTestOverlay/res/drawable-nodpi/default_wallpaper.jpg
Binary files differ
diff --git a/core/tests/overlaytests/runtests.sh b/core/tests/overlaytests/runtests.sh
index 0ad9efb..0a721ad40 100755
--- a/core/tests/overlaytests/runtests.sh
+++ b/core/tests/overlaytests/runtests.sh
@@ -18,7 +18,6 @@ function atexit()
log=$(mktemp)
trap "atexit" EXIT
-failures=0
function compile_module()
{
@@ -38,6 +37,37 @@ function wait_for_boot_completed()
$adb wait-for-device logcat | grep -m 1 -e 'PowerManagerService.*bootCompleted' >/dev/null
}
+function mkdir_if_needed()
+{
+ local path="$1"
+
+ if [[ "${path:0:1}" != "/" ]]; then
+ echo "mkdir_if_needed: error: path '$path' does not begin with /" | tee -a $log
+ exit 1
+ fi
+
+ local basename=$(basename "$path")
+ local dirname=$(dirname "$path")
+ local t=$($adb shell ls -l $dirname | tr -d '\r' | grep -e "${basename}$" | grep -oe '^.')
+
+ case "$t" in
+ d) # File exists, and is a directory ...
+ # do nothing
+ ;;
+ l) # ... (or symbolic link possibly to a directory).
+ # do nothing
+ ;;
+ "") # File does not exist.
+ mkdir_if_needed "$dirname"
+ $adb shell mkdir "$path"
+ ;;
+ *) # File exists, but is not a directory.
+ echo "mkdir_if_needed: file '$path' exists, but is not a directory" | tee -a $log
+ exit 1
+ ;;
+ esac
+}
+
function disable_overlay()
{
echo "Disabling overlay"
@@ -48,6 +78,8 @@ function disable_overlay()
function enable_overlay()
{
echo "Enabling overlay"
+ mkdir_if_needed "/system/vendor"
+ mkdir_if_needed "/vendor/overlay/framework"
$adb shell ln -s /data/app/com.android.overlaytest.overlay.apk /vendor/overlay/framework/framework-res.apk
}
@@ -59,13 +91,21 @@ function instrument()
$adb shell am instrument -w -e class $class com.android.overlaytest/android.test.InstrumentationTestRunner | tee -a $log
}
+function remount()
+{
+ echo "Remounting file system writable"
+ $adb remount | tee -a $log
+}
+
function sync()
{
echo "Syncing to device"
- $adb remount | tee -a $log
$adb sync data | tee -a $log
}
+# some commands require write access, remount once and for all
+remount
+
# build and sync
compile_module "$PWD/OverlayTest/Android.mk"
compile_module "$PWD/OverlayTestOverlay/Android.mk"