diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:29:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:29:32 -0800 |
commit | 2068259fff846977bdd4262fa27ea6cb81d35a78 (patch) | |
tree | d4c35114dd30b1fbf3e91f785f63023f97438147 /test-gen.lib | |
parent | ee88353f0c125cdc2ee7a56187fde3a10e4ff918 (diff) | |
download | genext2fs-2068259fff846977bdd4262fa27ea6cb81d35a78.tar.gz |
auto import from //depot/cupcake/@135843android-sdk-tools_r2android-sdk-1.6_r2android-sdk-1.6_r1android-sdk-1.6-docs_r1android-sdk-1.5_r3android-sdk-1.5_r1android-sdk-1.5-preandroid-1.6_r2android-1.6_r1.5android-1.6_r1.4android-1.6_r1.3android-1.6_r1.2android-1.6_r1.1android-1.6_r1android-1.5r4android-1.5r3android-1.5r2android-1.5donut-release2donut-releasedonutcupcake-releasecupcake
Diffstat (limited to 'test-gen.lib')
-rw-r--r-- | test-gen.lib | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test-gen.lib b/test-gen.lib new file mode 100644 index 0000000..c6e73b9 --- /dev/null +++ b/test-gen.lib @@ -0,0 +1,56 @@ +#!/bin/sh + +# These routines contain the filesystem generation code. +# This code is sourced by the other scripts so that digest +# generation is consistent. + +# dgen - Exercises the -d directory option of genext2fs +# Creates an image with a file of given size +# Usage: dgen file-size number-of-blocks +dgen () { + size=$1; blocks=$2 + rm -rf test + mkdir -p test + cd test + if [ x$size = x0 ]; then + > file.$1 + else + dd if=/dev/zero of=file.$1 bs=$size count=1 2>/dev/null + fi + chmod 777 file.$1 + TZ=UTC-11 touch -t 200502070321.43 file.$1 . + cd .. + ./genext2fs -N 17 -b $blocks -d test -f -q ext2.img +} + +# fgen - Exercises the -f spec-file option of genext2fs +# Creates an image with the devices mentioned in the given spec file +# Usage: fgen spec-file number-of-blocks +fgen () { + fname=$1; blocks=$2; + mkdir -p test + cp $fname test + TZ=UTC-11 touch -t 200502070321.43 test/$fname + ./genext2fs -N 92 -b $blocks -D test/$fname -f ext2.img +} + +# gen_cleanup - Remove the files generated by the above functions +# Usage: gen_cleanup +gen_cleanup () { + rm -rf ext2.img test +} + +# calc_digest - Return the MD5 digest of the test image +# Usage: calc_digest +calc_digest () { + digest=`md5sum ext2.img 2>/dev/null | cut -f 1 -d " "` + if [ x$digest != x ] ; then + echo $digest + else + digest=`md5 ext2.img 2>/dev/null | cut -f 4 -d " "` + echo $digest + fi +} + +LC_ALL=C +export LC_ALL |