diff options
Diffstat (limited to 'test/big_syspatch_test/test.sh')
-rwxr-xr-x | test/big_syspatch_test/test.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/big_syspatch_test/test.sh b/test/big_syspatch_test/test.sh new file mode 100755 index 0000000..a78878f --- /dev/null +++ b/test/big_syspatch_test/test.sh @@ -0,0 +1,54 @@ +#! /bin/sh + +# initial cleanup +rm -f a +rm -f b +rm -f c +rm -f a_to_b.patch +rm -f a_to_b.patch.xz + +# build the files +#./make_test_data.py +dd if=/dev/urandom of=b bs=1M count=100 +dd if=/dev/full of=a bs=1M count=100 + +# build the patch +xdelta3 -0 -B 67108864 -e -s a b a_to_b.patch +/usr/bin/time -v xdelta3 -B 67108864 -d -s a a_to_b.patch c +cmp b c +if [ $? -ne 0 ]; then + echo "Couldn't verify patch" +else + echo "Built patch" +fi +rm c + +# compress it and verify the compressed patch +xz -zk --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 -f a_to_b.patch +rm -f a_to_b.patch.orig + +# run the test +cp a c +$ANDROID_BUILD_TOP/out/host/linux-x86/bin/syspatch a a_to_b.patch.xz c +cmp c b +if [ $? -ne 0 ]; then + echo "Different file test failed" +fi +/usr/bin/time -v $ANDROID_BUILD_TOP/out/host/linux-x86/bin/syspatch a a_to_b.patch.xz a +cmp a b +if [ $? -ne 0 ]; then + echo "Same file test failed" +fi + +# cleanup +rm -f a +rm -f b +rm -f c +rm -f a_to_b.patch.xz |