summaryrefslogtreecommitdiffstats
path: root/tests/backup/test_restore.sh
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-06-25 23:53:29 -0400
committerJoe Onorato <joeo@android.com>2009-06-25 23:53:29 -0400
commit4a64bded06a0299785c295a975e2818308eb53e2 (patch)
treea24057a8f82108aae7f8e6fcb5067c2ed7fe9690 /tests/backup/test_restore.sh
parent5e8a4b842c20dd47b82e9915f1bd730ee1b0d46d (diff)
downloadframeworks_base-4a64bded06a0299785c295a975e2818308eb53e2.zip
frameworks_base-4a64bded06a0299785c295a975e2818308eb53e2.tar.gz
frameworks_base-4a64bded06a0299785c295a975e2818308eb53e2.tar.bz2
Add some helpful tests scripts for backup and make bmgr restore wait until the backup is done.
Diffstat (limited to 'tests/backup/test_restore.sh')
-rwxr-xr-xtests/backup/test_restore.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/backup/test_restore.sh b/tests/backup/test_restore.sh
new file mode 100755
index 0000000..69da28c
--- /dev/null
+++ b/tests/backup/test_restore.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+function check_file
+{
+ data=$(adb shell cat /data/data/com.android.backuptest/files/$1)
+ if [ "$data" = "$2" ] ; then
+ echo "$1 has correct value [$2]"
+ else
+ echo $1 is INCORRECT
+ echo " value: [$data]"
+ echo " expected: [$2]"
+ fi
+}
+
+# delete the old data
+echo --- Previous files
+adb shell "ls -l /data/data/com.android.backuptest/files"
+adb shell "rm /data/data/com.android.backuptest/files/*"
+echo --- Erased files
+adb shell "ls -l /data/data/com.android.backuptest/files"
+echo ---
+
+echo
+echo
+echo
+
+# run the restore
+adb shell bmgr restore 0
+
+echo
+echo
+echo
+
+# check the results
+check_file file.txt "first file"
+check_file another_file.txt "asdf"
+check_file 3.txt "3"
+
+echo
+echo
+echo
+echo --- Restored files
+adb shell "ls -l /data/data/com.android.backuptest/files"
+echo ---
+echo