From 04a1bdfd1682c016d1c85b049e328d7865a5f6cd Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Mon, 3 Apr 2017 14:25:38 -0700 Subject: [PATCH] test: support custom file names for delta tests Signed-off-by: Patrick McCarty --- test/functional/full-run-delta/test.bats | 2 +- test/functional/swupdlib.bash | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/functional/full-run-delta/test.bats b/test/functional/full-run-delta/test.bats index ecc5caa..eb20fb5 100755 --- a/test/functional/full-run-delta/test.bats +++ b/test/functional/full-run-delta/test.bats @@ -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 diff --git a/test/functional/swupdlib.bash b/test/functional/swupdlib.bash index 1289ec4..5193104 100644 --- a/test/functional/swupdlib.bash +++ b/test/functional/swupdlib.bash @@ -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 }