diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/ts/col/io | 86 | ||||
-rwxr-xr-x | tests/ts/col/multibyte | 40 | ||||
-rw-r--r-- | tests/ts/col/multibyte.data | 1 | ||||
-rwxr-xr-x | tests/ts/col/newlines | 46 | ||||
-rwxr-xr-x | tests/ts/col/options | 43 | ||||
-rw-r--r-- | tests/ts/colcrt/crash1 | bin | 0 -> 314 bytes | |||
-rw-r--r-- | tests/ts/colcrt/crash2 | bin | 0 -> 776 bytes | |||
-rwxr-xr-x | tests/ts/colcrt/functional | 50 | ||||
-rw-r--r-- | tests/ts/colcrt/hang1 | 1 | ||||
-rw-r--r-- | tests/ts/colcrt/nasty-input | bin | 0 -> 545 bytes | |||
-rwxr-xr-x | tests/ts/colcrt/regressions | 37 | ||||
-rw-r--r-- | tests/ts/colcrt/underlines | 23 | ||||
-rwxr-xr-x | tests/ts/colrm/rm2-2 | 28 | ||||
-rwxr-xr-x | tests/ts/column/columnate | 52 | ||||
-rw-r--r-- | tests/ts/column/files/fivecols | 10 | ||||
-rw-r--r-- | tests/ts/column/files/mountinfo | 41 | ||||
-rw-r--r-- | tests/ts/column/files/onecolumn | 9 | ||||
-rw-r--r-- | tests/ts/column/files/table | 6 | ||||
-rw-r--r-- | tests/ts/column/files/table-empty-lines | 6 | ||||
-rw-r--r-- | tests/ts/column/files/table-sep | 6 | ||||
-rw-r--r-- | tests/ts/column/files/table-sep-space | 6 | ||||
-rwxr-xr-x | tests/ts/column/invalid-multibyte | 30 | ||||
-rwxr-xr-x | tests/ts/column/multi-file | 34 | ||||
-rwxr-xr-x | tests/ts/column/table | 127 |
24 files changed, 682 insertions, 0 deletions
diff --git a/tests/ts/col/io b/tests/ts/col/io new file mode 100755 index 0000000..c7e0d09 --- /dev/null +++ b/tests/ts/col/io @@ -0,0 +1,86 @@ +#!/bin/bash + +# +# Copyright (C) 2020 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="io effects" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COL" + +ts_init_subtest "trailing-spaces" +printf "1 \t\n2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "tab-backspace" +printf "1\t\x082\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "various-spaces" +printf "1 \t\f2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "cr" +printf "1\r2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "vt1" +printf "1\n23\v\n4\n5\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "vt2" +printf "a\v\vb\v\vc" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "reverse-lf" +printf "1\n2\e\x073\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "so-si" +printf "\x0e\x0f" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "esc-tab" +printf "\e\t\b1\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "esc-backspace" +printf "1\e\b2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "cs-normal" +printf "<B\x10\x0E\t\v\x100" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "cs-alternate" +printf "1\t\x0E2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "allocate-here" +printf "1\t\v2\t\n3" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "half-line" +printf "\e\t\b1\n" | ts_run $TS_CMD_COL --fine >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "flushing" +seq 1 199 | ts_run $TS_CMD_COL --lines 8 >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/col/multibyte b/tests/ts/col/multibyte new file mode 100755 index 0000000..543608c --- /dev/null +++ b/tests/ts/col/multibyte @@ -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="${0%/*}/../.." +TS_DESC="multibyte input" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COL" +ts_check_test_command "$TS_HELPER_STRERROR" + +ts_init_subtest "valid" +cat $TS_SELF/multibyte.data | + LC_ALL=C ts_run $TS_CMD_COL 2>&1 | + sed -e "s@$($TS_HELPER_STRERROR EILSEQ)@EILSEQ@" > $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "invalid" +printf '%s\n' $'abc\200\200jkl' | + LC_ALL=C ts_run $TS_CMD_COL 2>&1 | + sed -e "s@$($TS_HELPER_STRERROR EILSEQ)@EILSEQ@" > $TS_OUTPUT +ts_finalize_subtest + + +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/col/newlines b/tests/ts/col/newlines new file mode 100755 index 0000000..209de0b --- /dev/null +++ b/tests/ts/col/newlines @@ -0,0 +1,46 @@ +#!/bin/bash + +# +# Copyright (C) 2020 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="newline handling" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COL" + +ts_init_subtest "zero-length-file" +printf "" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "one-line-no-nl" +printf "1" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "one-line-with-nl" +printf "1\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "second-line-no-nl" +printf "1\n2" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "second-line-with-nl" +printf "1\n2\n" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/col/options b/tests/ts/col/options new file mode 100755 index 0000000..5031220 --- /dev/null +++ b/tests/ts/col/options @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# Copyright (C) 2020 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="options" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COL" + +ts_init_subtest "no-backspaces" +printf "FIXME" | ts_run $TS_CMD_COL --no-backspaces >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "pass" +printf "a\x11b" | ts_run $TS_CMD_COL >> $TS_OUTPUT 2>> $TS_ERRLOG +printf "a\x11b" | ts_run $TS_CMD_COL --pass >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "tabs" +printf " 1\n" | ts_run $TS_CMD_COL --tabs >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "spaces" +printf "\t1\n" | ts_run $TS_CMD_COL --spaces >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/colcrt/crash1 b/tests/ts/colcrt/crash1 Binary files differnew file mode 100644 index 0000000..6681181 --- /dev/null +++ b/tests/ts/colcrt/crash1 diff --git a/tests/ts/colcrt/crash2 b/tests/ts/colcrt/crash2 Binary files differnew file mode 100644 index 0000000..0843cb6 --- /dev/null +++ b/tests/ts/colcrt/crash2 diff --git a/tests/ts/colcrt/functional b/tests/ts/colcrt/functional new file mode 100755 index 0000000..3e8cc38 --- /dev/null +++ b/tests/ts/colcrt/functional @@ -0,0 +1,50 @@ +#!/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="${0%/*}/../.." +TS_DESC="functional" + +export LC_CTYPE='C' + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COLCRT" + +ts_init_subtest 'no-options' +$TS_CMD_COLCRT < $TS_SELF/nasty-input >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_COLCRT < $TS_SELF/underlines >> $TS_OUTPUT 2>> $TS_ERRLOG +echo "return value: $?" >> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest 'no-underlining' +$TS_CMD_COLCRT --no-underlining < $TS_SELF/nasty-input >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_COLCRT --no-underlining < $TS_SELF/underlines >> $TS_OUTPUT 2>> $TS_ERRLOG +echo "return value: $?" >> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest 'half-lines' +$TS_CMD_COLCRT --half-lines < $TS_SELF/nasty-input >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_COLCRT --half-lines < $TS_SELF/underlines >> $TS_OUTPUT 2>> $TS_ERRLOG +echo "return value: $?" >> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest 'short-options' +$TS_CMD_COLCRT - -2 $TS_SELF/nasty-input >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_COLCRT - -2 $TS_SELF/underlines >> $TS_OUTPUT 2>> $TS_ERRLOG +echo "return value: $?" >> $TS_OUTPUT +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/colcrt/hang1 b/tests/ts/colcrt/hang1 new file mode 100644 index 0000000..d26259e --- /dev/null +++ b/tests/ts/colcrt/hang1 @@ -0,0 +1 @@ +789:;<=>=>?IABUVNXYZ[_`abcdefgg !"#$%&'()*+,-./01234)*:,-./0123456789:;[=>?1234)*:,-./0123456789:;[=>?4456789:;<=>?IABUVN`abcdefg !" $%&'()*+,-./0123z{|ü~e
\ No newline at end of file diff --git a/tests/ts/colcrt/nasty-input b/tests/ts/colcrt/nasty-input Binary files differnew file mode 100644 index 0000000..5e541bc --- /dev/null +++ b/tests/ts/colcrt/nasty-input diff --git a/tests/ts/colcrt/regressions b/tests/ts/colcrt/regressions new file mode 100755 index 0000000..130ad9a --- /dev/null +++ b/tests/ts/colcrt/regressions @@ -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="${0%/*}/../.." +TS_DESC="regressions" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COLCRT" +ts_check_prog "timeout" +ts_check_prog "env" + +check_input_file() { + ts_init_subtest ${1##*/} + timeout 2 env LC_ALL=C.UTF-8 $TS_CMD_COLCRT < $1 >> $TS_OUTPUT 2>> $TS_ERRLOG + echo "return value: $?" >> $TS_OUTPUT + ts_finalize_subtest +} + +check_input_file "$TS_SELF/crash1" +check_input_file "$TS_SELF/crash2" +check_input_file "$TS_SELF/hang1" + +ts_finalize diff --git a/tests/ts/colcrt/underlines b/tests/ts/colcrt/underlines new file mode 100644 index 0000000..940c7a8 --- /dev/null +++ b/tests/ts/colcrt/underlines @@ -0,0 +1,23 @@ + 200 ___ + 201 abc + 202 _abc + 203 a_bc + 204 ab_c + 205 abc_ + 206 __abc + 207 a__bc + 208 ab__c + 209 abc__ + 210 _a_bc + 211 _ab_c + 212 a_b_c + 213 a__bc + 214 a_bc_ + 215 abc__ + 216 _abc_ + 217 _a_b_c + 218 _a__bc + 219 a__bc_ + 220 _abc__ + 221 ___abc + 222 abc___ diff --git a/tests/ts/colrm/rm2-2 b/tests/ts/colrm/rm2-2 new file mode 100755 index 0000000..061f5b8 --- /dev/null +++ b/tests/ts/colrm/rm2-2 @@ -0,0 +1,28 @@ +#!/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="basic check" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COLRM" + +printf "a b\nc\td\nef\b\tg\n" | $TS_CMD_COLRM 2 2 >> $TS_OUTPUT 2>> $TS_ERRLOG + +ts_finalize diff --git a/tests/ts/column/columnate b/tests/ts/column/columnate new file mode 100755 index 0000000..ebeb0c4 --- /dev/null +++ b/tests/ts/column/columnate @@ -0,0 +1,52 @@ +#!/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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "fill-cols-50" +$TS_CMD_COLUMN -c 50 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "fill-cols-250" +$TS_CMD_COLUMN -c 250 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "fill-rows-80" +$TS_CMD_COLUMN --fillrows -c 80 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "fill-rows-50" +$TS_CMD_COLUMN --fillrows -c 50 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "fill-rows-250" +$TS_CMD_COLUMN --fillrows -c 250 $TS_SELF/files/onecolumn >> $TS_OUTPUT 2>> $TS_ERRLOG +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..f3d643e --- /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 "\x94\x7e\n" | LC_ALL=C.UTF-8 $TS_CMD_COLUMN >> $TS_OUTPUT 2>> $TS_ERRLOG + +ts_finalize diff --git a/tests/ts/column/multi-file b/tests/ts/column/multi-file new file mode 100755 index 0000000..fa2b2cb --- /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>> $TS_ERRLOG + +ts_finalize + diff --git a/tests/ts/column/table b/tests/ts/column/table new file mode 100755 index 0000000..0ef5388 --- /dev/null +++ b/tests/ts/column/table @@ -0,0 +1,127 @@ +#!/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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "output-separator" +$TS_CMD_COLUMN --output-separator '|' --table $TS_SELF/files/table >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "input-separator" +$TS_CMD_COLUMN --separator ',' --table $TS_SELF/files/table-sep >> $TS_OUTPUT 2>> $TS_ERRLOG +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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "empty-lines" +$TS_CMD_COLUMN --table --table-empty-lines $TS_SELF/files/table-empty-lines >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "noempty-lines" +$TS_CMD_COLUMN --table $TS_SELF/files/table-empty-lines >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "long" +$TS_CMD_COLUMN --table $TS_SELF/files/mountinfo >> $TS_OUTPUT 2>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +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>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "empty-column" +printf ':a:b\n' | $TS_CMD_COLUMN --table --separator ':' --output-separator ':' >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "empty-column-at-eol" +printf '|' | $TS_CMD_COLUMN --separator '|' --output-separator '|' --table >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "empty-column-at-eol2" +printf '||' | $TS_CMD_COLUMN --separator '|' --output-separator '|' --table >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_finalize |