diff options
Diffstat (limited to 't-func/deb-split.at')
-rw-r--r-- | t-func/deb-split.at | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/t-func/deb-split.at b/t-func/deb-split.at new file mode 100644 index 0000000..33f9e60 --- /dev/null +++ b/t-func/deb-split.at @@ -0,0 +1,116 @@ +AT_TESTED([dpkg-split]) + +AT_SETUP([dpkg-split options]) +AT_KEYWORDS([dpkg-split command-line]) +AT_CHECK([dpkg-split --help], [], [ignore]) +AT_CLEANUP + +AT_SETUP([dpkg-split .deb format]) +AT_KEYWORDS([dpkg-split deb-split]) + +DPKG_GEN_CONTROL([pkg-split]) +DPKG_MOD_CONTROL([pkg-split], + [s/^Description:.*$/& - normal package to be split/]) +AT_CHECK([ +# Initialize the template package +chmod -R u+w pkg-split +# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes' +# does check print error conditions, so we ignore its error message here. +yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=2048 status=none +find pkg-split | xargs touch -t 197001010100.00 +dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null +]) + +AT_CHECK([ +# Test splitting a package (in 10 parts: 9 * 210 KiB B + 158 KiB) +dpkg-split -S 210 -s pkg-split.deb pkg-split-part +for p in $(seq 10); do + test -f pkg-split-part.${p}of10.deb +done +], [], [Splitting package pkg-split into 10 parts: 1 2 3 4 5 6 7 8 9 10 done +]) + +DEB_SPLIT_MD5SUM=0a4dfee0e57e273cd260ece947ce6bde +DEB_SPLIT_LENGTH=2109632 +DEB_SPLIT_PART_LENGTH=214016 +DEB_SPLIT_PART_SIZE=214222 +DEB_SPLIT_LAST_LENGTH=183488 +DEB_SPLIT_LAST_SIZE=183694 + +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.1of10.deb +], [], [pkg-split-part.1of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 1/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 0 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.2of10.deb +], [], [pkg-split-part.2of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 2/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 214016 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.9of10.deb +], [], [pkg-split-part.9of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 9/10 + Part length: $DEB_SPLIT_PART_LENGTH bytes + Part offset: 1712128 bytes + Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes + +]) +AT_CHECK_UNQUOTED([ +# Test getting information about the split parts (parsing verification) +dpkg-split -I pkg-split-part.10of10.deb +], [], [pkg-split-part.10of10.deb: + Part format version: 2.1 + Part of package: pkg-split + ... version: 0.0-1 + ... architecture: all + ... MD5 checksum: $DEB_SPLIT_MD5SUM + ... length: $DEB_SPLIT_LENGTH bytes + ... split every: $DEB_SPLIT_PART_LENGTH bytes + Part number: 10/10 + Part length: $DEB_SPLIT_LAST_LENGTH bytes + Part offset: 1926144 bytes + Part file size (used portion): $DEB_SPLIT_LAST_SIZE bytes + +]) + +AT_CHECK([ +# Test joining the split parts back together +dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb +cmp pkg-split.deb pkg-joined.deb +], [], [Putting package pkg-split together from 10 parts: 1 2 3 4 5 6 7 8 9 10 done +]) + +AT_CLEANUP |