summaryrefslogtreecommitdiffstats
path: root/tests/backup/test_restore.sh
blob: 69da28cffcb3aa8bac1de8574a1559aec119a75b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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