summaryrefslogtreecommitdiff
path: root/test/simple_syspatch_test/test.sh
blob: 8b55eb61b7ce19571d5fe026a68a4414d3a6022e (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
46
#! /bin/sh

# preemptive cleanup
rm a
rm b
rm a_to_b.patch
rm a_to_b.patch.orig
rm a_to_b.patch.xz

# setup the files
echo "hello world" > a
echo "Hello, world" > b

# make and verify the patch
xdelta3 -e -s a b a_to_b.patch
xdelta3 -d -s a a_to_b.patch c
cmp b c
if [ $? -ne 0 ]; then
	echo "Couldn't verify patch"
fi
rm c

# compress it and verify the compressed patch
xz -zk -9 --check=crc32 a_to_b.patch
mv a_to_b.patch a_to_b.patch.orig
xz -dk a_to_b.patch.xz
cmp a_to_b.patch a_to_b.patch.orig
if [ $? -ne 0 ]; then
	echo "Couldn't verify compression"
fi
rm a_to_b.patch
rm a_to_b.patch.orig

# run the test
$ANDROID_BUILD_TOP/out/host/linux-x86/bin/syspatch_host a a_to_b.patch.xz a
cmp a b
if [ $? -ne 0 ]; then
	echo "Test failed"
fi

# cleanup
rm a
rm b
rm a_to_b.patch
rm a_to_b.patch.orig
rm a_to_b.patch.xz