summaryrefslogtreecommitdiff
path: root/tests/ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ts')
-rwxr-xr-xtests/ts/bitops/swapbytes27
-rw-r--r--tests/ts/blkid/images-fs/adaptec-raid.img.bz2bin0 -> 256 bytes
-rw-r--r--tests/ts/blkid/images-fs/befs.img.bz2bin0 -> 36236 bytes
-rw-r--r--tests/ts/blkid/images-fs/bfs.img.bz2bin0 -> 133 bytes
-rw-r--r--tests/ts/blkid/images-fs/cramfs.img.bz2bin0 -> 124 bytes
-rw-r--r--tests/ts/blkid/images-fs/ddf-raid.img.bz2bin0 -> 599 bytes
-rw-r--r--tests/ts/blkid/images-fs/exfat.img.bz2bin0 -> 6301 bytes
-rw-r--r--tests/ts/blkid/images-fs/ext2.img.bz2bin0 -> 356 bytes
-rw-r--r--tests/ts/blkid/images-fs/ext3.img.bz2bin0 -> 1489 bytes
-rw-r--r--tests/ts/blkid/images-fs/fat.img.bz2bin0 -> 249 bytes
-rw-r--r--tests/ts/blkid/images-fs/fat16_noheads.img.bz2bin0 -> 336 bytes
-rw-r--r--tests/ts/blkid/images-fs/fat32_label_64MB.img.bz2bin0 -> 1151 bytes
-rw-r--r--tests/ts/blkid/images-fs/gfs2.img.bz2bin0 -> 130 bytes
-rw-r--r--tests/ts/blkid/images-fs/hfs.img.bz2bin0 -> 257 bytes
-rw-r--r--tests/ts/blkid/images-fs/hfsplus.img.bz2bin0 -> 300 bytes
-rw-r--r--tests/ts/blkid/images-fs/hpfs.img.bz2bin0 -> 2454 bytes
-rw-r--r--tests/ts/blkid/images-fs/hpt37x-raid.img.bz2bin0 -> 123 bytes
-rw-r--r--tests/ts/blkid/images-fs/hpt45x-raid.img.bz2bin0 -> 151 bytes
-rw-r--r--tests/ts/blkid/images-fs/iso-joliet.img.bz2bin0 -> 21050 bytes
-rw-r--r--tests/ts/blkid/images-fs/iso-rr-joliet.img.bz2bin0 -> 21380 bytes
-rw-r--r--tests/ts/blkid/images-fs/iso.img.bz2bin0 -> 20718 bytes
-rw-r--r--tests/ts/blkid/images-fs/isw-raid.img.bz2bin0 -> 251 bytes
-rw-r--r--tests/ts/blkid/images-fs/jbd.img.bz2bin0 -> 214 bytes
-rw-r--r--tests/ts/blkid/images-fs/jfs.img.bz2bin0 -> 3434 bytes
-rw-r--r--tests/ts/blkid/images-fs/jmicron-raid.img.bz2bin0 -> 159 bytes
-rw-r--r--tests/ts/blkid/images-fs/lsi-raid.img.bz2bin0 -> 146 bytes
-rw-r--r--tests/ts/blkid/images-fs/lvm2.img.bz2bin0 -> 177 bytes
-rw-r--r--tests/ts/blkid/images-fs/mdraid.img.bz2bin0 -> 160 bytes
-rw-r--r--tests/ts/blkid/images-fs/minix.img.bz2bin0 -> 138 bytes
-rw-r--r--tests/ts/blkid/images-fs/netware.img.bz2bin0 -> 239 bytes
-rw-r--r--tests/ts/blkid/images-fs/nilfs2.img.bz2bin0 -> 795 bytes
-rw-r--r--tests/ts/blkid/images-fs/ntfs.img.bz2bin0 -> 35942 bytes
-rw-r--r--tests/ts/blkid/images-fs/nvidia-raid.img.bz2bin0 -> 175 bytes
-rw-r--r--tests/ts/blkid/images-fs/ocfs2.img.bz2bin0 -> 1070 bytes
-rw-r--r--tests/ts/blkid/images-fs/promise-raid.img.bz2bin0 -> 784 bytes
-rw-r--r--tests/ts/blkid/images-fs/reiser3.img.bz2bin0 -> 282 bytes
-rw-r--r--tests/ts/blkid/images-fs/reiser4.img.bz2bin0 -> 372 bytes
-rw-r--r--tests/ts/blkid/images-fs/romfs.img.bz2bin0 -> 115 bytes
-rw-r--r--tests/ts/blkid/images-fs/silicon-raid.img.bz2bin0 -> 328 bytes
-rw-r--r--tests/ts/blkid/images-fs/small-fat32.img.bz2bin0 -> 372 bytes
-rw-r--r--tests/ts/blkid/images-fs/swap0.img.bz2bin0 -> 75 bytes
-rw-r--r--tests/ts/blkid/images-fs/swap1.img.bz2bin0 -> 121 bytes
-rw-r--r--tests/ts/blkid/images-fs/tuxonice.img.bz2bin0 -> 36891 bytes
-rw-r--r--tests/ts/blkid/images-fs/ubifs.img.bz2bin0 -> 937 bytes
-rw-r--r--tests/ts/blkid/images-fs/udf.img.bz2bin0 -> 2031 bytes
-rw-r--r--tests/ts/blkid/images-fs/ufs.img.bz2bin0 -> 1318 bytes
-rw-r--r--tests/ts/blkid/images-fs/via-raid.img.bz2bin0 -> 99 bytes
-rw-r--r--tests/ts/blkid/images-fs/vmfs.img.bz2bin0 -> 144 bytes
-rw-r--r--tests/ts/blkid/images-fs/vmfs_volume.img.bz2bin0 -> 287 bytes
-rw-r--r--tests/ts/blkid/images-fs/xfs.img.bz2bin0 -> 443 bytes
-rw-r--r--tests/ts/blkid/images-fs/zfs.img.bz2bin0 -> 10912 bytes
-rw-r--r--tests/ts/blkid/images-pt/bsd.img.bz2bin0 -> 122 bytes
-rw-r--r--tests/ts/blkid/images-pt/dos+bsd.img.bz2bin0 -> 1728 bytes
-rw-r--r--tests/ts/blkid/images-pt/gpt.img.bz2bin0 -> 494 bytes
-rw-r--r--tests/ts/blkid/images-pt/sgi.img.bz2bin0 -> 144 bytes
-rw-r--r--tests/ts/blkid/images-pt/sun.img.bz2bin0 -> 170 bytes
-rwxr-xr-xtests/ts/blkid/low-probe46
-rwxr-xr-xtests/ts/blkid/lowprobe-pt45
-rwxr-xr-xtests/ts/blkid/md-raid0-whole85
-rwxr-xr-xtests/ts/blkid/md-raid1-part91
-rwxr-xr-xtests/ts/blkid/md-raid1-whole85
-rwxr-xr-xtests/ts/build-sys/config70
-rwxr-xr-xtests/ts/cal/1m59
-rwxr-xr-xtests/ts/cal/3m58
-rwxr-xr-xtests/ts/cal/year58
-rwxr-xr-xtests/ts/col/multibyte27
-rw-r--r--tests/ts/col/multibyte.data1
-rwxr-xr-xtests/ts/colrm/rm2-226
-rwxr-xr-xtests/ts/column/fillrow29
-rw-r--r--tests/ts/column/input10
-rwxr-xr-xtests/ts/column/multi-file32
-rwxr-xr-xtests/ts/column/separator_table29
-rw-r--r--tests/ts/cramfs/cramfs-big.imgbin0 -> 4096 bytes
-rw-r--r--tests/ts/cramfs/cramfs-little.imgbin0 -> 4096 bytes
-rwxr-xr-xtests/ts/cramfs/doubles51
-rwxr-xr-xtests/ts/cramfs/fsck-endianness57
-rwxr-xr-xtests/ts/cramfs/mkfs95
-rwxr-xr-xtests/ts/cramfs/mkfs-endianness53
-rwxr-xr-xtests/ts/eject/umount111
-rwxr-xr-xtests/ts/fdisk/align-512-4K87
-rwxr-xr-xtests/ts/fdisk/align-512-4K-6387
-rwxr-xr-xtests/ts/fdisk/align-512-4K-md99
-rwxr-xr-xtests/ts/fdisk/align-512-51270
-rwxr-xr-xtests/ts/fdisk/align-512-512-topology87
-rwxr-xr-xtests/ts/fdisk/id37
-rwxr-xr-xtests/ts/fdisk/mbr-dos-mode135
-rwxr-xr-xtests/ts/fdisk/mbr-nondos-mode137
-rwxr-xr-xtests/ts/fdisk/oddinput40
-rwxr-xr-xtests/ts/fdisk/sunlabel74
-rwxr-xr-xtests/ts/fsck/ismounted45
-rwxr-xr-xtests/ts/hwclock/systohc58
-rw-r--r--tests/ts/ipcs/functions.sh83
-rwxr-xr-xtests/ts/ipcs/headers58
-rwxr-xr-xtests/ts/ipcs/limits51
-rwxr-xr-xtests/ts/ipcs/limits231
-rwxr-xr-xtests/ts/libmount/context133
-rwxr-xr-xtests/ts/libmount/context-utab125
-rw-r--r--tests/ts/libmount/files/fstab14
-rw-r--r--tests/ts/libmount/files/fstab.broken14
-rw-r--r--tests/ts/libmount/files/mountinfo32
-rw-r--r--tests/ts/libmount/files/mountinfo_mv32
-rw-r--r--tests/ts/libmount/files/mountinfo_re32
-rw-r--r--tests/ts/libmount/files/mountinfo_u31
-rw-r--r--tests/ts/libmount/files/mtab11
-rwxr-xr-xtests/ts/libmount/lock39
-rwxr-xr-xtests/ts/libmount/optstr95
-rwxr-xr-xtests/ts/libmount/tabdiff31
-rwxr-xr-xtests/ts/libmount/tabfiles65
-rwxr-xr-xtests/ts/libmount/tabfiles-tags95
-rwxr-xr-xtests/ts/libmount/update96
-rwxr-xr-xtests/ts/libmount/utils79
-rwxr-xr-xtests/ts/login/islocal27
-rw-r--r--tests/ts/login/islocal.data10
-rwxr-xr-xtests/ts/login/logindefs24
-rw-r--r--tests/ts/login/logindefs.data16
-rwxr-xr-xtests/ts/look/separator39
-rw-r--r--tests/ts/look/words3
-rw-r--r--tests/ts/lscpu/dumps/i386-amdshanghai.tar.gzbin0 -> 3395 bytes
-rw-r--r--tests/ts/lscpu/dumps/i386-dellpe700.tar.gzbin0 -> 799 bytes
-rw-r--r--tests/ts/lscpu/dumps/i386-intels5000phb.tar.gzbin0 -> 2865 bytes
-rw-r--r--tests/ts/lscpu/dumps/ia64-512cpus.tar.gzbin0 -> 67254 bytes
-rw-r--r--tests/ts/lscpu/dumps/ia64-hpmatterhorn.tar.gzbin0 -> 3514 bytes
-rw-r--r--tests/ts/lscpu/dumps/ia64-hprx1620.tar.gzbin0 -> 1384 bytes
-rw-r--r--tests/ts/lscpu/dumps/ia64-pg0.tar.gzbin0 -> 7784 bytes
-rw-r--r--tests/ts/lscpu/dumps/ppc64-POWER7.tar.gzbin0 -> 14350 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-kvm.tar.gzbin0 -> 2275 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-lpar.tar.gzbin0 -> 6611 bytes
-rw-r--r--tests/ts/lscpu/dumps/s390-zvm.tar.gzbin0 -> 2582 bytes
-rw-r--r--tests/ts/lscpu/dumps/sparc64-UltraSparc-T1.tar.gzbin0 -> 23071 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-64cpu.tar.gzbin0 -> 153140 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gzbin0 -> 12933 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gzbin0 -> 1492 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gzbin0 -> 14095 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-dellr710.tar.gzbin0 -> 14300 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-el5xen.tar.gzbin0 -> 7296 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-hpdl585.tar.gzbin0 -> 6910 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-ibme326m.tar.gzbin0 -> 1461 bytes
-rw-r--r--tests/ts/lscpu/dumps/x86_64-necem14.tar.gzbin0 -> 1307 bytes
-rwxr-xr-xtests/ts/lscpu/lscpu50
-rw-r--r--tests/ts/lscpu/mk-input.sh43
-rw-r--r--tests/ts/md5/data7
-rwxr-xr-xtests/ts/md5/md531
-rwxr-xr-xtests/ts/minix/fsck39
-rwxr-xr-xtests/ts/minix/mkfs47
-rwxr-xr-xtests/ts/misc/strtosize60
-rwxr-xr-xtests/ts/mount/devname53
-rwxr-xr-xtests/ts/mount/encryption64
-rwxr-xr-xtests/ts/mount/fstab-broken62
-rwxr-xr-xtests/ts/mount/fstab-devname53
-rwxr-xr-xtests/ts/mount/fstab-devname2label49
-rwxr-xr-xtests/ts/mount/fstab-devname2uuid49
-rwxr-xr-xtests/ts/mount/fstab-label60
-rwxr-xr-xtests/ts/mount/fstab-label2devname55
-rwxr-xr-xtests/ts/mount/fstab-label2uuid60
-rwxr-xr-xtests/ts/mount/fstab-none30
-rwxr-xr-xtests/ts/mount/fstab-symlink68
-rwxr-xr-xtests/ts/mount/fstab-uuid60
-rwxr-xr-xtests/ts/mount/fstab-uuid2devname55
-rwxr-xr-xtests/ts/mount/fstab-uuid2label59
-rwxr-xr-xtests/ts/mount/label53
-rwxr-xr-xtests/ts/mount/move53
-rwxr-xr-xtests/ts/mount/noncanonical37
-rwxr-xr-xtests/ts/mount/paths31
-rwxr-xr-xtests/ts/mount/regfile37
-rwxr-xr-xtests/ts/mount/remount52
-rwxr-xr-xtests/ts/mount/rlimit78
-rwxr-xr-xtests/ts/mount/shared-subtree58
-rwxr-xr-xtests/ts/mount/special40
-rwxr-xr-xtests/ts/mount/uuid52
-rwxr-xr-xtests/ts/namei/logic34
-rwxr-xr-xtests/ts/partx/partx45
-rwxr-xr-xtests/ts/paths/built-in27
-rwxr-xr-xtests/ts/schedutils/cpuset57
-rwxr-xr-xtests/ts/script/race36
-rwxr-xr-xtests/ts/swapon/devname44
-rwxr-xr-xtests/ts/swapon/fixpgsz44
-rwxr-xr-xtests/ts/swapon/fixsig46
-rwxr-xr-xtests/ts/swapon/label46
-rwxr-xr-xtests/ts/swapon/uuid46
179 files changed, 5337 insertions, 0 deletions
diff --git a/tests/ts/bitops/swapbytes b/tests/ts/bitops/swapbytes
new file mode 100755
index 0000000..62e380c
--- /dev/null
+++ b/tests/ts/bitops/swapbytes
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="swap bytes"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+$TS_HELPER_BYTESWAP >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/blkid/images-fs/adaptec-raid.img.bz2 b/tests/ts/blkid/images-fs/adaptec-raid.img.bz2
new file mode 100644
index 0000000..d3c10d7
--- /dev/null
+++ b/tests/ts/blkid/images-fs/adaptec-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/befs.img.bz2 b/tests/ts/blkid/images-fs/befs.img.bz2
new file mode 100644
index 0000000..f4deaec
--- /dev/null
+++ b/tests/ts/blkid/images-fs/befs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/bfs.img.bz2 b/tests/ts/blkid/images-fs/bfs.img.bz2
new file mode 100644
index 0000000..54df48f
--- /dev/null
+++ b/tests/ts/blkid/images-fs/bfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/cramfs.img.bz2 b/tests/ts/blkid/images-fs/cramfs.img.bz2
new file mode 100644
index 0000000..d638116
--- /dev/null
+++ b/tests/ts/blkid/images-fs/cramfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ddf-raid.img.bz2 b/tests/ts/blkid/images-fs/ddf-raid.img.bz2
new file mode 100644
index 0000000..b093493
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ddf-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/exfat.img.bz2 b/tests/ts/blkid/images-fs/exfat.img.bz2
new file mode 100644
index 0000000..f96c3f0
--- /dev/null
+++ b/tests/ts/blkid/images-fs/exfat.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ext2.img.bz2 b/tests/ts/blkid/images-fs/ext2.img.bz2
new file mode 100644
index 0000000..d1811ce
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ext2.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ext3.img.bz2 b/tests/ts/blkid/images-fs/ext3.img.bz2
new file mode 100644
index 0000000..5394598
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ext3.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/fat.img.bz2 b/tests/ts/blkid/images-fs/fat.img.bz2
new file mode 100644
index 0000000..1fa7f2d
--- /dev/null
+++ b/tests/ts/blkid/images-fs/fat.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/fat16_noheads.img.bz2 b/tests/ts/blkid/images-fs/fat16_noheads.img.bz2
new file mode 100644
index 0000000..4d3d26c
--- /dev/null
+++ b/tests/ts/blkid/images-fs/fat16_noheads.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/fat32_label_64MB.img.bz2 b/tests/ts/blkid/images-fs/fat32_label_64MB.img.bz2
new file mode 100644
index 0000000..ca76293
--- /dev/null
+++ b/tests/ts/blkid/images-fs/fat32_label_64MB.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/gfs2.img.bz2 b/tests/ts/blkid/images-fs/gfs2.img.bz2
new file mode 100644
index 0000000..bab2f90
--- /dev/null
+++ b/tests/ts/blkid/images-fs/gfs2.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/hfs.img.bz2 b/tests/ts/blkid/images-fs/hfs.img.bz2
new file mode 100644
index 0000000..d4fc1ab
--- /dev/null
+++ b/tests/ts/blkid/images-fs/hfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/hfsplus.img.bz2 b/tests/ts/blkid/images-fs/hfsplus.img.bz2
new file mode 100644
index 0000000..b6ad1b9
--- /dev/null
+++ b/tests/ts/blkid/images-fs/hfsplus.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/hpfs.img.bz2 b/tests/ts/blkid/images-fs/hpfs.img.bz2
new file mode 100644
index 0000000..a54e6df
--- /dev/null
+++ b/tests/ts/blkid/images-fs/hpfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/hpt37x-raid.img.bz2 b/tests/ts/blkid/images-fs/hpt37x-raid.img.bz2
new file mode 100644
index 0000000..52e13bb
--- /dev/null
+++ b/tests/ts/blkid/images-fs/hpt37x-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/hpt45x-raid.img.bz2 b/tests/ts/blkid/images-fs/hpt45x-raid.img.bz2
new file mode 100644
index 0000000..1feaa5b
--- /dev/null
+++ b/tests/ts/blkid/images-fs/hpt45x-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/iso-joliet.img.bz2 b/tests/ts/blkid/images-fs/iso-joliet.img.bz2
new file mode 100644
index 0000000..4e43c0b
--- /dev/null
+++ b/tests/ts/blkid/images-fs/iso-joliet.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/iso-rr-joliet.img.bz2 b/tests/ts/blkid/images-fs/iso-rr-joliet.img.bz2
new file mode 100644
index 0000000..97e8b76
--- /dev/null
+++ b/tests/ts/blkid/images-fs/iso-rr-joliet.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/iso.img.bz2 b/tests/ts/blkid/images-fs/iso.img.bz2
new file mode 100644
index 0000000..4389847
--- /dev/null
+++ b/tests/ts/blkid/images-fs/iso.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/isw-raid.img.bz2 b/tests/ts/blkid/images-fs/isw-raid.img.bz2
new file mode 100644
index 0000000..9214c96
--- /dev/null
+++ b/tests/ts/blkid/images-fs/isw-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/jbd.img.bz2 b/tests/ts/blkid/images-fs/jbd.img.bz2
new file mode 100644
index 0000000..e6c4fc4
--- /dev/null
+++ b/tests/ts/blkid/images-fs/jbd.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/jfs.img.bz2 b/tests/ts/blkid/images-fs/jfs.img.bz2
new file mode 100644
index 0000000..1d4d249
--- /dev/null
+++ b/tests/ts/blkid/images-fs/jfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/jmicron-raid.img.bz2 b/tests/ts/blkid/images-fs/jmicron-raid.img.bz2
new file mode 100644
index 0000000..3b4b236
--- /dev/null
+++ b/tests/ts/blkid/images-fs/jmicron-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/lsi-raid.img.bz2 b/tests/ts/blkid/images-fs/lsi-raid.img.bz2
new file mode 100644
index 0000000..ffd75c3
--- /dev/null
+++ b/tests/ts/blkid/images-fs/lsi-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/lvm2.img.bz2 b/tests/ts/blkid/images-fs/lvm2.img.bz2
new file mode 100644
index 0000000..7bb84bf
--- /dev/null
+++ b/tests/ts/blkid/images-fs/lvm2.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/mdraid.img.bz2 b/tests/ts/blkid/images-fs/mdraid.img.bz2
new file mode 100644
index 0000000..d5a67a3
--- /dev/null
+++ b/tests/ts/blkid/images-fs/mdraid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/minix.img.bz2 b/tests/ts/blkid/images-fs/minix.img.bz2
new file mode 100644
index 0000000..d11f3a8
--- /dev/null
+++ b/tests/ts/blkid/images-fs/minix.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/netware.img.bz2 b/tests/ts/blkid/images-fs/netware.img.bz2
new file mode 100644
index 0000000..9c20673
--- /dev/null
+++ b/tests/ts/blkid/images-fs/netware.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/nilfs2.img.bz2 b/tests/ts/blkid/images-fs/nilfs2.img.bz2
new file mode 100644
index 0000000..a9762eb
--- /dev/null
+++ b/tests/ts/blkid/images-fs/nilfs2.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ntfs.img.bz2 b/tests/ts/blkid/images-fs/ntfs.img.bz2
new file mode 100644
index 0000000..dc1249f
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ntfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/nvidia-raid.img.bz2 b/tests/ts/blkid/images-fs/nvidia-raid.img.bz2
new file mode 100644
index 0000000..21f062e
--- /dev/null
+++ b/tests/ts/blkid/images-fs/nvidia-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ocfs2.img.bz2 b/tests/ts/blkid/images-fs/ocfs2.img.bz2
new file mode 100644
index 0000000..7e203da
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ocfs2.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/promise-raid.img.bz2 b/tests/ts/blkid/images-fs/promise-raid.img.bz2
new file mode 100644
index 0000000..64a5a08
--- /dev/null
+++ b/tests/ts/blkid/images-fs/promise-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/reiser3.img.bz2 b/tests/ts/blkid/images-fs/reiser3.img.bz2
new file mode 100644
index 0000000..1802bc2
--- /dev/null
+++ b/tests/ts/blkid/images-fs/reiser3.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/reiser4.img.bz2 b/tests/ts/blkid/images-fs/reiser4.img.bz2
new file mode 100644
index 0000000..d07571e
--- /dev/null
+++ b/tests/ts/blkid/images-fs/reiser4.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/romfs.img.bz2 b/tests/ts/blkid/images-fs/romfs.img.bz2
new file mode 100644
index 0000000..f94d77b
--- /dev/null
+++ b/tests/ts/blkid/images-fs/romfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/silicon-raid.img.bz2 b/tests/ts/blkid/images-fs/silicon-raid.img.bz2
new file mode 100644
index 0000000..e3ccbf9
--- /dev/null
+++ b/tests/ts/blkid/images-fs/silicon-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/small-fat32.img.bz2 b/tests/ts/blkid/images-fs/small-fat32.img.bz2
new file mode 100644
index 0000000..8b90f9c
--- /dev/null
+++ b/tests/ts/blkid/images-fs/small-fat32.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/swap0.img.bz2 b/tests/ts/blkid/images-fs/swap0.img.bz2
new file mode 100644
index 0000000..d027b6f
--- /dev/null
+++ b/tests/ts/blkid/images-fs/swap0.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/swap1.img.bz2 b/tests/ts/blkid/images-fs/swap1.img.bz2
new file mode 100644
index 0000000..37adedd
--- /dev/null
+++ b/tests/ts/blkid/images-fs/swap1.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/tuxonice.img.bz2 b/tests/ts/blkid/images-fs/tuxonice.img.bz2
new file mode 100644
index 0000000..a70c95a
--- /dev/null
+++ b/tests/ts/blkid/images-fs/tuxonice.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ubifs.img.bz2 b/tests/ts/blkid/images-fs/ubifs.img.bz2
new file mode 100644
index 0000000..efba8f7
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ubifs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/udf.img.bz2 b/tests/ts/blkid/images-fs/udf.img.bz2
new file mode 100644
index 0000000..bd2deb0
--- /dev/null
+++ b/tests/ts/blkid/images-fs/udf.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/ufs.img.bz2 b/tests/ts/blkid/images-fs/ufs.img.bz2
new file mode 100644
index 0000000..67abbed
--- /dev/null
+++ b/tests/ts/blkid/images-fs/ufs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/via-raid.img.bz2 b/tests/ts/blkid/images-fs/via-raid.img.bz2
new file mode 100644
index 0000000..9266f5e
--- /dev/null
+++ b/tests/ts/blkid/images-fs/via-raid.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/vmfs.img.bz2 b/tests/ts/blkid/images-fs/vmfs.img.bz2
new file mode 100644
index 0000000..0940143
--- /dev/null
+++ b/tests/ts/blkid/images-fs/vmfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/vmfs_volume.img.bz2 b/tests/ts/blkid/images-fs/vmfs_volume.img.bz2
new file mode 100644
index 0000000..cc0ec66
--- /dev/null
+++ b/tests/ts/blkid/images-fs/vmfs_volume.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/xfs.img.bz2 b/tests/ts/blkid/images-fs/xfs.img.bz2
new file mode 100644
index 0000000..cf6982b
--- /dev/null
+++ b/tests/ts/blkid/images-fs/xfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-fs/zfs.img.bz2 b/tests/ts/blkid/images-fs/zfs.img.bz2
new file mode 100644
index 0000000..dfaaef0
--- /dev/null
+++ b/tests/ts/blkid/images-fs/zfs.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-pt/bsd.img.bz2 b/tests/ts/blkid/images-pt/bsd.img.bz2
new file mode 100644
index 0000000..c4b05e4
--- /dev/null
+++ b/tests/ts/blkid/images-pt/bsd.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-pt/dos+bsd.img.bz2 b/tests/ts/blkid/images-pt/dos+bsd.img.bz2
new file mode 100644
index 0000000..cccdd8a
--- /dev/null
+++ b/tests/ts/blkid/images-pt/dos+bsd.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-pt/gpt.img.bz2 b/tests/ts/blkid/images-pt/gpt.img.bz2
new file mode 100644
index 0000000..df4de7c
--- /dev/null
+++ b/tests/ts/blkid/images-pt/gpt.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-pt/sgi.img.bz2 b/tests/ts/blkid/images-pt/sgi.img.bz2
new file mode 100644
index 0000000..3b1c313
--- /dev/null
+++ b/tests/ts/blkid/images-pt/sgi.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/images-pt/sun.img.bz2 b/tests/ts/blkid/images-pt/sun.img.bz2
new file mode 100644
index 0000000..adf4f02
--- /dev/null
+++ b/tests/ts/blkid/images-pt/sun.img.bz2
Binary files differ
diff --git a/tests/ts/blkid/low-probe b/tests/ts/blkid/low-probe
new file mode 100755
index 0000000..9dc1a17
--- /dev/null
+++ b/tests/ts/blkid/low-probe
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="low-level superblocks probing"
+
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+if [ ! -x "$TS_CMD_BLKID" ]; then
+ ts_skip "blkid disabled"
+fi
+
+mkdir -p $TS_OUTDIR/images-fs
+
+for img in $(ls $TS_SELF/images-fs/*.img.bz2 | sort); do
+ name=$(basename $img .img.bz2)
+ outimg=$TS_OUTDIR/images-fs/${name}.img
+
+ ts_init_subtest $name
+
+ bunzip2 < $img > $outimg
+
+ #/lib/udev/vol_id $outimg | egrep -v '[[:alnum:]_]*=$' | sort > $TS_OUTPUT 2>&1
+ $TS_CMD_BLKID -p -o udev $outimg 2>&1 | sort > $TS_OUTPUT
+ ts_finalize_subtest
+done
+
+ts_finalize
+
diff --git a/tests/ts/blkid/lowprobe-pt b/tests/ts/blkid/lowprobe-pt
new file mode 100755
index 0000000..b88dd60
--- /dev/null
+++ b/tests/ts/blkid/lowprobe-pt
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="partitions probing"
+
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+if [ ! -x "$TS_HELPER_PARTITIONS" ]; then
+ ts_skip "blkid disabled"
+fi
+
+mkdir -p $TS_OUTDIR/images-pt
+
+for img in $(ls $TS_SELF/images-pt/*.img.bz2 | sort); do
+ name=$(basename $img .img.bz2)
+ outimg=$TS_OUTDIR/images-pt/${name}.img
+
+ ts_init_subtest $name
+
+ bunzip2 < $img > $outimg
+
+ $TS_HELPER_PARTITIONS $outimg &> $TS_OUTPUT
+ ts_finalize_subtest
+done
+
+ts_finalize
+
diff --git a/tests/ts/blkid/md-raid0-whole b/tests/ts/blkid/md-raid0-whole
new file mode 100755
index 0000000..7a55c54
--- /dev/null
+++ b/tests/ts/blkid/md-raid0-whole
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MD raid0 (whole-disks)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
+
+set -o pipefail
+
+ts_log "Initialize devices"
+IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
+
+DEVICE1=$(ts_device_init 50 ${IMGNAME}1.img)
+[ "$?" == 0 ] || ts_die "Cannot init device1"
+
+DEVICE2=$(ts_device_init 50 ${IMGNAME}2.img)
+[ "$?" == 0 ] || ts_die "Cannot init device2" $DEVICE1
+
+MD_DEVNAME=md8
+MD_DEVICE=/dev/${MD_DEVNAME}
+
+/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
+
+ts_log "Create RAID device"
+/sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 --level=0 \
+ --raid-devices=2 ${DEVICE1} ${DEVICE2} >> $TS_OUTPUT 2>&1
+
+ts_log "Create partitions on RAID device"
+$TS_CMD_FDISK ${MD_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
+
+p
+w
+q
+EOF
+
+sleep 3
+
+ts_log "Probe first RAID member"
+$TS_CMD_BLKID -p -o udev $DEVICE1 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Probe second RAID member"
+$TS_CMD_BLKID -p -o udev $DEVICE1 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Stop RAID device"
+/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
+
+sleep 3
+
+ts_log "Deinitialize devices"
+ts_device_deinit $DEVICE1
+ts_device_deinit $DEVICE2
+
+ts_fdisk_clean
+# remove generated UUIDs
+sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/blkid/md-raid1-part b/tests/ts/blkid/md-raid1-part
new file mode 100755
index 0000000..e13901d
--- /dev/null
+++ b/tests/ts/blkid/md-raid1-part
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MD raid1 (last partition)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=51 sector_size=512
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++25M
+n
+p
+2
+
+
+p
+w
+q
+EOF
+
+sleep 3
+MD_DEVNAME=md8
+MD_DEVICE=/dev/${MD_DEVNAME}
+
+ts_log "Create RAID1 device"
+/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
+/sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 --level=1 \
+ --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
+
+sleep 3
+
+ts_log "Probe whole-disk"
+$TS_CMD_BLKID -p -o udev ${DEVICE} 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Probe first RAID member"
+$TS_CMD_BLKID -p -o udev ${DEVICE}1 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Probe second RAID member"
+$TS_CMD_BLKID -p -o udev ${DEVICE}2 2>&1 | sort >> $TS_OUTPUT
+
+/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
+
+sleep 3
+rmmod scsi_debug
+
+ts_fdisk_clean
+# substitue UUIDs and major/minor number before comparison
+sed -i \
+ -e 's/^\(ID_FS_UUID\)=.*/\1=__ts_uuid__/' \
+ -e 's/^\(ID_FS_UUID_ENC\)=.*/\1=__ts_uuid_enc__/' \
+ -e 's/^\(ID_PART_ENTRY_DISK\)=.*/\1=__ts_majorminor__/' \
+ $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/blkid/md-raid1-whole b/tests/ts/blkid/md-raid1-whole
new file mode 100755
index 0000000..32e17b8
--- /dev/null
+++ b/tests/ts/blkid/md-raid1-whole
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MD raid1 (whole-disks)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
+
+set -o pipefail
+
+ts_log "Initialize devices"
+IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
+
+DEVICE1=$(ts_device_init 50 ${IMGNAME}1.img)
+[ "$?" == 0 ] || ts_die "Cannot init device1"
+
+DEVICE2=$(ts_device_init 50 ${IMGNAME}2.img)
+[ "$?" == 0 ] || ts_die "Cannot init device2" $DEVICE1
+
+MD_DEVNAME=md8
+MD_DEVICE=/dev/${MD_DEVNAME}
+
+/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
+
+ts_log "Create RAID device"
+/sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 --level=1 \
+ --raid-devices=2 ${DEVICE1} ${DEVICE2} >> $TS_OUTPUT 2>&1
+
+ts_log "Create partitions on RAID device"
+$TS_CMD_FDISK ${MD_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+p
+w
+q
+EOF
+
+sleep 3
+
+ts_log "Probe first RAID member"
+$TS_CMD_BLKID -p -o udev $DEVICE1 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Probe second RAID member"
+$TS_CMD_BLKID -p -o udev $DEVICE1 2>&1 | sort >> $TS_OUTPUT
+
+ts_log "Stop RAID device"
+/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
+
+sleep 3
+
+ts_log "Deinitialize devices"
+ts_device_deinit $DEVICE1
+ts_device_deinit $DEVICE2
+
+ts_fdisk_clean
+# remove generated UUIDs
+sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/build-sys/config b/tests/ts/build-sys/config
new file mode 100755
index 0000000..e2c2b00
--- /dev/null
+++ b/tests/ts/build-sys/config
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="config"
+
+# Don't execute this test by default, --force required
+TS_OPTIONAL="yes"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+[ -x /usr/bin/readelf ] || ts_skip "readelf(1) not found"
+[ -x /usr/bin/file ] || ts_skip "file(1) not found"
+
+config_gen_dir="$top_srcdir/tools"
+. $config_gen_dir/config-gen-functions.sh
+
+[ -n "$CFLAGS" ] && export CFLAGS="$CFLAGS"
+
+cd $top_builddir && make -j clean &> /dev/null
+
+for conf in $config_gen_dir/config-gen.d/*.conf; do
+ ts_init_subtest $(basename $conf | sed 's/\.conf//')
+
+ opts=$(ul_get_configuration $conf)
+
+ olddir=$(pwd)
+ cd $top_builddir
+
+ ./configure $opts &> /dev/null
+ make -j &> /dev/null
+
+ bins=$(find . -type f -perm /a+x | sort)
+ for b in $bins; do
+ libs=$(readelf --dynamic $b 2> /dev/null | \
+ awk '/NEEDED/ { print $5 }' | \
+ sed 's:\[::g; s:\..*::g; s:libc::g' | \
+ sort -u | tr '\n' ' ')
+
+ if [ -n "$libs" ]; then
+ echo "$(basename $b): $libs" >> $TS_OUTPUT
+ else
+ fres=$(file $b)
+ case $fres in
+ *statically*)
+ echo "$(basename $b): STATIC" >> $TS_OUTPUT
+ ;;
+ *) # ignore scripts, ...etc.
+ ;;
+ esac
+ fi
+ done
+
+ # clean the tree, but exclude tests/{diff,output} dirs
+ #
+ [ -d tests/diff ] && mv tests/diff tests/diff.save
+ [ -d tests/output ] && mv tests/output tests/output.save
+
+ make -j clean &> /dev/null
+
+ [ -d tests/diff.save ] && mv tests/diff.save tests/diff
+ [ -d tests/output.save ] && mv tests/output.save tests/output
+
+ cd $olddir
+ ts_finalize_subtest
+done
+
+ts_finalize
diff --git a/tests/ts/cal/1m b/tests/ts/cal/1m
new file mode 100755
index 0000000..b4e4b75
--- /dev/null
+++ b/tests/ts/cal/1m
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="1 month"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+set -o pipefail
+
+USETERM=$( ts_has_option "useterm" "$*" )
+MYTIME="27 09 2006"
+
+[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
+ts_log ""
+
+ts_log "Gregorian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -1m $MYTIME
+fi
+$TS_CMD_CAL -1m $MYTIME >> $TS_OUTPUT
+
+ts_log "Gregorian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -1s $MYTIME
+fi
+$TS_CMD_CAL -1s $MYTIME >> $TS_OUTPUT
+
+
+ts_log "Julian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -1mj $MYTIME
+fi
+$TS_CMD_CAL -1mj $MYTIME >> $TS_OUTPUT
+
+ts_log "Julian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -1sj $MYTIME
+fi
+$TS_CMD_CAL -1sj $MYTIME >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/cal/3m b/tests/ts/cal/3m
new file mode 100755
index 0000000..bf9c222
--- /dev/null
+++ b/tests/ts/cal/3m
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="3 months"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+set -o pipefail
+
+USETERM=$( ts_has_option "useterm" "$*" )
+MYTIME="27 09 2006"
+
+[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
+ts_log ""
+
+ts_log "Gregorian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -3m $MYTIME
+fi
+$TS_CMD_CAL -3m $MYTIME >> $TS_OUTPUT
+
+ts_log "Gregorian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -3s $MYTIME
+fi
+$TS_CMD_CAL -3s $MYTIME >> $TS_OUTPUT
+
+
+ts_log "Julian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -3mj $MYTIME
+fi
+$TS_CMD_CAL -3mj $MYTIME >> $TS_OUTPUT
+
+ts_log "Julian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -3sj $MYTIME
+fi
+$TS_CMD_CAL -3sj $MYTIME >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/cal/year b/tests/ts/cal/year
new file mode 100755
index 0000000..e1d4d95
--- /dev/null
+++ b/tests/ts/cal/year
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="year"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+set -o pipefail
+
+USETERM=$( ts_has_option "useterm" "$*" )
+MYTIME="29 11 2006"
+
+[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
+ts_log ""
+
+ts_log "Gregorian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -ym $MYTIME
+fi
+$TS_CMD_CAL -ym $MYTIME >> $TS_OUTPUT
+
+ts_log "Gregorian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -ys $MYTIME
+fi
+$TS_CMD_CAL -ys $MYTIME >> $TS_OUTPUT
+
+
+ts_log "Julian - Monday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -ymj $MYTIME
+fi
+$TS_CMD_CAL -ymj $MYTIME >> $TS_OUTPUT
+
+ts_log "Julian - Sunday-based week"
+if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL -ysj $MYTIME
+fi
+$TS_CMD_CAL -ysj $MYTIME >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/col/multibyte b/tests/ts/col/multibyte
new file mode 100755
index 0000000..7001029
--- /dev/null
+++ b/tests/ts/col/multibyte
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="multibyte input"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+cat $TS_SELF/multibyte.data | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/col/multibyte.data b/tests/ts/col/multibyte.data
new file mode 100644
index 0000000..b203afd
--- /dev/null
+++ b/tests/ts/col/multibyte.data
@@ -0,0 +1 @@
+Dateiname der Versandhülle
diff --git a/tests/ts/colrm/rm2-2 b/tests/ts/colrm/rm2-2
new file mode 100755
index 0000000..a8419cb
--- /dev/null
+++ b/tests/ts/colrm/rm2-2
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2011 Sami Kerola <kerolasa@iki.fi>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="basic check"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+printf "a b\nc\td\nef\b\tg\n" | $TS_CMD_COLRM 2 2 > $TS_OUTPUT 2>&1
+
+ts_finalize
diff --git a/tests/ts/column/fillrow b/tests/ts/column/fillrow
new file mode 100755
index 0000000..172e858
--- /dev/null
+++ b/tests/ts/column/fillrow
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2011 Sami Kerola <kerolasa@iki.fi>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="fill row"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+cd $TS_OUTDIR
+
+$TS_CMD_COLUMN -x -c 50 $TS_SELF/input >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/column/input b/tests/ts/column/input
new file mode 100644
index 0000000..d3ea4a8
--- /dev/null
+++ b/tests/ts/column/input
@@ -0,0 +1,10 @@
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
+0 1 2 3 4 5
diff --git a/tests/ts/column/multi-file b/tests/ts/column/multi-file
new file mode 100755
index 0000000..654a1da
--- /dev/null
+++ b/tests/ts/column/multi-file
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2011 Sami Kerola <kerolasa@iki.fi>
+# 2011 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="multiple files"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+cd $TS_OUTDIR
+
+$TS_CMD_COLUMN -x -c 50 $TS_SELF/input \
+ $TS_SELF/input \
+ $TS_SELF/input >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/column/separator_table b/tests/ts/column/separator_table
new file mode 100755
index 0000000..fe6f83c
--- /dev/null
+++ b/tests/ts/column/separator_table
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2011 Sami Kerola <kerolasa@iki.fi>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="separator & table"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+cd $TS_OUTDIR
+
+$TS_CMD_COLUMN -s 2 -t $TS_SELF/input >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/cramfs/cramfs-big.img b/tests/ts/cramfs/cramfs-big.img
new file mode 100644
index 0000000..2ea516e
--- /dev/null
+++ b/tests/ts/cramfs/cramfs-big.img
Binary files differ
diff --git a/tests/ts/cramfs/cramfs-little.img b/tests/ts/cramfs/cramfs-little.img
new file mode 100644
index 0000000..a1dfab5
--- /dev/null
+++ b/tests/ts/cramfs/cramfs-little.img
Binary files differ
diff --git a/tests/ts/cramfs/doubles b/tests/ts/cramfs/doubles
new file mode 100755
index 0000000..ed4e4aa
--- /dev/null
+++ b/tests/ts/cramfs/doubles
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="mkfs doubles"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+ORIGPWD=$(pwd)
+IMAGE_NAME="${TS_TESTNAME}.img"
+IMAGE_PATH="$TS_OUTDIR/$IMAGE_NAME"
+IMAGE_SRC="$TS_OUTDIR/${TS_TESTNAME}-data"
+
+ts_log "create mountpoint dir"
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+mkdir -p $IMAGE_SRC
+echo hello > $IMAGE_SRC/a
+echo hello > $IMAGE_SRC/b
+
+ts_log "create cramfs image"
+$TS_CMD_MKCRAMFS $IMAGE_SRC $IMAGE_PATH 2>&1 >> $TS_OUTPUT
+[ -s "$IMAGE_PATH" ] || ts_die "Cannot create $IMAGE_PATH"
+
+$TS_CMD_MOUNT -r $IMAGE_PATH $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+# check it
+ts_is_mounted $TS_MOUNTPOINT || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts"
+
+ts_log "umount the image"
+$TS_CMD_UMOUNT $TS_MOUNTPOINT
+ts_finalize
+
diff --git a/tests/ts/cramfs/fsck-endianness b/tests/ts/cramfs/fsck-endianness
new file mode 100755
index 0000000..6a98c9e
--- /dev/null
+++ b/tests/ts/cramfs/fsck-endianness
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="fsck endianness"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+($TS_CMD_FSCKCRAMFS -x TEST_X_FLAG 2>&1 || true) \
+ | grep -q "compiled without -x support" && ts_skip "fsck: compiled without -x support"
+
+IMAGE_LITTLE="$TS_SELF/cramfs-little.img" #Known good little endian image
+IMAGE_BIG="$TS_SELF/cramfs-big.img" #Known good big endian image
+
+IMAGE_CREATED="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img" #Image created during the test and compared against the known images.
+IMAGE_DATA="$TS_OUTDIR/${TS_TESTNAME}-data"
+
+test_image() {
+ local FROM_ENDIANNESS="$1"; shift
+ local TO_ENDIANNESS="$1"; shift
+ local FROM_IMAGE="$1"; shift
+
+ rm -rf "$IMAGE_DATA"
+ ts_log "extract from $FROM_ENDIANNESS endian"
+ $TS_CMD_FSCKCRAMFS -v -x $IMAGE_DATA $FROM_IMAGE | head -n1 | cut -d" " -f4 2>&1 >> $TS_OUTPUT
+
+ ts_log "create $TO_ENDIANNESS endian"
+ $TS_CMD_MKCRAMFS -N "$TO_ENDIANNESS" "$IMAGE_DATA" "$IMAGE_CREATED" 2>&1 >> $TS_OUTPUT
+
+ md5sum $IMAGE_CREATED | cut -d" " -f1 >> $TS_OUTPUT
+
+ rm "$IMAGE_CREATED"
+}
+
+test_image "little" "big" "$IMAGE_LITTLE"
+test_image "big" "little" "$IMAGE_BIG"
+
+ts_finalize
+
diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs
new file mode 100755
index 0000000..db9b08c
--- /dev/null
+++ b/tests/ts/cramfs/mkfs
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="mkfs checksums"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+ORIGPWD=$(pwd)
+IMAGE_NAME="${TS_TESTNAME}-loop.img"
+IMAGE_PATH="$TS_OUTDIR/$IMAGE_NAME"
+IMAGE_SRC="$TS_OUTDIR/${TS_TESTNAME}-data"
+LABEL="testCramfs"
+
+ts_log "create mountpoint dir"
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_log "generate data"
+if [ ! -d "$IMAGE_SRC" ]; then
+ mkdir -p $IMAGE_SRC
+ for d in `seq 0 110`; do
+ DIRNAME="$IMAGE_SRC/$(printf "dir-%03d" $d)"
+ mkdir -p $DIRNAME
+ for f in `seq 0 10`; do
+ FILENAME="$DIRNAME/$(printf "data.%03d" $f)"
+ printf "data in %03d-%03d" $d $f >> $FILENAME
+ done
+ done
+fi
+
+cd $IMAGE_SRC
+
+ts_log "list checksums from original data"
+find -type f -exec md5sum {} \; | sort >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "create cramfs image"
+$TS_CMD_MKCRAMFS -n $LABEL $IMAGE_SRC $IMAGE_PATH 2>&1 >> $TS_OUTPUT
+[ -s "$IMAGE_PATH" ] || ts_die "Cannot create $IMAGE_PATH"
+
+cd $TS_OUTDIR
+
+ts_log "count MD5 from the image"
+md5sum $IMAGE_NAME 2>&1 | sort >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "create loop device from image"
+DEVICE=$($TS_CMD_LOSETUP --show -f $IMAGE_PATH)
+
+ts_log "check the image"
+ts_device_has "TYPE" "cramfs" $DEVICE
+[ "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE" $DEVICE
+
+ts_log "mount the image"
+$TS_CMD_MOUNT -r -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+# check it
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+
+cd $TS_MOUNTPOINT
+
+ts_log "list the image"
+ls -laR --time-style=long-iso . >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "list checksums from new data"
+find . -type f -exec md5sum {} \; | sort >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+cd $ORIGPWD
+
+ts_log "umount the image"
+$TS_CMD_UMOUNT $DEVICE
+$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
+ts_finalize
+
diff --git a/tests/ts/cramfs/mkfs-endianness b/tests/ts/cramfs/mkfs-endianness
new file mode 100755
index 0000000..68237c0
--- /dev/null
+++ b/tests/ts/cramfs/mkfs-endianness
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="mkfs endianness"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+IMAGE_DATA="$TS_OUTDIR/${TS_TESTNAME}-data"
+IMAGE_CREATED="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img" #Image created during the test and compared against the known images.
+
+test_image() {
+ local TO_ENDIANNESS="$1"; shift
+ ts_log "create $TO_ENDIANNESS endian"
+
+ $TS_CMD_MKCRAMFS -N "$TO_ENDIANNESS" "$IMAGE_DATA" "$IMAGE_CREATED" 2>&1 >> $TS_OUTPUT
+
+ md5sum $IMAGE_CREATED | cut -d" " -f1 >> $TS_OUTPUT
+
+ rm "$IMAGE_CREATED"
+}
+
+#generate test data
+mkdir -p $IMAGE_DATA/dirA/dirB
+yes "Testing cramfs 1234567890 Endianness check 1234567890 Endianness check" \
+ | dd of=$IMAGE_DATA/dirA/dirB/a bs=512 count=1 &> /dev/null
+yes "Testing cramfs 1234567890 Endianness check 1234567890 Endianness check" \
+ | dd of=$IMAGE_DATA/dirA/dirB/b bs=512 count=30 &> /dev/null
+
+#perform tests for both endians
+test_image "little"
+test_image "big"
+
+ts_finalize
+
diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
new file mode 100755
index 0000000..3081c1f
--- /dev/null
+++ b/tests/ts/eject/umount
@@ -0,0 +1,111 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="umount"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+#
+# Note that eject --force is required because scsi_debug is
+# not removable device.
+#
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+rmmod scsi_debug &> /dev/null
+
+function init_device {
+ modprobe scsi_debug dev_size_mb=100
+ [ "$?" == 0 ] || ts_die "Cannot init device"
+
+ sleep 3
+
+ DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+ [ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+ echo "/dev/${DEVNAME}"
+
+}
+
+function init_partitions {
+ local dev=$1
+
+ ts_log "Create partitions"
+ $TS_CMD_FDISK $dev >> /dev/null 2>&1 <<EOF
+n
+p
+1
+
++50M
+n
+p
+2
+
+
+p
+w
+EOF
+ sleep 1
+ mkfs.ext2 -q ${dev}1
+ mkfs.ext2 -q ${dev}2
+}
+
+function deinit_device {
+ sleep 3
+ rmmod scsi_debug
+}
+
+
+ts_init_subtest "by-disk"
+DEVICE=$(init_device)
+$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+deinit_device
+ts_finalize_subtest
+
+ts_init_subtest "by-disk-mounted"
+DEVICE=$(init_device)
+mkfs.ext2 -q -F $DEVICE
+mkdir -p $TS_MOUNTPOINT
+mount $DEVICE $TS_MOUNTPOINT
+sleep 1
+$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+deinit_device
+ts_finalize_subtest
+
+
+ts_init_subtest "by-disk-mounted-partition"
+DEVICE=$(init_device)
+init_partitions $DEVICE
+mkdir -p ${TS_MOUNTPOINT}1
+mkdir -p ${TS_MOUNTPOINT}2
+mount ${DEVICE}1 ${TS_MOUNTPOINT}1
+mount ${DEVICE}2 ${TS_MOUNTPOINT}2
+$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+deinit_device
+ts_finalize_subtest
+
+
+ts_init_subtest "by-partition"
+DEVICE=$(init_device)
+init_partitions $DEVICE
+$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
+deinit_device
+ts_finalize_subtest
+
+
+ts_init_subtest "by-partition-mounted"
+DEVICE=$(init_device)
+init_partitions $DEVICE
+mkdir -p ${TS_MOUNTPOINT}1
+mkdir -p ${TS_MOUNTPOINT}2
+mount ${DEVICE}1 ${TS_MOUNTPOINT}1
+mount ${DEVICE}2 ${TS_MOUNTPOINT}2
+$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
+deinit_device
+ts_finalize_subtest
+
+
+ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K b/tests/ts/fdisk/align-512-4K
new file mode 100755
index 0000000..3d93022
--- /dev/null
+++ b/tests/ts/fdisk/align-512-4K
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+
+#
+# Test alignment for 512/512 disk *with* topology -- aligned to optimal
+# I/O size (32KiB)
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="align 512/4K"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+n
+p
+3
+
++10M
+n
+e
+
+
+n
+
++5M
+n
+
++5M
+n
+
+
+p
+w
+q
+EOF
+
+ts_log "Alignment offsets:"
+cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTPUT 2>&1
+
+sleep 3
+rmmod scsi_debug
+
+ts_fdisk_clean
+
+ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-63 b/tests/ts/fdisk/align-512-4K-63
new file mode 100755
index 0000000..7a8e95c
--- /dev/null
+++ b/tests/ts/fdisk/align-512-4K-63
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+
+#
+# Test alignment for 512/512 disk *with* topology -- aligned to optimal
+# I/O size (32KiB)
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="align 512/4K +alignment_offset"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+n
+p
+3
+
++10M
+n
+e
+
+
+n
+
++5M
+n
+
++5M
+n
+
+
+p
+w
+q
+EOF
+
+ts_log "Alignment offsets:"
+cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTPUT 2>&1
+
+sleep 3
+rmmod scsi_debug
+
+ts_fdisk_clean
+
+ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md
new file mode 100755
index 0000000..f55ee22
--- /dev/null
+++ b/tests/ts/fdisk/align-512-4K-md
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+
+#
+# Test alignment for 512/512 disk *with* topology -- aligned to optimal
+# I/O size (32KiB)
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="align 512/4K +MD"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+[ -x /sbin/mdadm ] || ts_skip "missing mdadm"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=50 sector_size=512 physblk_exp=3
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++20M
+n
+p
+2
+
+
+p
+w
+q
+EOF
+
+ts_log "Alignment offsets:"
+cat /sys/block/${DEVNAME}/${DEVNAME}{1,2}/alignment_offset >> $TS_OUTPUT 2>&1
+
+sleep 3
+MD_DEVNAME=md8
+MD_DEVICE=/dev/${MD_DEVNAME}
+
+/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
+/sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 \
+ --level=0 --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
+
+ts_log "Create partitions (MD)"
+$TS_CMD_FDISK ${MD_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+p
+w
+q
+EOF
+
+ts_log "Alignment offsets (MD):"
+cat /sys/block/${MD_DEVNAME}/${MD_DEVNAME}p{1,2}/alignment_offset >> $TS_OUTPUT 2>&1
+
+sleep 3
+/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
+rmmod scsi_debug
+
+ts_fdisk_clean
+
+ts_finalize
diff --git a/tests/ts/fdisk/align-512-512 b/tests/ts/fdisk/align-512-512
new file mode 100755
index 0000000..82a6268
--- /dev/null
+++ b/tests/ts/fdisk/align-512-512
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+#
+# Test default 1MiB (2048 sectors) alignment for 512/512 disk *without*
+# topology.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="align 512/512"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+DEVICE=$(ts_device_init 50)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+n
+p
+3
+
++10M
+n
+e
+
+
+n
+
++5M
+n
+
++5M
+n
+
+
+p
+q
+EOF
+
+ts_device_deinit $DEVICE
+
+ts_fdisk_clean
+
+ts_finalize
diff --git a/tests/ts/fdisk/align-512-512-topology b/tests/ts/fdisk/align-512-512-topology
new file mode 100755
index 0000000..ec10fd8
--- /dev/null
+++ b/tests/ts/fdisk/align-512-512-topology
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+
+#
+# Test alignment for 512/512 disk *with* topology -- aligned to optimal
+# I/O size (32KiB)
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="align 512/512 +topology"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=50 sector_size=512
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+n
+p
+1
+
++10M
+n
+p
+2
+
++10M
+n
+p
+3
+
++10M
+n
+e
+
+
+n
+
++5M
+n
+
++5M
+n
+
+
+p
+w
+q
+EOF
+
+ts_log "Alignment offsets:"
+cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTPUT 2>&1
+
+sleep 3
+rmmod scsi_debug
+
+ts_fdisk_clean
+
+ts_finalize
diff --git a/tests/ts/fdisk/id b/tests/ts/fdisk/id
new file mode 100755
index 0000000..2c76f42
--- /dev/null
+++ b/tests/ts/fdisk/id
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MBR - id"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+FDISK_CMD_ID1="x\ni\n0x1\nr\nw\n"
+FDISK_CMD_ID2="x\ni\n0x2\nr\nw\n"
+
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 10)
+
+ts_log "Create MBR with ID=0x1"
+echo -e "${FDISK_CMD_ID1}" | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+$TS_CMD_FDISK -l ${TEST_IMAGE_NAME} | grep identifier >> $TS_OUTPUT
+
+ts_log "Create MBR with ID=0x2"
+echo -e "${FDISK_CMD_ID2}" | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+$TS_CMD_FDISK -l ${TEST_IMAGE_NAME} | grep identifier >> $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/fdisk/mbr-dos-mode b/tests/ts/fdisk/mbr-dos-mode
new file mode 100755
index 0000000..07b2006
--- /dev/null
+++ b/tests/ts/fdisk/mbr-dos-mode
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+#
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MBR - dos mode"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+# cmd to change number of cylinders to 1024 and changes system id to 0x1
+FDISK_CMD_INIT="x\nc\n1024\ni\n0x1\nr\n"
+FDISK_CMD_WRITE_CLOSE="w\nq\n"
+FDISK_CMD_CREATE_DOSLABEL="o\n" #create dos label
+FDISK_CMD_CREATE_PRIMARY="n\np\n1\n\n+1M\n" # create primary partition 1 of size 1MB
+FDISK_CMD_CHANGE_PARTTYPE="t\nbf\n" # change partition type to "bf - solaris", this requires that there is only one partition to change
+FDISK_CMD_SET_ACTIVE="a\n1\n" # set first partition active
+FDISK_CMD_CREATE_EXTENDED="n\ne\n2\n\n+10\n" # create extended partition 2 of size 11 cylinders
+FDISK_CMD_CREATE_LOGICAL="n\nl\n\n+1\n" # create next logical partition of size 2 cyl
+FDISK_CMD_DELETE_LOGICALS="d\n6\nd\n5\nd\n6\d5\n" # delete middle, head, tail, last partitions
+FDISK_CMD_DELETE_PRIMARY="d\n1\n" # delete first primary
+FDISK_CMD_DELETE_EXTENDED="d\n2\n" # delete second primary
+
+#set -x
+
+function print_layout {
+ echo -ne "\n---layout----------" >> $TS_OUTPUT
+ $TS_CMD_FDISK -c=dos -u=cylinders -l ${TEST_IMAGE_NAME} | \
+ sed 's/^.*\.img/__ts_dev__/g;
+ s/^[[:blank:]]*Device Boot/ Device Boot/g' >> $TS_OUTPUT 2>&1
+ echo -ne "-------------------\n\n" >> $TS_OUTPUT
+}
+
+#
+# Note that fdisk will enlarge the disk image (to 57MB) because the logical
+# partitions are out of the original range (10MB).
+#
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 10)
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+# need to run init twice, to change system ID after new label, otherwise system
+# ID will be random and will screw up md5's
+ts_log "Create new DOS partition table"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Set partition type"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CHANGE_PARTTYPE}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Set primary partition active"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_SET_ACTIVE}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Re-create primary partition"
+echo -e "${FDISK_CMD_INIT}d\n${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create extended partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create logical partitions"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete logical partitions"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_LOGICALS}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create another logical partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete extended partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_finalize
diff --git a/tests/ts/fdisk/mbr-nondos-mode b/tests/ts/fdisk/mbr-nondos-mode
new file mode 100755
index 0000000..119d2c9
--- /dev/null
+++ b/tests/ts/fdisk/mbr-nondos-mode
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="MBR - non-dos mode"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+# cmd to changes system id to 0x1
+FDISK_CMD_INIT="x\ni\n0x1\nr\n"
+FDISK_CMD_WRITE_CLOSE="w\nq\n"
+FDISK_CMD_CREATE_DOSLABEL="o\n" #create dos label
+FDISK_CMD_CREATE_1PRIMARY="n\np\n\n\n+3M\n" # create primary partition of size 3MiB
+FDISK_CMD_CREATE_2PRIMARY="n\np\n\n\n+2M\n" # create primary partition of size 2MiB
+FDISK_CMD_SET_ACTIVE="a\n1\n" # set first partition active
+FDISK_CMD_CREATE_EXTENDED="n\ne\n\n\n\n" # create extended partition
+FDISK_CMD_CREATE_LOGICAL="n\nl\n\n+2M\n" # create next logical partition of size 10 sectors
+FDISK_CMD_DELETE_LOGICALS="d\n6\nd\n5\nd\n6\d5\n" # delete middle, head, tail, last partitions
+FDISK_CMD_DELETE_1PRIMARY="d\n1\n" # delete first primary
+FDISK_CMD_DELETE_2PRIMARY="d\n2\n" # delete first primary
+FDISK_CMD_DELETE_EXTENDED="d\n3\n" # delete second primary
+
+function print_layout {
+ echo -ne "\n---layout----------" >> $TS_OUTPUT
+ $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} | \
+ sed 's/^.*\.img/__ts_dev__/g;
+ s/^[[:blank:]]*Device Boot/ Device Boot/g' >> $TS_OUTPUT 2>&1
+ echo -ne "-------------------\n\n" >> $TS_OUTPUT
+}
+
+#set -x
+
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 20) # 20 MiB
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+# need to run init twice, to change system ID after new label, otherwise system
+# ID will be random and will screw up md5's
+ts_log "Create new DOS partition table"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create 1st primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Set primary partition active"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_SET_ACTIVE}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Re-create 1st primary partition"
+echo -e "${FDISK_CMD_INIT}d\n${FDISK_CMD_CREATE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create 2nd primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_2PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create extended partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create logical partitions"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete logical partitions"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_LOGICALS}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Create another logical partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete primary partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_2PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_log "Delete extended partition"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+print_layout
+
+ts_finalize
diff --git a/tests/ts/fdisk/oddinput b/tests/ts/fdisk/oddinput
new file mode 100755
index 0000000..799eca0
--- /dev/null
+++ b/tests/ts/fdisk/oddinput
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="invalid input tests"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+#set -x
+
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 10)
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Empty image listing" # this should report empty partition table
+# TEST_IMAGE_NAME has absolute path, and is by definition different on each computer, we need to sed it away
+$TS_CMD_FDISK -c=dos -u=cylinders -l ${TEST_IMAGE_NAME} 2>&1 | sed -e "s/${TEST_IMAGE_NAME//\//\\/}/testimage/" >> $TS_OUTPUT
+
+ts_log "Nonexistant file" # this originally does absolutely nothing
+$TS_CMD_FDISK -c=dos -u=cylinders -l _a_file_that_does_not_exist_ >> $TS_OUTPUT 2>&1
+
+ts_log "Too small file" # same here
+echo "This file is too small" >> oddinput.toosmall
+$TS_CMD_FDISK -c=dos -u=cylinders -l oddinput.toosmall >> $TS_OUTPUT 2>&1
+rm oddinput.toosmall
+ts_finalize
diff --git a/tests/ts/fdisk/sunlabel b/tests/ts/fdisk/sunlabel
new file mode 100755
index 0000000..e1ce4f4
--- /dev/null
+++ b/tests/ts/fdisk/sunlabel
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="sunlabel tests"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+FDISK_CMD_INIT="s\n1\n1\n1024\n" # create new sunlabel
+FDISK_CMD_WRITE_CLOSE="w\nq\n"
+FDISK_CMD_DELETEALL="d\n1\nd\n2\nd\n3\nd\n4\nd\n5\nd\n6\nd\n7\nd\n8\n" # delete all partitions
+
+FDISK_CMD_CREATE_PRIMARY="n\n1\n0\n128\n" # create first partition, cylinders 0 through 128
+FDISK_CMD_TOGGLE_READONLY="a\n1\n" # sets first partition as read-only
+FDISK_CMD_TOGGLE_MOUNTABLE="c\n1\n" # sets first partition as mountable
+FDISK_CMD_CHANGE_SYSID="t\n1\n4\n" # changes sysid to 4 (SunOS usr)
+FDISK_CMD_CREATE_SECONDARY="n\n2\n128\n\n" # create secondary partition cylinders 128 to the end of disk
+
+#set -x
+
+ts_log "Initialize empty image"
+TEST_IMAGE_NAME=$(ts_image_init 10)
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Create new SUN partition table"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" \
+ | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Create first partition"
+echo -e "${FDISK_CMD_CREATE_PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Set partition sysid"
+echo -e "${FDISK_CMD_CHANGE_SYSID}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Set first partition readonly"
+echo -e "${FDISK_CMD_TOGGLE_READONLY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Set first partition mountable"
+echo -e "${FDISK_CMD_TOGGLE_MOUNTABLE}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Create second partition"
+echo -e "${FDISK_CMD_CREATE_SECONDARY}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_log "Delete all partitions"
+echo -e "${FDISK_CMD_DELETEALL}${FDISK_CMD_WRITE_CLOSE}" | \
+ $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_image_md5sum >> $TS_OUTPUT 2>&1
+
+ts_finalize
diff --git a/tests/ts/fsck/ismounted b/tests/ts/fsck/ismounted
new file mode 100755
index 0000000..6b7f0f7
--- /dev/null
+++ b/tests/ts/fsck/ismounted
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="is mounted"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+> $TS_OUTPUT
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
+
+# test by ismounted.c
+$TS_HELPER_ISMOUNTED $DEVICE | awk '{print $1}' >> $TS_OUTPUT 2>&1
+
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_finalize
diff --git a/tests/ts/hwclock/systohc b/tests/ts/hwclock/systohc
new file mode 100755
index 0000000..401ee93
--- /dev/null
+++ b/tests/ts/hwclock/systohc
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="system to hw"
+NTP_SERVER="0.fedora.pool.ntp.org"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+PATH='/usr/sbin:/usr/bin:/sbin:/bin'
+type ntpdate >/dev/null 2>&1 || ts_skip "cannot find ntpdate command"
+
+set -o pipefail
+
+# sync with server
+(ntpdate $NTP_SERVER | sed "s/^.*offset \([0-9.]*\) sec/\1/g") &> /dev/null
+[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER"
+
+# sync again and check difference
+OFFSET=$( ntpdate $NTP_SERVER 2> /dev/null | sed "s/^.*offset [\-]*\([0-9.]*\) sec/\1/g" )
+[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER (2nd attempt)"
+
+DIFF=$( echo "$OFFSET > 1" | bc )
+[ "$DIFF" == "1" ] && ts_skip "diff between systime and NTP is greated than 1 second"
+
+# call hwclock
+for i in `seq 0 10`; do
+ #echo "sync #$i"
+ $TS_CMD_HWCLOCK --systohc
+ $TS_CMD_HWCLOCK --hctosys
+done
+
+# sync with NTP and check new difference
+OFFSET=$( ntpdate $NTP_SERVER 2> /dev/null | sed "s/^.*offset [\-]*\([0-9.]*\) sec/\1/g" )
+[ "$?" == "1" ] && ts_skip "cannot sync with $NTP_SERVER (3rd attempt)"
+
+DIFF=$( echo "$OFFSET > 1" | bc )
+[ "$DIFF" == "1" ] && ts_failed "offset is $OFFSET"
+
+ts_ok "offset is $OFFSET"
+
diff --git a/tests/ts/ipcs/functions.sh b/tests/ts/ipcs/functions.sh
new file mode 100644
index 0000000..24ea445
--- /dev/null
+++ b/tests/ts/ipcs/functions.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+PAGE_SIZE=$($TS_HELPER_SYSINFO pagesize)
+
+# kernel files
+IPCS_PROCFILES=(
+ /proc/sys/kernel/shmmni
+ /proc/sys/kernel/shmall
+ /proc/sys/kernel/shmmax
+)
+
+# raw data converted to ipcs-like format
+# shmmni = same
+# shmall = from pages to KBytes
+# shmmax = from bytes to KBytes
+#
+IPCS_KERNEL_CMD=(
+ "cat /proc/sys/kernel/shmmni"
+ "echo \$(cat /proc/sys/kernel/shmall) / 1024 \* $PAGE_SIZE | bc -l | sed 's/\..*//'"
+ "echo \$(cat /proc/sys/kernel/shmmax) / 1024 | bc -l | sed 's/\..*//'"
+)
+
+# data from the ipcs command
+IPCS_CMD=(
+ "$TS_CMD_IPCS -m -l | awk '/max number of segments/ { print \$6 }'"
+ "$TS_CMD_IPCS -m -l | awk '/max total shared memory/ { print \$7 }'"
+ "$TS_CMD_IPCS -m -l | awk '/max seg size/ { print \$6 }'"
+)
+
+
+# The linux kernel accepts ULONG_MAX, but this value is same like ULLONG_MAX on
+# 64-bit archs. So the ipcs command has to always overflow on 64-bit archs when
+# shmall (=num of pages!) is same or almost same like ULONG_MAX. This is reason
+# why we for the test uses 32-bit limits on all archs.
+#
+# (Don't worry that 64-bit ULONG_MAX makes ipcs useless ...
+# ... it's a problem for admins who want to use 75557863725TB of RAM for shm)
+#
+IPCS_LIMITS=(
+ $($TS_HELPER_SYSINFO INT_MAX)
+ $($TS_HELPER_SYSINFO ULONG_MAX32)
+ $($TS_HELPER_SYSINFO ULONG_MAX32)
+)
+
+# list of indexes = 0..(sizeof Array - 1)
+IPCS_IDX=$(seq 0 $(( ${#IPCS_PROCFILES[*]} - 1 )))
+
+# checker
+function ipcs_limits_check {
+ for i in $IPCS_IDX; do
+ echo -n ${IPCS_PROCFILES[$i]}
+
+ a=$(eval ${IPCS_KERNEL_CMD[$i]})
+ b=$(eval ${IPCS_CMD[$i]})
+
+ #echo -n " RAW: "
+ #cat ${IPCS_PROCFILES[$i]}
+ #echo "CMD: ${ICPS_KERNEL_CMD[$i]}"
+
+ if [ x"$a" == x"$b" ]; then
+ echo " OK"
+ else
+ echo " kernel=$a, ipcs=$b"
+ fi
+ done
+}
+
diff --git a/tests/ts/ipcs/headers b/tests/ts/ipcs/headers
new file mode 100755
index 0000000..99b82a3
--- /dev/null
+++ b/tests/ts/ipcs/headers
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="headers"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_log "test: shm headers"
+$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -p | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -l | grep "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -m -u | grep "^---" >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "test: mesg headers"
+$TS_CMD_IPCS -q -t | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -p | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -l | grep "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -q -u | grep "^---" >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "test: sem headers"
+$TS_CMD_IPCS -s -t | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -p | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -l | grep "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -s -u | grep "^---" >> $TS_OUTPUT
+echo >> $TS_OUTPUT
+
+ts_log "test: all headers"
+$TS_CMD_IPCS -a | grep --after-context=1 "^---" >> $TS_OUTPUT
+
+$TS_CMD_IPCS -a -t | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -p | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -c | grep --after-context=1 "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -l | grep "^---" >> $TS_OUTPUT
+$TS_CMD_IPCS -a -u | grep "^---" >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/ipcs/limits b/tests/ts/ipcs/limits
new file mode 100755
index 0000000..ed6e084
--- /dev/null
+++ b/tests/ts/ipcs/limits
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="limits overflow"
+
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+ts_skip_nonroot
+
+. $TS_SELF/functions.sh
+
+ts_log "load original values"
+for i in $IPCS_IDX; do
+ SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]})
+done >> $TS_OUTPUT
+
+ts_log "check for difference between kernel and IPC"
+ipcs_limits_check >> $TS_OUTPUT
+
+ts_log "maximalize kernel setting"
+for i in $IPCS_IDX; do
+ echo ${IPCS_LIMITS[$i]} >> ${IPCS_PROCFILES[$i]}
+done >> $TS_OUTPUT
+
+ts_log "re-check for difference between kernel and IPC"
+ipcs_limits_check >> $TS_OUTPUT
+
+ts_log "write original values to kernel"
+for i in $IPCS_IDX; do
+ echo ${SHM_ORG[$i]} >> ${IPCS_PROCFILES[$i]}
+done >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
new file mode 100755
index 0000000..acb1749
--- /dev/null
+++ b/tests/ts/ipcs/limits2
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="basic limits"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+. $TS_SELF/functions.sh
+
+ts_log "check for difference between kernel and IPC"
+ipcs_limits_check >> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context
new file mode 100755
index 0000000..c8f2850
--- /dev/null
+++ b/tests/ts/libmount/context
@@ -0,0 +1,133 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="context"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+TESTPROG="$TS_HELPER_LIBMOUNT_CONTEXT"
+LABEL=libmount-test
+UUID=$(uuidgen)
+MOUNTPOINT="$TS_MOUNTPOINT"
+
+#set -x
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+ts_log "Init device"
+umount $MOUNTPOINT &> /dev/null
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=100
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> /dev/null 2>&1 <<EOF
+n
+p
+1
+
+
+w
+q
+EOF
+
+DEVICE="/dev/${DEVNAME}1"
+
+sleep 3
+
+ts_log "Create filesystem"
+mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null
+
+ts_log "Do tests..."
+
+export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
+> $LIBMOUNT_MTAB
+
+
+ts_init_subtest "mount-by-devname"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
+
+grep -q $DEVICE $LIBMOUNT_MTAB || \
+ echo "(by device) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "umount-by-devname"
+ts_valgrind $TESTPROG --umount $DEVICE >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB &&
+ echo "umount (device) failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+#exit 1
+
+ts_init_subtest "mount-by-label"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB || \
+ echo "(by label) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+
+ts_init_subtest "umount-by-mountpoint"
+ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB && \
+ echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-by-uuid"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount UUID="$UUID" $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB || \
+ echo "(by uuid) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB &&
+ echo "umount failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-flags"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount -o ro,noexec,nosuid,strictatime $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
+$TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB || \
+ echo "cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+
+ts_valgrind $TESTPROG --mount -o remount,rw $MOUNTPOINT >> $TS_OUTPUT 2>&1
+$TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1
+
+ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_MTAB &&
+ echo "umount failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-loopdev"
+mkdir -p $MOUNTPOINT &> /dev/null
+img=$(ts_image_init)
+mkfs.ext3 -F $img &> /dev/null
+ts_valgrind $TESTPROG --mount -o loop $img $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $MOUNTPOINT $LIBMOUNT_MTAB || \
+ echo "(loopdev) cannot find $MOUNTPOINT in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $MOUNTPOINT $LIBMOUNT_MTAB &&
+ echo "umount failed: found $MOUNTPOINT in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_log "...done."
+rmmod scsi_debug
+ts_finalize
diff --git a/tests/ts/libmount/context-utab b/tests/ts/libmount/context-utab
new file mode 100755
index 0000000..4c1d117
--- /dev/null
+++ b/tests/ts/libmount/context-utab
@@ -0,0 +1,125 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="context (utab)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+TESTPROG="$TS_HELPER_LIBMOUNT_CONTEXT"
+LABEL=libmount-test
+UUID=$(uuidgen)
+MOUNTPOINT="$TS_MOUNTPOINT"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+ts_log "Init device"
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=260
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+
+ts_log "Create partitions"
+$TS_CMD_FDISK ${DEVICE} >> /dev/null 2>&1 <<EOF
+n
+p
+1
+
+
+w
+q
+EOF
+
+DEVICE="/dev/${DEVNAME}1"
+
+sleep 3
+
+ts_log "Create filesystem"
+mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null
+
+ts_log "Do tests..."
+
+export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
+rm -f $LIBMOUNT_MTAB
+ln -s /proc/mounts $LIBMOUNT_MTAB
+
+export LIBMOUNT_UTAB=$TS_OUTPUT.utab
+rm -f $LIBMOUNT_UTAB
+> $LIBMOUNT_UTAB
+
+
+ts_init_subtest "mount-by-devname"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE /proc/mounts || \
+ echo "(by device) cannot find $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+sleep 1
+
+ts_init_subtest "umount-by-devname"
+ts_valgrind $TESTPROG --umount $DEVICE >> $TS_OUTPUT 2>&1
+grep -q $DEVICE /proc/mounts &&
+ echo "umount (device) failed: found $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-uhelper"
+mkdir -p $MOUNTPOINT &> /dev/null
+ts_valgrind $TESTPROG --mount -o uhelper=foo,rw LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_UTAB || \
+ echo "(by label) cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+sleep 1
+
+ts_init_subtest "umount"
+ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $LIBMOUNT_UTAB && \
+ echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+if [ -x "/sbin/mkfs.btrfs" ]; then
+ ts_log "Create filesystem [btrfs]"
+ /sbin/mkfs.btrfs -L "$LABEL" $DEVICE &> /dev/null
+ mount -t btrfs $DEVICE $MOUNTPOINT &> /dev/null
+ /sbin/btrfsctl -S sub $MOUNTPOINT &> /dev/null
+ umount $MOUNTPOINT &> /dev/null
+
+ sleep 1
+
+ ts_init_subtest "mount-uhelper-subvol"
+ mkdir -p $MOUNTPOINT &> /dev/null
+ ts_valgrind $TESTPROG --mount -o uhelper=foo,rw,subvol=sub $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
+ grep -q $DEVICE $LIBMOUNT_UTAB || \
+ echo "cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+ ts_finalize_subtest
+
+ ts_log "All mount options (btrfs subvolume + utab) ---"
+ $TS_CMD_FINDMNT --mtab $MOUNTPOINT -o OPTIONS -n >> $TS_OUTPUT 2>&1
+ ts_log "---"
+
+ sleep 1
+
+ ts_init_subtest "umount-subvol"
+ ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
+ grep -q $DEVICE $LIBMOUNT_UTAB && \
+ echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+ ts_finalize_subtest
+fi
+
+ts_log "...done."
+rmmod scsi_debug
+ts_finalize
diff --git a/tests/ts/libmount/files/fstab b/tests/ts/libmount/files/fstab
new file mode 100644
index 0000000..a8f73bc
--- /dev/null
+++ b/tests/ts/libmount/files/fstab
@@ -0,0 +1,14 @@
+UUID=d3a8f783-df75-4dc8-9163-975a891052c0 / ext3 noatime,defaults 1 1
+UUID=fef7ccb3-821c-4de8-88dc-71472be5946f /boot ext3 noatime,defaults 1 2
+UUID=1f2aa318-9c34-462e-8d29-260819ffd657 swap swap defaults 0 0
+tmpfs /dev/shm tmpfs defaults 0 0
+devpts /dev/pts devpts gid=5,mode=620 0 0
+sysfs /sys sysfs defaults 0 0
+proc /proc proc defaults 0 0
+# this is comment
+/dev/mapper/foo /home/foo ext4 noatime,defaults 0 0
+
+foo.com:/mnt/share /mnt/remote nfs noauto
+//bar.com/gogogo /mnt/gogogo cifs user=SRGROUP/baby,noauto
+
+/dev/foo /any/foo/ auto defaults 0 0
diff --git a/tests/ts/libmount/files/fstab.broken b/tests/ts/libmount/files/fstab.broken
new file mode 100644
index 0000000..c79f026
--- /dev/null
+++ b/tests/ts/libmount/files/fstab.broken
@@ -0,0 +1,14 @@
+bug
+UUID=d3a8f783-df75-4dc8-9163-975a891052c0 / ext3 noatime,defaults 1 1
+UUID=fef7ccb3-821c-4de8-88dc-71472be5946f /boot ext3 noatime,defaults 1 2
+ UUID=1f2aa318-9c34-462e-8d29-260819ffd657 swap swap defaults 0 0
+tmpfs /dev/shm tmpfs defaults 0 0
+devpts /dev/pts devpts gid=5,mode=620
+ sysfs /sys sysfs defaults 0 0
+this is broken line with unexpected number of fields
+proc /proc proc defaults 0 0
+# this is comment
+/dev/mapper/foo /home/foo ext4 noatime,defaults 1
+
+foo.com:/mnt/share /mnt/remote nfs noauto
+//bar.com/gogogo /mnt/gogogo cifs user=SRGROUP/baby,noauto
diff --git a/tests/ts/libmount/files/mountinfo b/tests/ts/libmount/files/mountinfo
new file mode 100644
index 0000000..ff1e664
--- /dev/null
+++ b/tests/ts/libmount/files/mountinfo
@@ -0,0 +1,32 @@
+15 20 0:3 / /proc rw,relatime - proc /proc rw
+16 20 0:15 / /sys rw,relatime - sysfs /sys rw
+17 20 0:5 / /dev rw,relatime - devtmpfs udev rw,size=1983516k,nr_inodes=495879,mode=755
+18 17 0:10 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+19 17 0:16 / /dev/shm rw,relatime - tmpfs tmpfs rw
+20 1 8:4 / / rw,noatime - ext3 /dev/sda4 rw,errors=continue,user_xattr,acl,barrier=0,data=ordered
+21 16 0:17 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755
+22 21 0:18 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
+23 21 0:19 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
+24 21 0:20 / /sys/fs/cgroup/ns rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,ns
+25 21 0:21 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
+26 21 0:22 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
+27 21 0:23 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
+28 21 0:24 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
+29 21 0:25 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
+30 21 0:26 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
+31 21 0:27 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
+32 16 0:28 / /sys/kernel/security rw,relatime - autofs systemd-1 rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+33 17 0:29 / /dev/hugepages rw,relatime - autofs systemd-1 rw,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+34 16 0:30 / /sys/kernel/debug rw,relatime - autofs systemd-1 rw,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+35 15 0:31 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+36 17 0:32 / /dev/mqueue rw,relatime - autofs systemd-1 rw,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+37 15 0:14 / /proc/bus/usb rw,relatime - usbfs /proc/bus/usb rw
+38 33 0:33 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw
+39 36 0:12 / /dev/mqueue rw,relatime - mqueue mqueue rw
+40 20 8:6 / /boot rw,noatime - ext3 /dev/sda6 rw,errors=continue,barrier=0,data=ordered
+41 20 253:0 / /home/kzak rw,noatime - ext4 /dev/mapper/kzak-home rw,barrier=1,data=ordered
+42 35 0:34 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc none rw
+43 16 0:35 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
+44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
+45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
+47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
diff --git a/tests/ts/libmount/files/mountinfo_mv b/tests/ts/libmount/files/mountinfo_mv
new file mode 100644
index 0000000..3d55aff
--- /dev/null
+++ b/tests/ts/libmount/files/mountinfo_mv
@@ -0,0 +1,32 @@
+15 20 0:3 / /proc rw,relatime - proc /proc rw
+16 20 0:15 / /sys rw,relatime - sysfs /sys rw
+17 20 0:5 / /dev rw,relatime - devtmpfs udev rw,size=1983516k,nr_inodes=495879,mode=755
+18 17 0:10 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+19 17 0:16 / /dev/shm rw,relatime - tmpfs tmpfs rw
+20 1 8:4 / / rw,noatime - ext3 /dev/sda4 rw,errors=continue,user_xattr,acl,barrier=0,data=ordered
+21 16 0:17 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755
+22 21 0:18 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
+23 21 0:19 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
+24 21 0:20 / /sys/fs/cgroup/ns rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,ns
+25 21 0:21 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
+26 21 0:22 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
+27 21 0:23 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
+28 21 0:24 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
+29 21 0:25 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
+30 21 0:26 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
+31 21 0:27 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
+32 16 0:28 / /sys/kernel/security rw,relatime - autofs systemd-1 rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+33 17 0:29 / /dev/hugepages rw,relatime - autofs systemd-1 rw,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+34 16 0:30 / /sys/kernel/debug rw,relatime - autofs systemd-1 rw,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+35 15 0:31 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+36 17 0:32 / /dev/mqueue rw,relatime - autofs systemd-1 rw,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+37 15 0:14 / /proc/bus/usb rw,relatime - usbfs /proc/bus/usb rw
+38 33 0:33 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw
+39 36 0:12 / /dev/mqueue rw,relatime - mqueue mqueue rw
+40 20 8:6 / /boot rw,noatime - ext3 /dev/sda6 rw,errors=continue,barrier=0,data=ordered
+41 20 253:0 / /home/kzak rw,noatime - ext4 /dev/mapper/kzak-home rw,barrier=1,data=ordered
+42 35 0:34 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc none rw
+43 16 0:35 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
+44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
+45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
+47 20 0:38 / /mnt/music rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
diff --git a/tests/ts/libmount/files/mountinfo_re b/tests/ts/libmount/files/mountinfo_re
new file mode 100644
index 0000000..df379fa
--- /dev/null
+++ b/tests/ts/libmount/files/mountinfo_re
@@ -0,0 +1,32 @@
+15 20 0:3 / /proc rw,relatime - proc /proc rw
+16 20 0:15 / /sys rw,relatime - sysfs /sys rw
+17 20 0:5 / /dev rw,relatime - devtmpfs udev rw,size=1983516k,nr_inodes=495879,mode=755
+18 17 0:10 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+19 17 0:16 / /dev/shm rw,relatime - tmpfs tmpfs rw
+20 1 8:4 / / rw,noatime - ext3 /dev/sda4 rw,errors=continue,user_xattr,acl,barrier=0,data=ordered
+21 16 0:17 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755
+22 21 0:18 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
+23 21 0:19 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
+24 21 0:20 / /sys/fs/cgroup/ns rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,ns
+25 21 0:21 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
+26 21 0:22 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
+27 21 0:23 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
+28 21 0:24 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
+29 21 0:25 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
+30 21 0:26 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
+31 21 0:27 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
+32 16 0:28 / /sys/kernel/security rw,relatime - autofs systemd-1 rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+33 17 0:29 / /dev/hugepages rw,relatime - autofs systemd-1 rw,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+34 16 0:30 / /sys/kernel/debug rw,relatime - autofs systemd-1 rw,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+35 15 0:31 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+36 17 0:32 / /dev/mqueue rw,relatime - autofs systemd-1 rw,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+37 15 0:14 / /proc/bus/usb rw,relatime - usbfs /proc/bus/usb rw
+38 33 0:33 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw
+39 36 0:12 / /dev/mqueue rw,relatime - mqueue mqueue rw
+40 20 8:6 / /boot rw,noatime - ext3 /dev/sda6 rw,errors=continue,barrier=0,data=ordered
+41 20 253:0 / /home/kzak ro,noatime - ext4 /dev/mapper/kzak-home rw,barrier=1,data=ordered
+42 35 0:34 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc none rw
+43 16 0:35 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
+44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
+45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
+47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ ro,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
diff --git a/tests/ts/libmount/files/mountinfo_u b/tests/ts/libmount/files/mountinfo_u
new file mode 100644
index 0000000..a3dde97
--- /dev/null
+++ b/tests/ts/libmount/files/mountinfo_u
@@ -0,0 +1,31 @@
+15 20 0:3 / /proc rw,relatime - proc /proc rw
+16 20 0:15 / /sys rw,relatime - sysfs /sys rw
+17 20 0:5 / /dev rw,relatime - devtmpfs udev rw,size=1983516k,nr_inodes=495879,mode=755
+18 17 0:10 / /dev/pts rw,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+19 17 0:16 / /dev/shm rw,relatime - tmpfs tmpfs rw
+20 1 8:4 / / rw,noatime - ext3 /dev/sda4 rw,errors=continue,user_xattr,acl,barrier=0,data=ordered
+21 16 0:17 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755
+22 21 0:18 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
+23 21 0:19 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
+24 21 0:20 / /sys/fs/cgroup/ns rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,ns
+25 21 0:21 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
+26 21 0:22 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
+27 21 0:23 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
+28 21 0:24 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
+29 21 0:25 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
+30 21 0:26 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
+31 21 0:27 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
+32 16 0:28 / /sys/kernel/security rw,relatime - autofs systemd-1 rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+33 17 0:29 / /dev/hugepages rw,relatime - autofs systemd-1 rw,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+34 16 0:30 / /sys/kernel/debug rw,relatime - autofs systemd-1 rw,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+35 15 0:31 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+36 17 0:32 / /dev/mqueue rw,relatime - autofs systemd-1 rw,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct
+37 15 0:14 / /proc/bus/usb rw,relatime - usbfs /proc/bus/usb rw
+38 33 0:33 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw
+39 36 0:12 / /dev/mqueue rw,relatime - mqueue mqueue rw
+40 20 8:6 / /boot rw,noatime - ext3 /dev/sda6 rw,errors=continue,barrier=0,data=ordered
+42 35 0:34 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc none rw
+43 16 0:35 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw
+44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
+45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
+47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
diff --git a/tests/ts/libmount/files/mtab b/tests/ts/libmount/files/mtab
new file mode 100644
index 0000000..2de255b
--- /dev/null
+++ b/tests/ts/libmount/files/mtab
@@ -0,0 +1,11 @@
+/dev/sda4 / ext3 rw,noatime 0 0
+proc /proc proc rw 0 0
+sysfs /sys sysfs rw 0 0
+devpts /dev/pts devpts rw,gid=5,mode=620 0 0
+tmpfs /dev/shm tmpfs rw 0 0
+/dev/sda6 /boot ext3 rw,noatime 0 0
+/dev/mapper/kzak-home /home/kzak ext4 rw,noatime 0 0
+none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
+fusectl /sys/fs/fuse/connections fusectl rw 0 0
+gvfs-fuse-daemon /home/kzak/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=kzak 0 0
+sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
diff --git a/tests/ts/libmount/lock b/tests/ts/libmount/lock
new file mode 100755
index 0000000..5c8bcb6
--- /dev/null
+++ b/tests/ts/libmount/lock
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="lock"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_LOCK"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+#
+# Be careful with number of processes. Don't forget that there is time limit
+# when the mount waits on the mtab lock. If you define too much processes some
+# of them will fail with timeout.
+#
+# Note: the original version (< 2.13) of util-linux is completely useless for
+# this test (maximum for this old version is NLOOPS=10 and NPROCESSES=5 (2-way
+# 2GHz machine)). It has terrible performance due a bad timeouts implemntation
+# in lock_mtab().
+#
+NLOOPS=1000
+NPROCESSES=50
+
+
+> $TS_OUTPUT.debug
+echo 0 > $TS_OUTPUT
+SYNCTIME=$(( $(date +%s) + 5 ))
+
+for id in $(seq 0 $(( $NPROCESSES - 1 ))); do
+ ts_valgrind $TESTPROG --lock --synctime $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 &
+done
+
+wait
+
+ts_finalize
diff --git a/tests/ts/libmount/optstr b/tests/ts/libmount/optstr
new file mode 100755
index 0000000..f6a5c05
--- /dev/null
+++ b/tests/ts/libmount/optstr
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="options string"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+ts_init_subtest "append"
+ts_valgrind $TESTPROG --append "aaa,bbb=BBB,context=\"foo,bar,gogo\",ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "append-value"
+ts_valgrind $TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend"
+ts_valgrind $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend-value"
+ts_valgrind $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-remove"
+ts_valgrind $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-small"
+ts_valgrind $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "X" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-large"
+ts_valgrind $TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "XXX-YYY-ZZZ" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new"
+ts_valgrind $TESTPROG --set "aaa,bbb=BBB,ccc" "aaa" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new-end"
+ts_valgrind $TESTPROG --set "aaa,bbb=BBB,ccc" "ccc" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get"
+ts_valgrind $TESTPROG --get "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get-value"
+ts_valgrind $TESTPROG --get "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove"
+ts_valgrind $TESTPROG --remove "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-quoted"
+ts_valgrind $TESTPROG --remove "aaa,context=\"foo,bar,gogo\",bbb=BBB,ccc" "context" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-value"
+ts_valgrind $TESTPROG --remove "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "split"
+ts_valgrind $TESTPROG --split "aaa,bbb=BBB,ccc,x-bar,x-foo=foodata,user=kzak,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "flags"
+ts_valgrind $TESTPROG --flags "aaa,bbb=BBB,x-foo,ccc,user=kzak,nodev,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-linux" # add noatime and remove noexec and nosuid
+ts_valgrind $TESTPROG --apply --linux "user=kzak,noexec,nosuid" 0x400 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-user" # add user,nofail and remove loop
+ts_valgrind $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fix"
+ts_valgrind $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "deduplicate"
+ts_valgrind $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/libmount/tabdiff b/tests/ts/libmount/tabdiff
new file mode 100755
index 0000000..c988258
--- /dev/null
+++ b/tests/ts/libmount/tabdiff
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="table diffs"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_TABDIFF"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+ts_init_subtest "mount"
+ts_valgrind $TESTPROG --diff $TS_SELF/files/mountinfo_u $TS_SELF/files/mountinfo &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "umount"
+ts_valgrind $TESTPROG --diff $TS_SELF/files/mountinfo $TS_SELF/files/mountinfo_u &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remount"
+ts_valgrind $TESTPROG --diff $TS_SELF/files/mountinfo $TS_SELF/files/mountinfo_re &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "move"
+ts_valgrind $TESTPROG --diff $TS_SELF/files/mountinfo $TS_SELF/files/mountinfo_mv &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/libmount/tabfiles b/tests/ts/libmount/tabfiles
new file mode 100755
index 0000000..671c649
--- /dev/null
+++ b/tests/ts/libmount/tabfiles
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="tab files"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_TAB"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+ts_init_subtest "parse-fstab"
+ts_valgrind $TESTPROG --parse "$TS_SELF/files/fstab" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "parse-mtab"
+ts_valgrind $TESTPROG --parse "$TS_SELF/files/mtab" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "parse-fstab-broken"
+ts_valgrind $TESTPROG --parse "$TS_SELF/files/fstab.broken" &> $TS_OUTPUT
+sed -i -e 's/.*fstab.broken:[[:digit:]]*: parse error//g; s/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "parse-mountinfo"
+ts_valgrind $TESTPROG --parse "$TS_SELF/files/mountinfo" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "copy"
+ts_valgrind $TESTPROG --copy-fs "$TS_SELF/files/fstab" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "find-source"
+ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" source UUID=fef7ccb3-821c-4de8-88dc-71472be5946f &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "find-target"
+ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /home/foo &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "find-target2"
+ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /any/foo &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "find-target3"
+ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /any/foo/ &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "find-pair"
+ts_valgrind $TESTPROG --find-pair "$TS_SELF/files/mtab" /dev/mapper/kzak-home /home/kzak &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/libmount/tabfiles-tags b/tests/ts/libmount/tabfiles-tags
new file mode 100755
index 0000000..c5b4181
--- /dev/null
+++ b/tests/ts/libmount/tabfiles-tags
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="tags"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+TESTPROG="$TS_HELPER_LIBMOUNT_TAB"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+#
+# Init device
+#
+modprobe --dry-run --quiet scsi_debug
+[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+
+rmmod scsi_debug &> /dev/null
+modprobe scsi_debug dev_size_mb=50 sector_size=512
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+sleep 3
+
+DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+
+DEVICE="/dev/${DEVNAME}"
+LABEL="testLibmount"
+UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
+
+#
+# Create filesystem
+#
+mkfs.ext3 -F -L $LABEL $DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+FSTAB="$TS_OUTDIR/fstab"
+
+#
+# Label in fstab
+#
+echo "LABEL=$LABEL /mnt/mountpoint auto defaults" > $FSTAB
+
+ts_init_subtest "fstab-label2uuid"
+ts_valgrind $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fstab-label2dev"
+ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+#
+# Add more enties for the same device
+#
+echo "UUID=$UUID /mnt/mountpoint2 auto defaults" >> $FSTAB
+
+ts_init_subtest "fstab-uuid"
+# has to return /mnt/mountpoint2
+ts_valgrind $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fstab-label"
+# has to return /mnt/mountpoint
+ts_valgrind $TESTPROG --find-forward $FSTAB source "LABEL=$LABEL" &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+
+ts_init_subtest "fstab-dev2label"
+# has to return /mnt/mountpoint
+ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+ts_finalize_subtest
+
+#
+# Add devname
+#
+echo "$DEVICE /mnt/mountpoint3 auto defaults" >> $FSTAB
+
+ts_init_subtest "fstab-dev"
+# has to return /mnt/mountpoint3
+ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
+sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
+sed -i -e 's/source: .*//g' $TS_OUTPUT # devname is generated, remove it
+ts_finalize_subtest
+
+
+sleep 3
+rmmod scsi_debug
+ts_finalize
diff --git a/tests/ts/libmount/update b/tests/ts/libmount/update
new file mode 100755
index 0000000..3a989dd
--- /dev/null
+++ b/tests/ts/libmount/update
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="tab update"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+# IMPORTANT notes:
+#
+# - the $TS_OUTPUT variable is between ts_init_subtest and ts_finalize_subtest
+# redefined to subtest specific namespace -- it means that $TS_OUTPUT is a
+# different file within a subtest.
+#
+# - all this test uses global $TS_OUTPUT.{mtab,mountinfo}
+
+
+#
+# Traditional /etc/mtab
+#
+export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
+rm -f $LIBMOUNT_MTAB
+> $LIBMOUNT_MTAB
+
+ts_init_subtest "mtab-mount"
+ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
+ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
+ts_valgrind $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
+ts_valgrind $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
+ts_valgrind $TESTPROG --add none /proc proc defaults
+cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "mtab-move"
+ts_valgrind $TESTPROG --move /mnt/foo /mnt/newfoo
+ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
+cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "mtab-remount"
+ts_valgrind $TESTPROG --remount /mnt/newfoo "ro,noatime"
+ts_valgrind $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
+cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "mtab-umount"
+ts_valgrind $TESTPROG --remove /mnt/bar
+ts_valgrind $TESTPROG --remove /mnt/gogo
+ts_valgrind $TESTPROG --remove /proc
+cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+#
+# utab
+#
+rm -f $LIBMOUNT_MTAB
+ln -s /proc/mounts $LIBMOUNT_MTAB
+
+export LIBMOUNT_UTAB=$TS_OUTPUT.utab
+rm -f $LIBMOUNT_UTAB
+> $LIBMOUNT_UTAB
+
+ts_init_subtest "utab-mount"
+ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
+ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
+ts_valgrind $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
+ts_valgrind $TESTPROG --add none /proc proc "rw,user"
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-move"
+ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
+ts_valgrind $TESTPROG --move /mnt/xyz /mnt/newxyz
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-remount"
+ts_valgrind $TESTPROG --remount /mnt/newbar "ro,noatime"
+ts_valgrind $TESTPROG --remount /mnt/newxyz "rw,user"
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-umount"
+ts_valgrind $TESTPROG --remove /mnt/newbar
+ts_valgrind $TESTPROG --remove /proc
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_finalize
diff --git a/tests/ts/libmount/utils b/tests/ts/libmount/utils
new file mode 100755
index 0000000..d425400
--- /dev/null
+++ b/tests/ts/libmount/utils
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="utils"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_LIBMOUNT_UTILS"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+ts_init_subtest "match-fstype"
+ts_valgrind $TESTPROG --match-fstype ext3 "ext2,ext3,cifs" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-fstype-neg"
+ts_valgrind $TESTPROG --match-fstype cifs "ext2,ext3,nocifs" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-fstype-neg2"
+ts_valgrind $TESTPROG --match-fstype cifs "noext2,ext3,cifs" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-options"
+ts_valgrind $TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ccc" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-options-list"
+ts_valgrind $TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ccc,aaa,ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-options-neg"
+ts_valgrind $TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "noxxx" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-options-neg-list"
+ts_valgrind $TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ddd,noaaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "match-options-neg-list2"
+ts_valgrind $TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "noxxx,ccc,aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "starts-with"
+ts_valgrind $TESTPROG --starts-with "AAAbbbCCC" "AAA" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "ends-with"
+ts_valgrind $TESTPROG --ends-with "AAAbbbCCC" "CCC" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "mountpoint"
+ts_valgrind $TESTPROG --mountpoint /proc &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "mountpoint-subdir"
+ts_valgrind $TESTPROG --mountpoint /proc/sys/kernel &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "mountpoint-root"
+ts_valgrind $TESTPROG --mountpoint / &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fs-root"
+ts_valgrind $TESTPROG --fs-root /proc &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fs-root-subdir"
+ts_valgrind $TESTPROG --fs-root /proc/sys/kernel &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fs-root-subdir2"
+ts_valgrind $TESTPROG --fs-root /etc &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/login/islocal b/tests/ts/login/islocal
new file mode 100755
index 0000000..c25da6a
--- /dev/null
+++ b/tests/ts/login/islocal
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2008 James Youngman <jay@gnu.org>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="islocal"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+$TS_HELPER_ISLOCAL "$TS_SELF/islocal.data" root nobody "" youngman youngman2 \
+ abcdefghx nobo long rot al malformed \
+ nonl znobody >> $TS_OUTPUT
+ts_finalize
diff --git a/tests/ts/login/islocal.data b/tests/ts/login/islocal.data
new file mode 100644
index 0000000..916a8a9
--- /dev/null
+++ b/tests/ts/login/islocal.data
@@ -0,0 +1,10 @@
+root:x:0:0:root:/root:/bin/bash
+sys:x:3:3:sys:/dev:/bin/sh
+orac:x:33:33:sys:/dev:/bin/youngman
+long:x:4:4:foo:/home/loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnggg:/bin/sh
+al:x:5:5:fnord:/dev:/bin/sh
+abcdefgh:x:6:3:fnord:/dev:/bin/sh
+malformed
+
+nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
+nonl:x:65532:65532:no newline:/:/bin/false
diff --git a/tests/ts/login/logindefs b/tests/ts/login/logindefs
new file mode 100755
index 0000000..10caed7
--- /dev/null
+++ b/tests/ts/login/logindefs
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="defs"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+# list all items
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" | sed 's:'$TS_SELF'/::g' >> $TS_OUTPUT
+
+# search
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" str STRING >> $TS_OUTPUT
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" num NUMBER >> $TS_OUTPUT
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" bool BOOLEAN >> $TS_OUTPUT
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" str EMPTY >> $TS_OUTPUT
+
+$TS_HELPER_LOGINDEFS "$TS_SELF/logindefs.data" str UNKNOWN >> $TS_OUTPUT
+
+ts_finalize
diff --git a/tests/ts/login/logindefs.data b/tests/ts/login/logindefs.data
new file mode 100644
index 0000000..b899ff7
--- /dev/null
+++ b/tests/ts/login/logindefs.data
@@ -0,0 +1,16 @@
+#
+# this is /etc/login.defs sample
+#
+
+HELLO_WORLD "hello world!"
+STRING this_is_string # another comment
+NUMBER 123456
+BOOLEAN yEs
+
+CRAZY1 = "this is crazy format"
+CRAZY2=fooBar
+CRAZY3 FoooBaaar
+
+EMPTY
+
+END "the is end"
diff --git a/tests/ts/look/separator b/tests/ts/look/separator
new file mode 100755
index 0000000..51e96c9
--- /dev/null
+++ b/tests/ts/look/separator
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+#
+# WARNING: the look command expects that the /usr/share/dict/words uses
+# directory order!
+#
+# for example:
+#
+# cat words.raw | egrep --invert-match "'s$" | \
+# egrep "^[[:alnum:]'&!,./-]+$" | \
+# sort --ignore-case --dictionary-order | \
+# uniq > words
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="separator"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+$TS_CMD_LOOK apple-pie $TS_TOPDIR/ts/look/words >> $TS_OUTPUT
+ts_finalize
+
diff --git a/tests/ts/look/words b/tests/ts/look/words
new file mode 100644
index 0000000..b67ba9a
--- /dev/null
+++ b/tests/ts/look/words
@@ -0,0 +1,3 @@
+apple
+apple-pie
+oranges
diff --git a/tests/ts/lscpu/dumps/i386-amdshanghai.tar.gz b/tests/ts/lscpu/dumps/i386-amdshanghai.tar.gz
new file mode 100644
index 0000000..199c22b
--- /dev/null
+++ b/tests/ts/lscpu/dumps/i386-amdshanghai.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/i386-dellpe700.tar.gz b/tests/ts/lscpu/dumps/i386-dellpe700.tar.gz
new file mode 100644
index 0000000..a18a779
--- /dev/null
+++ b/tests/ts/lscpu/dumps/i386-dellpe700.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/i386-intels5000phb.tar.gz b/tests/ts/lscpu/dumps/i386-intels5000phb.tar.gz
new file mode 100644
index 0000000..36c9811
--- /dev/null
+++ b/tests/ts/lscpu/dumps/i386-intels5000phb.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ia64-512cpus.tar.gz b/tests/ts/lscpu/dumps/ia64-512cpus.tar.gz
new file mode 100644
index 0000000..caae22d
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ia64-512cpus.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ia64-hpmatterhorn.tar.gz b/tests/ts/lscpu/dumps/ia64-hpmatterhorn.tar.gz
new file mode 100644
index 0000000..b5f1516
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ia64-hpmatterhorn.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ia64-hprx1620.tar.gz b/tests/ts/lscpu/dumps/ia64-hprx1620.tar.gz
new file mode 100644
index 0000000..37bcb17
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ia64-hprx1620.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ia64-pg0.tar.gz b/tests/ts/lscpu/dumps/ia64-pg0.tar.gz
new file mode 100644
index 0000000..f30d792
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ia64-pg0.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz b/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz
new file mode 100644
index 0000000..c8fcc23
--- /dev/null
+++ b/tests/ts/lscpu/dumps/ppc64-POWER7.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-kvm.tar.gz b/tests/ts/lscpu/dumps/s390-kvm.tar.gz
new file mode 100644
index 0000000..340f7ea
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-kvm.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-lpar.tar.gz b/tests/ts/lscpu/dumps/s390-lpar.tar.gz
new file mode 100644
index 0000000..59aea6a
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-lpar.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/s390-zvm.tar.gz b/tests/ts/lscpu/dumps/s390-zvm.tar.gz
new file mode 100644
index 0000000..b13594d
--- /dev/null
+++ b/tests/ts/lscpu/dumps/s390-zvm.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/sparc64-UltraSparc-T1.tar.gz b/tests/ts/lscpu/dumps/sparc64-UltraSparc-T1.tar.gz
new file mode 100644
index 0000000..15bfeef
--- /dev/null
+++ b/tests/ts/lscpu/dumps/sparc64-UltraSparc-T1.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz b/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz
new file mode 100644
index 0000000..4d7516e
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-64cpu.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
new file mode 100644
index 0000000..2988cbc
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz
new file mode 100644
index 0000000..ef3f73e
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz
new file mode 100644
index 0000000..2f9fccd
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz b/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz
new file mode 100644
index 0000000..2c16381
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz b/tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz
new file mode 100644
index 0000000..2ad47dd
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-hpdl585.tar.gz b/tests/ts/lscpu/dumps/x86_64-hpdl585.tar.gz
new file mode 100644
index 0000000..89790b7
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-hpdl585.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-ibme326m.tar.gz b/tests/ts/lscpu/dumps/x86_64-ibme326m.tar.gz
new file mode 100644
index 0000000..5aff52f
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-ibme326m.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/dumps/x86_64-necem14.tar.gz b/tests/ts/lscpu/dumps/x86_64-necem14.tar.gz
new file mode 100644
index 0000000..00ed35f
--- /dev/null
+++ b/tests/ts/lscpu/dumps/x86_64-necem14.tar.gz
Binary files differ
diff --git a/tests/ts/lscpu/lscpu b/tests/ts/lscpu/lscpu
new file mode 100755
index 0000000..a7d7a95
--- /dev/null
+++ b/tests/ts/lscpu/lscpu
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Cai Qian <qcai@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+for dump in $(ls $TS_SELF/dumps/*.tar.gz | sort); do
+ name=$(basename $dump .tar.gz)
+ dumpdir="$TS_OUTDIR/dumps"
+
+ ts_init_subtest $name
+ mkdir -p $dumpdir
+
+ tar -C $dumpdir -zxf $dump
+
+ # Architecture information is not applicable with -s.
+ "${TS_CMD_LSCPU}" -s "${dumpdir}/${name}" | \
+ grep -v "Architecture" >"${TS_OUTPUT}" 2>&1
+
+ echo >>"${TS_OUTPUT}"
+
+ "${TS_CMD_LSCPU}" -p -s "${dumpdir}/${name}" \
+ >>"${TS_OUTPUT}" 2>&1
+
+ # LE/BE depends on binary
+ sed -i -e '/Byte Order:.*/d' $TS_OUTPUT
+
+ ts_finalize_subtest
+done
+
+ts_finalize
+
diff --git a/tests/ts/lscpu/mk-input.sh b/tests/ts/lscpu/mk-input.sh
new file mode 100644
index 0000000..65e3d20
--- /dev/null
+++ b/tests/ts/lscpu/mk-input.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Copyright (C) 2008-2009 Karel Zak <kzak@redhat.com>
+#
+# This script makes a copy of relevant files from /sys and /proc.
+# The files are useful for lscpu(1) regression tests.
+#
+progname=$(basename $0)
+
+if [ -z "$1" ]; then
+ echo -e "\nusage: $progname <testname>\n"
+ exit 1
+fi
+
+TS_NAME="$1"
+TS_DUMP="$TS_NAME"
+CP="cp -r --parents"
+
+mkdir -p $TS_DUMP/{proc,sys}
+
+$CP /proc/cpuinfo $TS_DUMP
+
+mkdir -p $TS_DUMP/proc/bus/pci
+$CP /proc/bus/pci/devices $TS_DUMP
+
+if [ -d "/proc/xen" ]; then
+ mkdir -p $TS_DUMP/proc/xen
+ if [ -f "/proc/xen/capabilities" ]; then
+ $CP /proc/xen/capabilities $TS_DUMP
+ fi
+fi
+
+if [ -e "/proc/sysinfo" ]; then
+ $CP /proc/sysinfo $TS_DUMP
+fi
+
+$CP /sys/devices/system/cpu/* $TS_DUMP
+$CP /sys/devices/system/node/*/cpumap $TS_DUMP
+
+tar zcvf $TS_NAME.tar.gz $TS_DUMP
+rm -rf $TS_DUMP
+
+
diff --git a/tests/ts/md5/data b/tests/ts/md5/data
new file mode 100644
index 0000000..1eed05a
--- /dev/null
+++ b/tests/ts/md5/data
@@ -0,0 +1,7 @@
+
+abc
+qazxswedc
+1qazxsw23edc
+a a a a a a a a a a
+KUWIOJDNWQKLFDHQUWEDAYCNAUIWSYDUQUICBSKLBCLUWIGDF
+EASC6545642432132SDECSESCEACSJKDWIOUDOIWIDOQPWUDQWIOSNXCSASCA
diff --git a/tests/ts/md5/md5 b/tests/ts/md5/md5
new file mode 100755
index 0000000..e94fb63
--- /dev/null
+++ b/tests/ts/md5/md5
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+> $TS_OUTPUT
+
+cat $TS_SELF/data | while read data
+do
+ echo -n $data | $TS_HELPER_MD5 >> $TS_OUTPUT
+done
+
+ts_finalize
+
diff --git a/tests/ts/minix/fsck b/tests/ts/minix/fsck
new file mode 100755
index 0000000..f635fc1
--- /dev/null
+++ b/tests/ts/minix/fsck
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="mkfs checksums"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+[ -x $TS_CMD_FSCKMINIX ] || ts_skip "fsck.minix not compiled"
+
+IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
+DEVICE=$(ts_device_init)
+
+ts_log "create minix fs"
+$TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
+
+ts_log "fsck minix fs"
+$TS_CMD_FSCKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
+
+ts_device_deinit $DEVICE
+ts_finalize
+
diff --git a/tests/ts/minix/mkfs b/tests/ts/minix/mkfs
new file mode 100755
index 0000000..93de4e6
--- /dev/null
+++ b/tests/ts/minix/mkfs
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="mkfs"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+[ -x $TS_CMD_MKMINIX ] || ts_skip "mkfs.minix not compiled"
+
+IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
+DEVICE=$(ts_device_init)
+
+ts_log "create minix fs"
+$TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
+
+ts_log "create mountpoint dir"
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_log "mount the filesystem"
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+# check it
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+
+ts_log "umount the image"
+$TS_CMD_UMOUNT $DEVICE
+ts_device_deinit $DEVICE
+ts_finalize
+
diff --git a/tests/ts/misc/strtosize b/tests/ts/misc/strtosize
new file mode 100755
index 0000000..7fb2ff9
--- /dev/null
+++ b/tests/ts/misc/strtosize
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="strtosize"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+$TS_HELPER_STRUTILS -1 >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 0 >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1 >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 123 >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 18446744073709551615 >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_STRUTILS 1K >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1KiB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1M >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1MiB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1G >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1GiB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1T >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1TiB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1P >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1PiB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1E >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1EiB >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_STRUTILS 1KB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1MB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1GB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1TB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1PB >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 1EB >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_STRUTILS "" >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS " " >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS " 1" >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS "1 " >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_STRUTILS 0x0a >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 0xff00 >> $TS_OUTPUT 2>&1
+$TS_HELPER_STRUTILS 0x80000000 >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/mount/devname b/tests/ts/mount/devname
new file mode 100755
index 0000000..8f32ef1
--- /dev/null
+++ b/tests/ts/mount/devname
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+
+grep -q $DEVICE /etc/mtab ||
+ echo "mount failed: cannot find $DEVICE in mtab" >> $TS_OUTPUT 2>&1
+
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+
+grep -q $DEVICE /etc/mtab &&
+ echo "umount failed: found $DEVICE in mtab" >> $TS_OUTPUT 2>&1
+
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/encryption b/tests/ts/mount/encryption
new file mode 100755
index 0000000..bf452a0
--- /dev/null
+++ b/tests/ts/mount/encryption
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+modprobe --dry-run --quiet cryptoloop
+[ "$?" == 0 ] || ts_skip "missing cryptoloop module"
+
+modprobe cryptoloop &> /dev/null
+
+PASSFILE=$TS_OUTPUT.pwd
+IMAGE=$(ts_image_init)
+
+echo "password" > $PASSFILE
+exec 9<> $PASSFILE
+
+DEVICE=$($TS_CMD_LOSETUP --pass-fd 9 --show --encryption blowfish --find $IMAGE)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+sleep 3
+$TS_CMD_LOSETUP --detach $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+# reopen (we need SEEK_SET 0, but this is shell...)
+exec 9>&-
+exec 9<> $PASSFILE
+
+$TS_CMD_MOUNT --pass-fd 9 -o encryption=blowfish $IMAGE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+$TS_CMD_FINDMNT --kernel --target $TS_MOUNTPOINT &> /dev/null
+[ "$?" == "0" ] || ts_die "Cannot find $TS_MOUNTPOINT in /proc/self/mountinfo"
+
+$TS_CMD_UMOUNT $TS_MOUNTPOINT || ts_die "Cannot umount $TS_MOUNTPOINT" $DEVICE
+
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken
new file mode 100755
index 0000000..48fe1a1
--- /dev/null
+++ b/tests/ts/mount/fstab-broken
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="broken fstab"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+# Let's use the same mountpoint for all subtests
+MNT=$TS_MOUNTPOINT
+mkdir -p $MNT
+
+ts_fstab_open
+echo "tmpd $MNT tmpfs" >> /etc/fstab
+ts_fstab_close
+
+ts_init_subtest "mount"
+$TS_CMD_MOUNT $MNT &> /dev/null
+$TS_CMD_FINDMNT --kernel --target "$MNT" &> /dev/null
+if [ "$?" != "0" ]; then
+ ts_log "Cannot find $MNT in /proc/self/mountinfo"
+else
+ ts_log "OK"
+fi
+$TS_CMD_UMOUNT $MNT &> /dev/null
+ts_finalize_subtest
+
+
+ts_init_subtest "mount-all"
+$TS_CMD_MOUNT -a &> /dev/null
+$TS_CMD_FINDMNT --kernel --target "$MNT" &> /dev/null
+if [ "$?" != "0" ]; then
+ ts_log "Cannot find $MNT in /proc/self/mountinfo"
+else
+ ts_log "OK"
+fi
+$TS_CMD_UMOUNT $MNT &> /dev/null
+ts_finalize_subtest
+
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-devname b/tests/ts/mount/fstab-devname
new file mode 100755
index 0000000..9af8db6
--- /dev/null
+++ b/tests/ts/mount/fstab-devname
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname (fstab)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add $DEVICE
+
+# variant A)
+$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-devname2label b/tests/ts/mount/fstab-devname2label
new file mode 100755
index 0000000..34214db
--- /dev/null
+++ b/tests/ts/mount/fstab-devname2label
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname (fstab label)"
+LABEL="testMountD2L"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "LABEL=$LABEL"
+
+$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-devname2uuid b/tests/ts/mount/fstab-devname2uuid
new file mode 100755
index 0000000..859bcda
--- /dev/null
+++ b/tests/ts/mount/fstab-devname2uuid
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname (fstab uuid)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "UUID=$UUID"
+
+$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-label b/tests/ts/mount/fstab-label
new file mode 100755
index 0000000..2c1e7eb
--- /dev/null
+++ b/tests/ts/mount/fstab-label
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by label (fstab)"
+LABEL="testFstabLabel"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "LABEL=$LABEL"
+
+# variant A)
+$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+# variant C)
+$TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-label2devname b/tests/ts/mount/fstab-label2devname
new file mode 100755
index 0000000..0d10f1b
--- /dev/null
+++ b/tests/ts/mount/fstab-label2devname
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by label (fstab devname)"
+LABEL="testMountL2D"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "$DEVICE"
+
+# variant A)
+$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-label2uuid b/tests/ts/mount/fstab-label2uuid
new file mode 100755
index 0000000..0ad4f05
--- /dev/null
+++ b/tests/ts/mount/fstab-label2uuid
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by label (fstab uuid)"
+LABEL="testMountL2U"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "UUID=$UUID"
+
+# variant A)
+$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-none b/tests/ts/mount/fstab-none
new file mode 100755
index 0000000..62a89ca
--- /dev/null
+++ b/tests/ts/mount/fstab-none
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="none"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+ts_fstab_add "none" "$TS_MOUNTPOINT" "tmpfs" "rw,nosuid,nodev,relatime"
+
+mkdir -p $TS_MOUNTPOINT
+
+$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+$TS_CMD_FINDMNT --target "$TS_MOUNTPOINT" &> /dev/null
+[ $? -eq 0 ] || ts_die "Not found target (mount failed?)"
+
+$TS_CMD_FINDMNT --source "none" --target "$TS_MOUNTPOINT" &> /dev/null
+[ $? -eq 0 ] || ts_die "Not found source and target"
+
+$TS_CMD_UMOUNT $TS_MOUNTPOINT || ts_die "Cannot umount $TS_MOUNTPOINT"
+
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-symlink b/tests/ts/mount/fstab-symlink
new file mode 100755
index 0000000..7f9d91f
--- /dev/null
+++ b/tests/ts/mount/fstab-symlink
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname (fstab symlink)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+LINKNAME="$TS_OUTDIR/${TS_TESTNAME}_lnk"
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+rm -rf $LINKNAME
+ln -s $DEVICE $LINKNAME
+
+ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user"
+
+# variant A) -- UID=0
+$TS_CMD_MOUNT $LINKNAME 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" $DEVICE
+
+# varian B) -- disabled, the $TS_CMD_MOUNT is usually not a real program, but
+# libtool wrapper and the real mount is exec()ed with
+# LD_LIBRARY_PATH. This all is bad for suid programs...
+
+#ts_init_suid $TS_CMD_MOUNT
+#ts_init_suid $TS_CMD_UMOUNT
+#
+#su $TS_TESTUSER -c "$TS_CMD_MOUNT -v -v -v $LINKNAME" 2>&1 >> $TS_OUTPUT
+#ts_is_mounted $DEVICE
+# || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+#su $TS_TESTUSER -c "$TS_CMD_UMOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT \
+# || ts_die "B) Cannot umount $LINKNAME" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+rm -f $LINKNAME
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-uuid b/tests/ts/mount/fstab-uuid
new file mode 100755
index 0000000..8c65b4d
--- /dev/null
+++ b/tests/ts/mount/fstab-uuid
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by uuid (fstab)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "UUID=$UUID"
+
+# varian A)
+$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# varian B)
+$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+# varian C)
+$TS_CMD_MOUNT UUID=$UUID 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-uuid2devname b/tests/ts/mount/fstab-uuid2devname
new file mode 100755
index 0000000..51bac14
--- /dev/null
+++ b/tests/ts/mount/fstab-uuid2devname
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by uuid (fstab devname)"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "$DEVICE"
+
+# variant A)
+$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/fstab-uuid2label b/tests/ts/mount/fstab-uuid2label
new file mode 100755
index 0000000..442cdb7
--- /dev/null
+++ b/tests/ts/mount/fstab-uuid2label
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by uuid (fstab label)"
+LABEL="testMountU2L"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+ts_fstab_add "LABEL=$LABEL"
+
+# variant A)
+$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+ts_fstab_clean
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/label b/tests/ts/mount/label
new file mode 100755
index 0000000..873ea95
--- /dev/null
+++ b/tests/ts/mount/label
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by label"
+LABEL="testMountLabel"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+# variant A)
+$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT LABEL=$LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/move b/tests/ts/mount/move
new file mode 100755
index 0000000..3862f46
--- /dev/null
+++ b/tests/ts/mount/move
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="move"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+DIR_SRC="$TS_OUTDIR/mnt-move-src"
+DIR_A="$TS_OUTDIR/mnt-move-A"
+DIR_B="$TS_OUTDIR/mnt-move-B"
+
+[ -d $DIR_SRC ] || mkdir $DIR_SRC
+[ -d $DIR_A ] || mkdir $DIR_A
+[ -d $DIR_B ] || mkdir $DIR_B
+
+# bind
+$TS_CMD_MOUNT --bind $DIR_SRC $DIR_A
+
+# check the bind
+$TS_CMD_FINDMNT --kernel --target "$DIR_A" &> /dev/null
+[ "$?" == "0" ] || ts_die "Cannot find binded $DIR_A in /proc/self/mountinfo"
+
+# move
+$TS_CMD_MOUNT --move $DIR_A $DIR_B
+
+# check the move
+$TS_CMD_FINDMNT --kernel --target "$DIR_B" &> /dev/null
+[ "$?" == "0" ] || ts_die "Cannot find binded $DIR_B in /proc/self/mountinfo"
+
+# clean up
+$TS_CMD_UMOUNT $DIR_B
+rmdir $DIR_SRC $DIR_A $DIR_B
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/noncanonical b/tests/ts/mount/noncanonical
new file mode 100755
index 0000000..1d28304
--- /dev/null
+++ b/tests/ts/mount/noncanonical
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="non canonical path"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+[ ! -e "/etc" ] && ts_skip "/etc not such file of directory"
+
+$TS_CMD_MOUNT -V | grep -q "libmount"
+[ $? -eq 0 ] && ts_skip "libmount version"
+
+# Don't canonicalize SPEC for cifs, nfs, smbfs, ...
+$TS_CMD_MOUNT -v -v -v -f -i -n -t cifs //etc /foo | grep "spec:" >> $TS_OUTPUT 2>&1
+
+# Canonicalize when FS type undefined and the SPEC exists
+$TS_CMD_MOUNT -v -v -v -f -i -n //etc /foo | grep "spec:" >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/mount/paths b/tests/ts/mount/paths
new file mode 100755
index 0000000..0b3432b
--- /dev/null
+++ b/tests/ts/mount/paths
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="basic paths"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+$TS_CMD_MOUNT -V | grep -q "libmount"
+[ $? -eq 0 ] && ts_skip "libmount version"
+
+$TS_CMD_MOUNT -n -f -v -v -v /dev/dummy /mnt &> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/mount/regfile b/tests/ts/mount/regfile
new file mode 100755
index 0000000..8d786ad
--- /dev/null
+++ b/tests/ts/mount/regfile
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Copyright (C) 2011 Karel Zak <kzak@redhat.com>
+# This file is part of util-linux.
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="regular file"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+IMAGE=$(ts_image_init)
+mkfs.ext3 -F $IMAGE &> /dev/null || ts_die "Cannot make ext3 on $IMAGE"
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+$TS_CMD_MOUNT $IMAGE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+
+DEVICE=$(awk '/regfile/ { print $1 }' /proc/mounts)
+
+ts_is_mounted "$TS_MOUNTPOINT" || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts"
+
+if [ -f "/sys/block/$(basename $DEVICE)/loop/backing_file" ]; then
+ $TS_CMD_UMOUNT $IMAGE || ts_die "Cannot umount $IMAGE"
+else
+ $TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
+ ts_skip "too old kernel"
+fi
+
+ts_is_mounted "$TS_MOUNTPOINT" && ts_die "$TS_MOUNTPOINT still in /proc/mounts"
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/remount b/tests/ts/mount/remount
new file mode 100755
index 0000000..051c595
--- /dev/null
+++ b/tests/ts/mount/remount
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="remount"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+# mountpoint
+[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE" $DEVICE
+
+# mount read-write
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT || ts_die "Cannot mount $TS_MOUNTPOINT" $DEVICE
+
+# check the mount
+egrep -q "^$DEVICE $TS_MOUNTPOINT" /etc/mtab \
+ || ts_die "Cannot find $TS_MOUNTPOINT in /etc/mtab" $DEVICE
+
+# remount
+$TS_CMD_MOUNT -o remount,ro $TS_MOUNTPOINT \
+ || ts_die "Cannot remount $TS_MOUNTPOINT" $DEVICE
+
+# check the remount
+$TS_CMD_FINDMNT --kernel --target "$TS_MOUNTPOINT" --options "ro" &> /dev/null
+[ "$?" == "0" ] || ts_die "Cannot find read-only in $TS_MOUNTPOINT in /proc/self/mountinfo"
+
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/rlimit b/tests/ts/mount/rlimit
new file mode 100755
index 0000000..7d7e42b
--- /dev/null
+++ b/tests/ts/mount/rlimit
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+#
+# The /etc/mtab file should not be modified if RLIMIT_FSIZE (ulimit -f)
+# is too low, otherwise the file could be corrupted (incomplete write).
+# The [u]mount(8) has to block SIGXFSZ and check if all writes and fflush
+# calls are successful.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="rlimit-fsize"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+[ -L /etc/mtab ] && ts_skip "mtab is symlink"
+[ "$(stat --format '%s' /etc/mtab)" -gt "1024" ] || ts_skip "mtab is too small"
+
+set -o pipefail
+
+function mtab_checksum()
+{
+ md5sum /etc/mtab | awk '{printf $1}'
+}
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+
+ts_init_subtest "mount"
+OLD_SUM=$(mtab_checksum)
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+(
+ ulimit -f 1
+ $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT
+) &> /dev/null
+NEW_SUM=$(mtab_checksum)
+$TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
+[ $NEW_SUM = $OLD_SUM ] && echo "OK: mtab unmodified by mount" >> $TS_OUTPUT
+ts_finalize_subtest
+
+
+ts_init_subtest "umount"
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT &> /dev/null
+OLD_SUM=$(mtab_checksum)
+(
+ ulimit -f 1
+ $TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
+) &> /dev/null
+NEW_SUM=$(mtab_checksum)
+$TS_CMD_UMOUNT $TS_MOUNTPOINT &> /dev/null
+[ $NEW_SUM = $OLD_SUM ] && echo "OK: mtab unmodified by umount" >> $TS_OUTPUT
+ts_finalize_subtest
+
+
+ts_device_deinit $DEVICE
+ts_log "Success"
+ts_finalize
diff --git a/tests/ts/mount/shared-subtree b/tests/ts/mount/shared-subtree
new file mode 100755
index 0000000..a0a76c5
--- /dev/null
+++ b/tests/ts/mount/shared-subtree
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="shared-subtree"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+function get_attr()
+{
+ # It's usually stupid idea to use 'grep | awk',
+ # but use paths in awk /regex/ is too tricky...
+ #
+ # TODO; improve libmount and findmnt to return the
+ # shared-subtree flags
+ #
+ echo $(grep "$1" /proc/self/mountinfo | \
+ awk '{print $7}' | \
+ awk -F ':' '{ print $1 }')
+}
+
+[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
+
+# bind
+$TS_CMD_MOUNT --bind $TS_MOUNTPOINT $TS_MOUNTPOINT
+
+# check the bind
+$TS_CMD_FINDMNT --kernel --target $TS_MOUNTPOINT &> /dev/null
+[ "$?" == "0" ] || ts_die "Cannot find binded $TS_MOUNTPOINT in /proc/self/mountinfo"
+
+# use the same mounpoint for all sub-tests
+MOUNTPOINT="$TS_MOUNTPOINT"
+
+
+ts_init_subtest "make-shared"
+$TS_CMD_MOUNT --make-shared $MOUNTPOINT >> $TS_OUTPUT 2>&1
+echo "$(get_attr $MOUNTPOINT)" >> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "make-private"
+$TS_CMD_MOUNT --make-private $MOUNTPOINT >> $TS_OUTPUT 2>&1
+echo "$(get_attr $MOUNTPOINT)" >> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "make-unbindable"
+$TS_CMD_MOUNT --make-unbindable $MOUNTPOINT >> $TS_OUTPUT 2>&1
+echo "$(get_attr $MOUNTPOINT)" >> $TS_OUTPUT
+ts_finalize_subtest
+
+
+# clean up
+$TS_CMD_UMOUNT $TS_MOUNTPOINT
+rmdir $TS_MOUNTPOINT
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/mount/special b/tests/ts/mount/special
new file mode 100755
index 0000000..6e198b3
--- /dev/null
+++ b/tests/ts/mount/special
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="call mount.<type>"
+MOUNTER="/sbin/mount.mytest"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+cat > $MOUNTER <<\EOF
+#!/bin/bash
+# This util-linux regression test component
+# It's safe to remove me...
+#
+echo "$0 called with \"$*\""
+EOF
+chmod +x $MOUNTER
+
+$TS_CMD_MOUNT -t mytest /foo /bar &> $TS_OUTPUT
+
+rm -f $MOUNTER
+
+ts_finalize
+
diff --git a/tests/ts/mount/uuid b/tests/ts/mount/uuid
new file mode 100755
index 0000000..e29ad39
--- /dev/null
+++ b/tests/ts/mount/uuid
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by uuid"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+
+# variant A)
+$TS_CMD_MOUNT -U $UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+
+# variant B)
+$TS_CMD_MOUNT UUID=$UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/namei/logic b/tests/ts/namei/logic
new file mode 100755
index 0000000..eda5d1b
--- /dev/null
+++ b/tests/ts/namei/logic
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="basic functionality"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+cd $TS_OUTDIR
+
+mkdir -p namei1/namei2
+touch namei1/namei2/a namei1/namei2/b
+
+$TS_CMD_NAMEI namei1/namei2/a >> $TS_OUTPUT 2>&1
+$TS_CMD_NAMEI namei1/namei2/b >> $TS_OUTPUT 2>&1
+$TS_CMD_NAMEI namei1/namei2/a/b >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/partx/partx b/tests/ts/partx/partx
new file mode 100755
index 0000000..f09d96b
--- /dev/null
+++ b/tests/ts/partx/partx
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2010 Davidlohr Bueso <dave@gnu.org>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="partitions probing"
+TS_IMGDIR="$TS_TOPDIR/ts/blkid/images-pt"
+
+. $TS_TOPDIR/functions.sh
+
+ts_init "$*"
+
+if [ ! -x "$TS_CMD_PARTX" ]; then
+ ts_skip "partx disabled"
+fi
+
+mkdir -p $TS_OUTDIR/images-pt
+
+for img in $(ls $TS_IMGDIR/*.img.bz2 | sort); do
+ name=$(basename $img .img.bz2)
+ outimg=$TS_OUTDIR/images-pt/${name}.img
+
+ ts_init_subtest $name
+
+ bunzip2 < $img > $outimg
+
+ $TS_CMD_PARTX $outimg &> $TS_OUTPUT
+ ts_finalize_subtest
+done
+
+ts_finalize
diff --git a/tests/ts/paths/built-in b/tests/ts/paths/built-in
new file mode 100755
index 0000000..84ee555
--- /dev/null
+++ b/tests/ts/paths/built-in
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="built-in"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+$TS_HELPER_PATHS &> $TS_OUTPUT
+
+ts_finalize
+
diff --git a/tests/ts/schedutils/cpuset b/tests/ts/schedutils/cpuset
new file mode 100755
index 0000000..f3f11dd
--- /dev/null
+++ b/tests/ts/schedutils/cpuset
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="cpuset"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+MASKS=" 0x00000001 \
+ 0x00000002 \
+ 0x00000003 \
+ 0x00000004 \
+ 0x00000005 \
+ 0x00000006 \
+ 0x00000007 \
+ 0x00000008 \
+ 0x00000009 \
+ 0x00005555 \
+ 0x00007777"
+
+RANGES="0 \
+ 1 \
+ 0,1 \
+ 2 \
+ 0,2 \
+ 1,2 \
+ 0-2 \
+ 3 \
+ 0,3 \
+ 0,2,4,6,8,10,12,14 \
+ 0-2,4-6,8-10,12-14"
+
+ts_log "masks:"
+for i in $MASKS; do
+ $TS_HELPER_CPUSET --mask $i >> $TS_OUTPUT
+done
+
+ts_log "strings:"
+for i in $RANGES; do
+ $TS_HELPER_CPUSET --range $i >> $TS_OUTPUT
+done
+
+ts_finalize
diff --git a/tests/ts/script/race b/tests/ts/script/race
new file mode 100755
index 0000000..e482264
--- /dev/null
+++ b/tests/ts/script/race
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="race conditions"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+bingofile="$TS_OUTDIR/${TS_TESTNAME}-bingo"
+
+set -o pipefail
+
+for i in `seq 1 1000`; do
+ $TS_CMD_SCRIPT -q -c "printf 'Bingo\n'" $bingofile
+done | grep -c Bingo >> $TS_OUTPUT
+
+rm -f $bingofile
+
+ts_finalize
+
diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname
new file mode 100755
index 0000000..cbab128
--- /dev/null
+++ b/tests/ts/swapon/devname
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by devname"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
+ || ts_die "Cannot make swap $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+
+$TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT
+
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+
+$TS_CMD_SWAPOFF $DEVICE
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/swapon/fixpgsz b/tests/ts/swapon/fixpgsz
new file mode 100755
index 0000000..0a694ad
--- /dev/null
+++ b/tests/ts/swapon/fixpgsz
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="fix page size"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+PAGESIZE=$($TS_HELPER_SYSINFO pagesize)
+
+#
+# Create a swap-area with incompatible page size
+#
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+if [ $(( 64 * 1024 )) -ne $PAGESIZE ]; then
+ BADSIZE=$(( 64 * 1024 ))
+else
+ BADSIZE=4096
+fi
+
+DEVICE=$(ts_device_init)
+
+$TS_CMD_MKSWAP -L MyFooBarLabel --pagesize $BADSIZE $DEVICE > /dev/null &> /dev/null \
+ || ts_die "Cannot make swap $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+
+#
+# Swapon
+#
+$TS_CMD_SWAPON --fixpgsz $DEVICE &> /dev/null
+
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+
+$TS_CMD_SWAPOFF $DEVICE
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/swapon/fixsig b/tests/ts/swapon/fixsig
new file mode 100755
index 0000000..2005dec
--- /dev/null
+++ b/tests/ts/swapon/fixsig
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="fix signature"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+PAGESIZE=$($TS_HELPER_SYSINFO pagesize)
+
+#
+# Create a swap-area
+#
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
+ || ts_die "Cannot make swap $DEVICE" $DEVICE
+
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+
+#
+# Rewrite signature to swsuspend
+#
+echo "S2SUSPEND " > $TS_OUTPUT.signature
+dd if=$TS_OUTPUT.signature of=$DEVICE \
+ seek=$(( $PAGESIZE - 10 )) count=10 bs=1 conv=notrunc &> /dev/null
+
+ts_device_has "TYPE" "swsuspend" $DEVICE || ts_die "Cannot find swsuspend on $DEVICE" $DEVICE
+
+#
+# Swapon
+#
+$TS_CMD_SWAPON $DEVICE &> /dev/null
+
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+
+$TS_CMD_SWAPOFF $DEVICE
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label
new file mode 100755
index 0000000..5df0541
--- /dev/null
+++ b/tests/ts/swapon/label
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by label"
+LABEL="testSwapLabel"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT \
+ || ts_die "Cannot make swap on $DEVICE" $DEVICE
+
+ts_device_has "LABEL" $LABEL $DEVICE \
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+
+$TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT
+
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+
+$TS_CMD_SWAPOFF $DEVICE
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+
diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid
new file mode 100755
index 0000000..f40720c
--- /dev/null
+++ b/tests/ts/swapon/uuid
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="by uuid"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+set -o pipefail
+
+DEVICE=$(ts_device_init)
+[ "$?" == 0 ] || ts_die "Cannot init device"
+
+$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
+ || ts_die "Cannot make swap $DEVICE" $DEVICE
+
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+
+UUID=$(ts_uuid_by_devname $DEVICE)
+
+$TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT
+
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+
+$TS_CMD_SWAPOFF $DEVICE
+ts_device_deinit $DEVICE
+
+ts_log "Success"
+ts_finalize
+