File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
tests/mkfs-tests/037-basic-compression Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Basic test for mkfs.btrfs --compress --rootdir. Create a dataset and use it
3+ # for filesystem creation with various compression levels.
4+
5+ source " $TEST_TOP /common" || exit
6+
7+ check_prereq mkfs.btrfs
8+ check_prereq btrfs
9+ check_global_prereq du
10+
11+ setup_root_helper
12+ prepare_test_dev
13+
14+ tmp=$( _mktemp_dir mkfs-rootdir)
15+ limit=$(( 128 * 1024 * 1024 ))
16+
17+ # Create dataset of approximate size 256M so the repeated compression does not take that long
18+ for file in /usr/bin/[gx]* ; do
19+ run_check cp -axf --update --no-preserve=ownership,context " $file " " $tmp "
20+ size=$( du -sb " $tmp " | awk ' {print $1}' )
21+ if [ " $size " -gt " $limit " ]; then
22+ break
23+ fi
24+ done
25+
26+ for file in /usr/lib* /lib[abcdef]* ; do
27+ run_check cp -axf --update --no-preserve=ownership,context " $file " " $tmp "
28+ size=$( du -sb " $tmp " | awk ' {print $1}' )
29+ if [ " $size " -gt " $limit " ]; then
30+ break
31+ fi
32+ done
33+
34+ run_check du -sh " $tmp "
35+
36+ run_test ()
37+ {
38+ local comp=" $1 "
39+
40+ run_check_mkfs_test_dev --rootdir " $tmp " --compress " $comp "
41+ run_check $SUDO_HELPER " $TOP /btrfs" check " $TEST_DEV "
42+
43+ run_check_mount_test_dev
44+ run_check du -sh " $TEST_MNT "
45+ run_check_umount_test_dev
46+ }
47+
48+ run_test lzo
49+ run_test zlib
50+ run_test zlib:1
51+ run_test zlib:9
52+ run_test zstd
53+ run_test zstd:1
54+ run_test zstd:15
55+
56+ run_check rm -rf -- " $tmp "
You can’t perform that action at this time.
0 commit comments