summaryrefslogtreecommitdiffstats
path: root/tests/backup/test_backup.sh
diff options
context:
space:
mode:
authorOmari Stephens <xsdg@android.com>2009-08-11 21:44:21 -0700
committerOmari Stephens <xsdg@android.com>2009-08-11 21:51:03 -0700
commit0cfeb25707c87af285cc993967be486d9c95a176 (patch)
tree61ae212b6b8c424e0b4c39d13b5f9699431a810a /tests/backup/test_backup.sh
parentc5ea43920919eeaec4ec0686de9fa3d034d82337 (diff)
downloadframeworks_base-0cfeb25707c87af285cc993967be486d9c95a176.zip
frameworks_base-0cfeb25707c87af285cc993967be486d9c95a176.tar.gz
frameworks_base-0cfeb25707c87af285cc993967be486d9c95a176.tar.bz2
The triumphant return of the shell scripts, with bugreports, less code dup, and
enhanced readability.
Diffstat (limited to 'tests/backup/test_backup.sh')
-rwxr-xr-xtests/backup/test_backup.sh33
1 files changed, 13 insertions, 20 deletions
diff --git a/tests/backup/test_backup.sh b/tests/backup/test_backup.sh
index f50d03f..10b809d 100755
--- a/tests/backup/test_backup.sh
+++ b/tests/backup/test_backup.sh
@@ -14,39 +14,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# uncomment for debugging
+#export DRY_RUN="echo"
+source test_backup_common.sh
-ADB_OPTS="$@"
+# wipe prior backup data for packages
+b_pkgs=$(a shell dumpsys backup | \
+ ruby -ne 'print($1+" ") if $_ =~ /^\s*ApplicationInfo\S+ (.+?)\}/')
-#FIXME: what was this for?
-#adb kill-server
-
-b_pkgs=$(adb $ADB_OPTS shell dumpsys backup | \
- ruby -ne 'print($1+" ") if $_ =~ /^\s*ApplicationInfo\{\S+ (.+?)\}/')
-
-# wipe prior backup data for packages, including the metadata package @pm@
-for pkg in $b_pkgs '@pm@'; do
- adb $ADB_OPTS shell bmgr wipe "$pkg"
+for pkg in $b_pkgs; do
+ a shell bmgr wipe "$pkg"
done
-# who knows?
echo 'Waiting 5 seconds for things to settle...'
sleep 5
# run adb as root so we can poke at com.android.backuptest's data
-root_status=$(adb $ADB_OPTS root)
-if [ "x$root_status" != "xadbd is already running as root" ]; then
- sleep 2
- adb $ADB_OPTS 'wait-for-device'
-fi
+adb_root
# show commands as we go
set -x
# set the transport
-adb $ADB_OPTS shell bmgr transport com.google.android.backup/.BackupTransportService
+a shell bmgr transport com.google.android.backup/.BackupTransportService
# load up the three files
-adb $ADB_OPTS shell \
+a shell \
"rm /data/data/com.android.backuptest/files/file.txt ; \
rm /data/data/com.android.backuptest/files/another_file.txt ; \
rm /data/data/com.android.backuptest/files/empty.txt ; \
@@ -63,8 +56,8 @@ adb $ADB_OPTS shell \
# echo -n 3 > /data/data/com.android.backuptest/files/3.txt ; \
# say that the data has changed
-adb $ADB_OPTS shell bmgr backup com.android.backuptest
+a shell bmgr backup com.android.backuptest
# run the backup
-adb $ADB_OPTS shell bmgr run
+a shell bmgr run