|
| 1 | +summary: Integration tests for bzip2 |
| 2 | + |
| 3 | +execute: | |
| 4 | +
|
| 5 | + # testing for only bins slice |
| 6 | + rootfs_bins="$(install-slices bzip2_bins)" |
| 7 | + mkdir "${rootfs_bins}"/dev |
| 8 | + mount --rbind /dev "${rootfs_bins}"/dev |
| 9 | +
|
| 10 | + # generate a test file |
| 11 | + echo "this is a test file we use for compression with bzip2" > "${rootfs_bins}/input.txt" |
| 12 | +
|
| 13 | + # test compression commands |
| 14 | + chroot "${rootfs_bins}" /usr/bin/bzip2 -k input.txt |
| 15 | + cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bzip2 -d -c input.txt.bz2) |
| 16 | + cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bunzip2 -c input.txt.bz2) |
| 17 | + cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bzcat input.txt.bz2) |
| 18 | +
|
| 19 | + # test bzip2recover |
| 20 | + chroot "${rootfs_bins}" bzip2recover input.txt.bz2 |
| 21 | +
|
| 22 | + umount "${rootfs_bins}"/dev -l |
| 23 | +
|
| 24 | +
|
| 25 | + # testing for only scripts slice |
| 26 | + rootfs_script="$(install-slices bzip2_scripts)" |
| 27 | + mkdir "${rootfs_script}"/dev |
| 28 | + mount --rbind /dev "${rootfs_script}"/dev |
| 29 | +
|
| 30 | + # generate a test file |
| 31 | + echo "this is a test file we use for compression with bzip2" > "${rootfs_script}/input.txt" |
| 32 | + cp $SHELL "${rootfs_script}/shell" |
| 33 | + chroot "${rootfs_script}" /usr/bin/bzip2 -k input.txt |
| 34 | +
|
| 35 | + # test executable util |
| 36 | + chroot "${rootfs_script}" bzexe shell |
| 37 | + head -n1 "${rootfs_script}/shell" | grep "/bin/sh" |
| 38 | +
|
| 39 | + # test text utils |
| 40 | + chroot "${rootfs_script}" bzcmp input.txt.bz2 input.txt.bz2 | exit_code=$? |
| 41 | + chroot "${rootfs_script}" bzdiff input.txt.bz2 input.txt.bz2 | exit_code=$? |
| 42 | + chroot "${rootfs_script}" bzgrep "test" input.txt.bz2 |
| 43 | + chroot "${rootfs_script}" bzfgrep "test" input.txt.bz2 |
| 44 | + chroot "${rootfs_script}" bzegrep "test" input.txt.bz2 |
| 45 | +
|
| 46 | + # test pagers |
| 47 | + chroot "${rootfs_script}" bzless "test" input.txt.bz2 > /dev/null |
| 48 | + chroot "${rootfs_script}" bzmore "test" input.txt.bz2 > /dev/null |
| 49 | +
|
| 50 | + umount "${rootfs_script}"/dev -l |
0 commit comments