test: support custom file names for delta tests

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2017-04-04 11:45:43 -07:00
committed by tmarcu
parent 1518aa4335
commit 04a1bdfd16
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ setup() {
track_bundle 20 included-two
track_bundle 20 included-nested
gen_file_to_delta 10 4096 20 4 test-bundle
gen_file_to_delta 10 4096 20 4 test-bundle randomfile
gen_file_plain 10 test-bundle foo
gen_file_plain 10 test-bundle foobarbaz
+3 -2
View File
@@ -72,16 +72,17 @@ gen_file_to_delta() {
local newver=$3
local newbytes=$4
local bundle=$5
local name=$6
# create some random data for the original version
mkdir -p $DIR/image/$origver/$bundle
dd if=/dev/urandom of=$DIR/image/$origver/$bundle/randomfile bs=1 count=$origsize
dd if=/dev/urandom of=$DIR/image/$origver/$bundle/$name bs=1 count=$origsize
# append more random data to the end of the file in the new version
TMP=$(mktemp foo.XXXXXX)
mkdir -p $DIR/image/$newver/$bundle
dd if=/dev/urandom of=$TMP bs=1 count=$newbytes
cat $DIR/image/$origver/$bundle/randomfile $TMP > $DIR/image/$newver/$bundle/randomfile
cat $DIR/image/$origver/$bundle/$name $TMP > $DIR/image/$newver/$bundle/$name
rm $TMP
}