diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 04:59:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 04:59:34 +0000 |
commit | 6187d406bede6461086d6e5263f42ae4826675c4 (patch) | |
tree | 32a35120c4385929cfd5a7b9c584b9dd8396b108 /tests/m_rootpaxtar | |
parent | Releasing progress-linux version 1.47.0-2.4~progress7.99u1. (diff) | |
download | e2fsprogs-6187d406bede6461086d6e5263f42ae4826675c4.tar.xz e2fsprogs-6187d406bede6461086d6e5263f42ae4826675c4.zip |
Merging upstream version 1.47.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/m_rootpaxtar/expect | 87 | ||||
-rw-r--r-- | tests/m_rootpaxtar/mkpaxtar.pl | 69 | ||||
-rw-r--r-- | tests/m_rootpaxtar/output.sed | 5 | ||||
-rw-r--r-- | tests/m_rootpaxtar/script | 44 |
4 files changed, 205 insertions, 0 deletions
diff --git a/tests/m_rootpaxtar/expect b/tests/m_rootpaxtar/expect new file mode 100644 index 0000000..844d987 --- /dev/null +++ b/tests/m_rootpaxtar/expect @@ -0,0 +1,87 @@ +Filesystem volume name: <none> +Last mounted on: <not available> +Filesystem magic number: 0xEF53 +Filesystem revision #: 1 (dynamic) +Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file dir_nlink extra_isize metadata_csum +Default mount options: (none) +Filesystem state: clean +Errors behavior: Continue +Filesystem OS type: Linux +Inode count: 1024 +Block count: 16384 +Reserved block count: 819 +Overhead clusters: 1543 +Free blocks: 14827 +Free inodes: 1012 +First block: 1 +Block size: 1024 +Fragment size: 1024 +Group descriptor size: 64 +Reserved GDT blocks: 127 +Blocks per group: 8192 +Fragments per group: 8192 +Inodes per group: 512 +Inode blocks per group: 128 +Flex block group size: 16 +Mount count: 0 +Check interval: 15552000 (6 months) +Reserved blocks uid: 0 +Reserved blocks gid: 0 +First inode: 11 +Inode size: 256 +Required extra isize: 32 +Desired extra isize: 32 +Journal inode: 8 +Default directory hash: half_md4 +Journal backup: inode blocks +Checksum type: crc32c +Journal features: (none) +Total journal size: 1024k +Total journal blocks: 1024 +Max transaction length: 1024 +Fast commit length: 0 +Journal sequence: 0x00000001 +Journal start: 0 + + +Group 0: (Blocks 1-8192) + Primary superblock at 1, Group descriptors at 2-2 + Reserved GDT blocks at 3-129 + Block bitmap at 130 (+129) + Inode bitmap at 132 (+131) + Inode table at 134-261 (+133) + 7789 free blocks, 500 free inodes, 2 directories, 500 unused inodes + Free blocks: 404-8192 + Free inodes: 13-512 +Group 1: (Blocks 8193-16383) [INODE_UNINIT] + Backup superblock at 8193, Group descriptors at 8194-8194 + Reserved GDT blocks at 8195-8321 + Block bitmap at 131 (bg #0 + 130) + Inode bitmap at 133 (bg #0 + 132) + Inode table at 262-389 (bg #0 + 261) + 7038 free blocks, 512 free inodes, 0 directories, 512 unused inodes + Free blocks: 9346-16383 + Free inodes: 513-1024 +debugfs: stat /file +Inode: III Type: regular +Generation: 0 Version: 0x00000000:00000000 +Size: 0 +File ACL: 0 +Links: 1 Blockcount: 0 +Fragment: Address: 0 Number: 0 Size: 0 + ctime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 + atime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 + mtime: 0x00000000:00000000 -- Thu Jan 1 00:00:00 1970 +Size of extra inode fields: 32 +Extended attributes: + security.capability (20) = 01 00 00 02 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +EXTENTS: +debugfs: ea_list /file +Extended attributes: + security.capability (20) = 01 00 00 02 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test.img: 12/1024 files (0.0% non-contiguous), 1557/16384 blocks diff --git a/tests/m_rootpaxtar/mkpaxtar.pl b/tests/m_rootpaxtar/mkpaxtar.pl new file mode 100644 index 0000000..f335344 --- /dev/null +++ b/tests/m_rootpaxtar/mkpaxtar.pl @@ -0,0 +1,69 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my @entries = ( + # filename mode type content + ['./PaxHeaders/file', oct(644), 'x', "57 SCHILY.xattr.security.capability=\x01\0\0\x02\0\x20\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x0a"], + ['file', oct(644), 0, ''], +); + +my $num_entries = 0; + +foreach my $file (@entries) { + my ($fname, $mode, $type, $content) = @{$file}; + my $entry = pack( + 'a100 a8 a8 a8 a12 a12 A8 a1 a100 a6 a2 a32 a32 a8 a8 a155 x12', + $fname, + sprintf('%07o', $mode), + sprintf('%07o', 0), # uid + sprintf('%07o', 0), # gid + sprintf('%011o', length $content), # size + sprintf('%011o', 0), # mtime + '', # checksum + $type, + '', # linkname + "ustar", # magic + "00", # version + '', # username + '', # groupname + '', # dev major + '', # dev minor + '', # prefix + ); + + # compute and insert checksum + substr($entry, 148, 7) + = sprintf("%06o\0", unpack("%16C*", $entry)); + print $entry; + $num_entries += 1; + + if (length $content) { + print(pack 'a512', $content); + $num_entries += 1; + } +} + +# https://www.gnu.org/software/tar/manual/html_node/Standard.html +# +# Physically, an archive consists of a series of file entries terminated by an +# end-of-archive entry, which consists of two 512 blocks of zero bytes. At the +# end of the archive file there are two 512-byte blocks filled with binary +# zeros as an end-of-file marker. + +print(pack 'a512', ''); +print(pack 'a512', ''); +$num_entries += 2; + +# https://www.gnu.org/software/tar/manual/html_section/tar_76.html +# +# Some devices requires that all write operations be a multiple of a certain +# size, and so, tar pads the archive out to the next record boundary. +# +# The default blocking factor is 20. With a block size of 512 bytes, we get a +# record size of 10240. + +for (my $i = $num_entries ; $i < 20 ; $i++) { + print(pack 'a512', ''); +} diff --git a/tests/m_rootpaxtar/output.sed b/tests/m_rootpaxtar/output.sed new file mode 100644 index 0000000..2e76967 --- /dev/null +++ b/tests/m_rootpaxtar/output.sed @@ -0,0 +1,5 @@ +s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*-[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/X \1\/\2 \3\/\4 \5-\6 AAA-BBB \7/g +s/^[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)\/[[:space:]]*\([0-9]*\)[[:space:]]*\([0-9]*\)[[:space:]]*-[[:space:]]*\([0-9]*\)[[:space:]]*[0-9]*[[:space:]]*\([0-9]*\)/Y \1\/\2 \3\/\4 \5-\6 AAA \7/g +s/Mode:.*$//g +s/User:.*Size:/Size:/g +s/^Inode: [0-9]*/Inode: III/g diff --git a/tests/m_rootpaxtar/script b/tests/m_rootpaxtar/script new file mode 100644 index 0000000..41dc7c3 --- /dev/null +++ b/tests/m_rootpaxtar/script @@ -0,0 +1,44 @@ +# vim: filetype=sh + +test_description="create fs image from pax tarball with xattrs" +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi +if [ "$(grep -c 'define HAVE_ARCHIVE_H' ../lib/config.h)" -eq 0 ]; then + echo "$test_name: skipped (no libarchive)" + exit 0 +fi + +OUT=$test_name.log +EXP=$test_dir/expect + +perl $test_dir/mkpaxtar.pl \ + | $MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,64bit -E lazy_itable_init=1 -b 1024 -d - $TMPFILE 16384 > $OUT 2>&1 + +$DUMPE2FS $TMPFILE >> $OUT 2>&1 +cat > $TMPFILE.cmd << ENDL +stat /file +ea_list /file +ENDL +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep -v '^(crtime|Inode checksum):' >> $OUT + +$FSCK -f -n $TMPFILE >> $OUT 2>&1 + +sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp +mv $OUT.tmp $OUT + +# Do the verification +cmp -s $OUT $EXP +status=$? + +if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "$test_name: $test_description: failed" + diff $DIFF_OPTS $EXP $OUT > $test_name.failed +fi + +rm -rf $TMPFILE.cmd +unset OUT EXP |