From Fedora Project Wiki

Description

Test that compression is reversible for squashfs-tools. The compression types tested will be those expected to work with the version of squashfs-tools you have installed and the kernel you are running. These tests are used to make sure squashfs-tools will work as expected for live images.

This test case should be being run as part of continuous integration testing. That currently will only will cover x86_64 and will only get checked against one kernel version. So there can be value in running this manually still.

A test script is available to provide a consistent test result. The test script needs to be run as the root user so that squashfs images can be mounted and to prevent warnings about setting selinux extended attributes when running unsquashfs. The test script will also create a directory in the current working directory named test-squashfs. When run, the script will check if test-squashfs/data is already created and if so won't recreate the test data.

Setup

  1. Install the required squashfs-tools and rpmdevtools packages:
    yum install squashfs-tools rpmdevtools

How to test

  1. Download the test script Squashfs-compression-test.sh
  2. As root, execute the test script using the command: bash Squashfs-compression-test.sh. Note any failure messages.

Expected Results

  1. The test script should exit cleanly and not abort early because it was unable to create some file or free disc space running out. There should be no messages with the string failed in them. Typically you might run this using script and then grep typescript for failed. Successful test output is included below:
    Building data directory.
    Building squashfs image using gzip compression.
    Parallel mksquashfs: Using 2 processors
    Creating 4.0 filesystem on ./test-squashfs/sq.img, block size 131072.
    [=============================================================|] 2316/2316 100%
    Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
    	compressed data, compressed metadata, compressed fragments, compressed xattrs
    	duplicates are removed
    Filesystem size 107770.89 Kbytes (105.25 Mbytes)
    	38.79% of uncompressed filesystem size (277839.40 Kbytes)
    Inode table size 2185 bytes (2.13 Kbytes)
    	11.16% of uncompressed inode table size (19586 bytes)
    Directory table size 1442 bytes (1.41 Kbytes)
    	21.57% of uncompressed directory table size (6684 bytes)
    Xattr table size 54 bytes (0.05 Kbytes)
    	100.00% of uncompressed xattr table size (54 bytes)
    Number of duplicate files found 42
    Number of inodes 189
    Number of files 188
    Number of fragments 6
    Number of symbolic links  0
    Number of device nodes 0
    Number of fifo nodes 0
    Number of socket nodes 0
    Number of directories 1
    Number of ids (unique uids + gids) 1
    Number of uids 1
    	root (0)
    Number of gids 1
    	root (0)
    Testing unmounted extract using gzip compression.
    Parallel unsquashfs: Using 2 processors
    188 inodes (2316 blocks) to write
    
    [=============================================================-] 2316/2316 100%
    created 188 files
    created 1 directories
    created 0 symlinks
    created 0 devices
    created 0 fifos
    Testing mounted image using gzip compression.
    Building squashfs image using lzo compression.
    Parallel mksquashfs: Using 2 processors
    Creating 4.0 filesystem on ./test-squashfs/sq.img, block size 131072.
    [=============================================================/] 2316/2316 100%
    Exportable Squashfs 4.0 filesystem, lzo compressed, data block size 131072
    	compressed data, compressed metadata, compressed fragments, compressed xattrs
    	duplicates are removed
    Filesystem size 107764.62 Kbytes (105.24 Mbytes)
    	38.79% of uncompressed filesystem size (277839.40 Kbytes)
    Inode table size 2553 bytes (2.49 Kbytes)
    	13.03% of uncompressed inode table size (19586 bytes)
    Directory table size 1732 bytes (1.69 Kbytes)
    	25.91% of uncompressed directory table size (6684 bytes)
    Xattr table size 54 bytes (0.05 Kbytes)
    	100.00% of uncompressed xattr table size (54 bytes)
    Number of duplicate files found 42
    Number of inodes 189
    Number of files 188
    Number of fragments 6
    Number of symbolic links  0
    Number of device nodes 0
    Number of fifo nodes 0
    Number of socket nodes 0
    Number of directories 1
    Number of ids (unique uids + gids) 1
    Number of uids 1
    	root (0)
    Number of gids 1
    	root (0)
    Testing unmounted extract using lzo compression.
    Parallel unsquashfs: Using 2 processors
    188 inodes (2316 blocks) to write
    
    [=============================================================/] 2316/2316 100%
    created 188 files
    created 1 directories
    created 0 symlinks
    created 0 devices
    created 0 fifos
    Testing mounted image using lzo compression.
    Building squashfs image using lzma compression.
    Parallel mksquashfs: Using 2 processors
    Creating 4.0 filesystem on ./test-squashfs/sq.img, block size 131072.
    [=============================================================|] 2316/2316 100%
    Exportable Squashfs 4.0 filesystem, lzma compressed, data block size 131072
    	compressed data, compressed metadata, compressed fragments, compressed xattrs
    	duplicates are removed
    Filesystem size 107750.75 Kbytes (105.23 Mbytes)
    	38.78% of uncompressed filesystem size (277839.40 Kbytes)
    Inode table size 1747 bytes (1.71 Kbytes)
    	8.92% of uncompressed inode table size (19586 bytes)
    Directory table size 1209 bytes (1.18 Kbytes)
    	18.09% of uncompressed directory table size (6684 bytes)
    Xattr table size 54 bytes (0.05 Kbytes)
    	100.00% of uncompressed xattr table size (54 bytes)
    Number of duplicate files found 42
    Number of inodes 189
    Number of files 188
    Number of fragments 6
    Number of symbolic links  0
    Number of device nodes 0
    Number of fifo nodes 0
    Number of socket nodes 0
    Number of directories 1
    Number of ids (unique uids + gids) 1
    Number of uids 1
    	root (0)
    Number of gids 1
    	root (0)
    Testing unmounted extract using lzma compression.
    Parallel unsquashfs: Using 2 processors
    188 inodes (2316 blocks) to write
    
    [=============================================================-] 2316/2316 100%
    created 188 files
    created 1 directories
    created 0 symlinks
    created 0 devices
    created 0 fifos
    Building squashfs image using xz compression.
    Parallel mksquashfs: Using 2 processors
    Creating 4.0 filesystem on ./test-squashfs/sq.img, block size 131072.
    [=============================================================/] 2316/2316 100%
    Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
    	compressed data, compressed metadata, compressed fragments, compressed xattrs
    	duplicates are removed
    Filesystem size 107751.25 Kbytes (105.23 Mbytes)
    	38.78% of uncompressed filesystem size (277839.40 Kbytes)
    Inode table size 1874 bytes (1.83 Kbytes)
    	9.57% of uncompressed inode table size (19586 bytes)
    Directory table size 1262 bytes (1.23 Kbytes)
    	18.88% of uncompressed directory table size (6684 bytes)
    Xattr table size 54 bytes (0.05 Kbytes)
    	100.00% of uncompressed xattr table size (54 bytes)
    Number of duplicate files found 42
    Number of inodes 189
    Number of files 188
    Number of fragments 6
    Number of symbolic links  0
    Number of device nodes 0
    Number of fifo nodes 0
    Number of socket nodes 0
    Number of directories 1
    Number of ids (unique uids + gids) 1
    Number of uids 1
    	root (0)
    Number of gids 1
    	root (0)
    Testing unmounted extract using xz compression.
    Parallel unsquashfs: Using 2 processors
    188 inodes (2316 blocks) to write
    
    [=============================================================/] 2316/2316 100%
    created 188 files
    created 1 directories
    created 0 symlinks
    created 0 devices
    created 0 fifos