summaryrefslogtreecommitdiffstats
path: root/tests/ts/column
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ts/column')
-rwxr-xr-xtests/ts/column/columnate53
-rw-r--r--tests/ts/column/files/fivecols10
-rw-r--r--tests/ts/column/files/mountinfo41
-rw-r--r--tests/ts/column/files/onecolumn9
-rw-r--r--tests/ts/column/files/table6
-rw-r--r--tests/ts/column/files/table-empty-lines6
-rw-r--r--tests/ts/column/files/table-sep6
-rw-r--r--tests/ts/column/files/table-sep-space6
-rwxr-xr-xtests/ts/column/invalid-multibyte30
-rwxr-xr-xtests/ts/column/multi-file34
-rwxr-xr-xtests/ts/column/table119
11 files changed, 320 insertions, 0 deletions
diff --git a/tests/ts/column/columnate b/tests/ts/column/columnate
new file mode 100755
index 0000000..24e29db
--- /dev/null
+++ b/tests/ts/column/columnate
@@ -0,0 +1,53 @@
+#!/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="${0%/*}/../.."
+TS_DESC="columnate"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_COLUMN"
+ts_cd "$TS_OUTDIR"
+
+
+ts_init_subtest "fill-cols-80"
+$TS_CMD_COLUMN -c 80 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "fill-cols-50"
+$TS_CMD_COLUMN -c 50 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "fill-cols-250"
+$TS_CMD_COLUMN -c 250 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "fill-rows-80"
+$TS_CMD_COLUMN --fillrows -c 80 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "fill-rows-50"
+$TS_CMD_COLUMN --fillrows -c 50 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "fill-rows-250"
+$TS_CMD_COLUMN --fillrows -c 250 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_finalize
+
diff --git a/tests/ts/column/files/fivecols b/tests/ts/column/files/fivecols
new file mode 100644
index 0000000..d3ea4a8
--- /dev/null
+++ b/tests/ts/column/files/fivecols
@@ -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/files/mountinfo b/tests/ts/column/files/mountinfo
new file mode 100644
index 0000000..b751e16
--- /dev/null
+++ b/tests/ts/column/files/mountinfo
@@ -0,0 +1,41 @@
+17 62 0:17 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw
+18 62 0:4 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
+19 62 0:6 / /dev rw,nosuid shared:2 - devtmpfs devtmpfs rw,size=8175740k,nr_inodes=2043935,mode=755
+20 17 0:18 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:7 - securityfs securityfs rw
+21 19 0:19 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw
+22 19 0:20 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+23 62 0:21 / /run rw,nosuid,nodev shared:23 - tmpfs tmpfs rw,mode=755
+24 17 0:22 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:8 - tmpfs tmpfs ro,mode=755
+25 24 0:23 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd
+26 17 0:24 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:20 - pstore pstore rw
+27 17 0:25 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:21 - efivarfs efivarfs rw
+28 24 0:26 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,blkio
+29 24 0:27 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,cpu,cpuacct
+30 24 0:28 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,devices
+31 24 0:29 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,hugetlb
+32 24 0:30 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,pids
+33 24 0:31 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,memory
+34 24 0:32 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,cpuset
+35 24 0:33 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,perf_event
+36 24 0:34 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,net_cls,net_prio
+37 24 0:35 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,freezer
+60 17 0:36 / /sys/kernel/config rw,relatime shared:22 - configfs configfs rw
+62 0 8:4 / / rw,relatime shared:1 - ext4 /dev/sda4 rw,data=ordered
+38 18 0:37 / /proc/sys/fs/binfmt_misc rw,relatime shared:24 - autofs systemd-1 rw,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12781
+39 17 0:7 / /sys/kernel/debug rw,relatime shared:25 - debugfs debugfs rw
+40 19 0:38 / /dev/hugepages rw,relatime shared:26 - hugetlbfs hugetlbfs rw
+41 19 0:16 / /dev/mqueue rw,relatime shared:27 - mqueue mqueue rw
+42 38 0:39 / /proc/sys/fs/binfmt_misc rw,relatime shared:28 - binfmt_misc binfmt_misc rw
+75 18 0:40 / /proc/fs/nfsd rw,relatime shared:29 - nfsd nfsd rw
+77 62 0:41 / /tmp rw,nosuid,nodev shared:30 - tmpfs tmpfs rw
+80 62 8:3 / /home rw,relatime shared:31 - ext4 /dev/sda3 rw,data=ordered
+81 62 8:2 / /boot rw,relatime shared:32 - ext4 /dev/sda2 rw,data=ordered
+84 80 8:5 / /home/games rw,relatime shared:33 - ext4 /dev/sda5 rw,data=ordered
+86 81 8:1 / /boot/efi rw,relatime shared:34 - vfat /dev/sda1 rw,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro
+88 80 8:17 / /home/archive rw,relatime shared:35 - ext4 /dev/sdb1 rw,data=ordered
+90 62 0:43 / /var/lib/nfs/rpc_pipefs rw,relatime shared:36 - rpc_pipefs sunrpc rw
+223 17 0:47 / /sys/fs/fuse/connections rw,relatime shared:163 - fusectl fusectl rw
+217 23 0:46 / /run/user/1000 rw,nosuid,nodev,relatime shared:158 - tmpfs tmpfs rw,size=1637324k,mode=700,uid=1000,gid=1000
+203 217 0:45 / /run/user/1000/gvfs rw,nosuid,nodev,relatime shared:153 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1000,group_id=1000
+171 23 0:44 / /run/user/0 rw,nosuid,nodev,relatime shared:114 - tmpfs tmpfs rw,size=1637324k,mode=700
+177 62 0:48 / /mnt/sounds rw,relatime shared:119 - cifs //sr.net.home/sounds rw,vers=1.0,cache=strict,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1
diff --git a/tests/ts/column/files/onecolumn b/tests/ts/column/files/onecolumn
new file mode 100644
index 0000000..69ec82f
--- /dev/null
+++ b/tests/ts/column/files/onecolumn
@@ -0,0 +1,9 @@
+AAAAAAAAAAAAAAAAAAAA
+BBBBBBBBBBBBBBBBBBBBB
+CCCCCCCCCCCCCCCC
+DDDDDDDDDDDDDDDDD
+EEEEEEEEEEEEE
+FFFFFFFFFFFFFFFFFFF
+XXXXXXX
+YYYYYYYYYYY
+ZZZZZZZZZZZ
diff --git a/tests/ts/column/files/table b/tests/ts/column/files/table
new file mode 100644
index 0000000..e051631
--- /dev/null
+++ b/tests/ts/column/files/table
@@ -0,0 +1,6 @@
+AAA BBBB C DDDD
+A BBB CCCC DDD
+AA BB CCC DD
+AAAA B CC D
+AA BB CC DD
+AAAAA BBB CCC DDDD
diff --git a/tests/ts/column/files/table-empty-lines b/tests/ts/column/files/table-empty-lines
new file mode 100644
index 0000000..9429b4d
--- /dev/null
+++ b/tests/ts/column/files/table-empty-lines
@@ -0,0 +1,6 @@
+
+A B CCC
+AA BBB AA
+AAA BB C
+
+AAAA BBBB CCCC
diff --git a/tests/ts/column/files/table-sep b/tests/ts/column/files/table-sep
new file mode 100644
index 0000000..d4c2bf3
--- /dev/null
+++ b/tests/ts/column/files/table-sep
@@ -0,0 +1,6 @@
+AAA,BBBB,C,DDDD
+,BBB,CCCC,DDD
+AA,BB,,DD
+AAAA,B,CC,D
+AA,,CC,DD
+AAAAA,BBB,CCC,DDDD
diff --git a/tests/ts/column/files/table-sep-space b/tests/ts/column/files/table-sep-space
new file mode 100644
index 0000000..25d9b5a
--- /dev/null
+++ b/tests/ts/column/files/table-sep-space
@@ -0,0 +1,6 @@
+AAA BBBB C DDDD
+ BBB CCCC DDD
+AA BB DD
+AAAA B CC D
+AA CC DD
+AAAAA BBB CCC DDDD
diff --git a/tests/ts/column/invalid-multibyte b/tests/ts/column/invalid-multibyte
new file mode 100755
index 0000000..a9e3710
--- /dev/null
+++ b/tests/ts/column/invalid-multibyte
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2014 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="${0%/*}/../.."
+TS_DESC="invalid multibyte"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_COLUMN"
+
+ts_cd "$TS_OUTDIR"
+
+printf "£\n" | LC_ALL=C $TS_CMD_COLUMN >> $TS_OUTPUT 2>&1
+
+ts_finalize
diff --git a/tests/ts/column/multi-file b/tests/ts/column/multi-file
new file mode 100755
index 0000000..38cf2b5
--- /dev/null
+++ b/tests/ts/column/multi-file
@@ -0,0 +1,34 @@
+#!/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="${0%/*}/../.."
+TS_DESC="multiple files"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_COLUMN"
+
+ts_cd "$TS_OUTDIR"
+
+$TS_CMD_COLUMN -x -c 50 $TS_SELF/files/fivecols \
+ $TS_SELF/files/fivecols \
+ $TS_SELF/files/fivecols >> $TS_OUTPUT 2>&1
+
+ts_finalize
+
diff --git a/tests/ts/column/table b/tests/ts/column/table
new file mode 100755
index 0000000..bd1f16f
--- /dev/null
+++ b/tests/ts/column/table
@@ -0,0 +1,119 @@
+#!/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="${0%/*}/../.."
+TS_DESC="table"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_COLUMN"
+ts_cd "$TS_OUTDIR"
+
+ts_init_subtest "default"
+$TS_CMD_COLUMN --table $TS_SELF/files/table >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "output-separator"
+$TS_CMD_COLUMN --output-separator '|' --table $TS_SELF/files/table >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "input-separator"
+$TS_CMD_COLUMN --separator ',' --table $TS_SELF/files/table-sep >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "input-separator-space"
+$TS_CMD_COLUMN --separator "$(echo -e '\t')" --table $TS_SELF/files/table-sep-space >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "empty-lines"
+$TS_CMD_COLUMN --table --table-empty-lines $TS_SELF/files/table-empty-lines >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "noempty-lines"
+$TS_CMD_COLUMN --table $TS_SELF/files/table-empty-lines >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "long"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "hide"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-hide 1,2,3,4,7,8 >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "headers"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide SEP,ID,PARENT,ROOT \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "truncate"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide SEP,ID,PARENT,ROOT \
+ --table-truncate VFS-OPTS,FS-OPTS \
+ --output-width 80 \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "right"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide SEP,ID,PARENT,ROOT,VFS-OPTS,FS-OPTS,PROP \
+ --table-right SOURCE,TYPE \
+ --output-width 80 \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "wrap"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide=SEP,ID,PARENT,ROOT,VFS-OPTS,PROP \
+ --table-wrap FS-OPTS \
+ --output-width 110 \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "order"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide=SEP,ID,PARENT,ROOT,PROP,FS-OPTS,MAJMIN \
+ --table-order TARGET,SOURCE,TYPE,VFS-OPTS \
+ --output-width 110 \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "tree"
+$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \
+ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
+ --table-hide=SEP,ID,PARENT,ROOT,PROP,FS-OPTS,MAJMIN \
+ --table-order TARGET,SOURCE,TYPE,VFS-OPTS \
+ --tree TARGET \
+ --tree-id ID \
+ --tree-parent PARENT \
+ --output-width 110 \
+ >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_init_subtest "empty-column"
+printf ':a:b\n' | $TS_CMD_COLUMN --table --separator ':' --output-separator ':' >> $TS_OUTPUT 2>&1
+ts_finalize_subtest
+
+ts_finalize