diff options
author | Ruediger Meier | 2014-06-11 17:47:34 +0200 |
---|---|---|
committer | Ruediger Meier | 2014-06-11 23:08:49 +0200 |
commit | 02229b5519ac77dec26d829c6be14e826d4611bc (patch) | |
tree | f5b100eb43d400e30026484adabd0232edcc635b /tests/ts/utmp | |
parent | utmpdump: fix localtime() error handling (diff) | |
download | kernel-qcow2-util-linux-02229b5519ac77dec26d829c6be14e826d4611bc.tar.gz kernel-qcow2-util-linux-02229b5519ac77dec26d829c6be14e826d4611bc.tar.xz kernel-qcow2-util-linux-02229b5519ac77dec26d829c6be14e826d4611bc.zip |
tests: merge last/ and utmpdump/ into new utmp/ dir
We want to prepare and simplify utmp sepcific fixes. Beside all this
renaming we also update/add some text data to have it more consistent.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/utmp')
-rwxr-xr-x | tests/ts/utmp/last | 76 | ||||
-rwxr-xr-x | tests/ts/utmp/last-ipv6 | 52 | ||||
-rw-r--r-- | tests/ts/utmp/txt-a | 19 | ||||
-rw-r--r-- | tests/ts/utmp/txt-b | 10 | ||||
-rw-r--r-- | tests/ts/utmp/txt-ipv6 | 2 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-tobin | 33 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-tobin-ipv6 | 33 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-totxt | 29 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-totxt-ipv6 | 29 | ||||
-rw-r--r-- | tests/ts/utmp/wtmp-a.BE | bin | 0 -> 7296 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-a.LE | bin | 0 -> 7296 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-b.BE | bin | 0 -> 3840 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-b.LE | bin | 0 -> 3840 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-ipv6.BE | bin | 0 -> 768 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-ipv6.LE | bin | 0 -> 768 bytes |
15 files changed, 283 insertions, 0 deletions
diff --git a/tests/ts/utmp/last b/tests/ts/utmp/last new file mode 100755 index 000000000..7154a76b3 --- /dev/null +++ b/tests/ts/utmp/last @@ -0,0 +1,76 @@ +#!/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="last" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LAST" +$TS_CMD_LAST --version 2>&1 | grep -q "invalid option" \ + && ts_skip "deprecated last" + +WTMP_FILE=${TS_OUTDIR}/wtmp-a +rm -f $WTMP_FILE +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) +ln -s ${TS_SELF}/wtmp-a.${BYTE_ORDER} $WTMP_FILE + +export LANG=C +export TZ=GMT + +>| $TS_OUTPUT + +ts_log "~~~ basic output ~~~" +$TS_CMD_LAST -f $WTMP_FILE >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ include system ~~~" +$TS_CMD_LAST -f $WTMP_FILE -x >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns short ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d root >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns long ~~~" +$TS_CMD_LAST -f $WTMP_FILE -w -d root >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns host last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -a -d root >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ show ip ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i torvalds >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ no host ~~~" +$TS_CMD_LAST -f $WTMP_FILE -R torvalds >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ full times shortopt ~~~" +$TS_CMD_LAST -f $WTMP_FILE -F >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ full times longopt ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=full >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ no time ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=notime >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ iso-8601 time ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=iso -w >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ since and until ~~~" +$TS_CMD_LAST -f $WTMP_FILE -s "2013-08-28 02:20" -t "2013-08-28 08:20" >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ present ~~~" +$TS_CMD_LAST -f $WTMP_FILE -p "2013-08-28 11:20" >> $TS_OUTPUT 2>/dev/null + +rm -f $WTMP_FILE + +ts_finalize diff --git a/tests/ts/utmp/last-ipv6 b/tests/ts/utmp/last-ipv6 new file mode 100755 index 000000000..80c20bacd --- /dev/null +++ b/tests/ts/utmp/last-ipv6 @@ -0,0 +1,52 @@ +#!/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="last ipv6" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LAST" +$TS_CMD_LAST --version 2>&1 | grep -q "invalid option" \ + && ts_skip "deprecated last" + +WTMP_FILE=${TS_OUTDIR}/wtmp-ipv6 +rm -f $WTMP_FILE +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) +ln -s ${TS_SELF}/wtmp-ipv6.${BYTE_ORDER} $WTMP_FILE + +export LANG=C +export TZ=GMT + +>| $TS_OUTPUT + +ts_log "~~~ dns short ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns long ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d -w >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns host last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d -a >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ show ip ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ show ip last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i -a >> $TS_OUTPUT 2>/dev/null + +rm -f $WTMP_FILE + +ts_finalize diff --git a/tests/ts/utmp/txt-a b/tests/ts/utmp/txt-a new file mode 100644 index 000000000..bc91d1983 --- /dev/null +++ b/tests/ts/utmp/txt-a @@ -0,0 +1,19 @@ +[9] [00009] [ts/9] [accounting] [foo ] [nine ] [0.0.0.0 ] [Wed Aug 28 03:00:00 2013 GMT] +[8] [00008] [ts/8] [dead_process] [foo ] [eight ] [0.0.0.0 ] [Wed Aug 28 04:00:00 2013 GMT] +[7] [00007] [ts/7] [user_process] [foo ] [seven ] [0.0.0.0 ] [Wed Aug 28 05:00:00 2013 GMT] +[6] [00006] [ts/6] [login ] [foo ] [six ] [0.0.0.0 ] [Wed Aug 28 06:00:00 2013 GMT] +[5] [00005] [ts/5] [init ] [foo ] [five ] [0.0.0.0 ] [Wed Aug 28 07:00:00 2013 GMT] +[4] [00004] [ts/4] [oldtime ] [foo ] [four ] [0.0.0.0 ] [Wed Aug 28 08:00:00 2013 GMT] +[3] [00003] [ts/3] [newtime ] [foo ] [three ] [0.0.0.0 ] [Wed Aug 28 09:00:00 2013 GMT] +[2] [00002] [ts/2] [sysboot ] [foo ] [two ] [0.0.0.0 ] [Wed Aug 28 10:00:00 2013 GMT] +[1] [00001] [ts/1] [runlevel] [foo ] [one ] [0.0.0.0 ] [Wed Aug 28 11:00:00 2013 GMT] +[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [Wed Aug 28 12:00:00 2013 GMT] +[7] [00010] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [Wed Aug 28 13:00:00 2013 GMT] +[8] [00011] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [Wed Aug 28 14:00:00 2013 GMT] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 15:00:00 2013 GMT] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 16:00:00 2013 GMT] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 17:00:00 2013 GMT] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 18:00:00 2013 GMT] +[7] [00013] [ts/1] [torvalds] [linux ] [hobby ] [128.214.205.14 ] [Mon Aug 26 00:57:08 1991 GMT] +[7] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [ ] +[8] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [Tue Jan 19 03:14:07 2038 GMT] diff --git a/tests/ts/utmp/txt-b b/tests/ts/utmp/txt-b new file mode 100644 index 000000000..02fb22d5f --- /dev/null +++ b/tests/ts/utmp/txt-b @@ -0,0 +1,10 @@ +[7] [17058] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [Wed Jan 16 23:44:09 2013 GMT] +[7] [22098] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [Wed Jan 16 23:49:17 2013 GMT] +[7] [24915] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 12:23:33 2013 GMT] +[8] [24915] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [Thu Jan 17 12:24:49 2013 GMT] +[7] [30629] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 13:12:39 2013 GMT] +[8] [30629] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:19 2013 GMT] +[8] [22098] [ts/2] [kerolasa] [pts/2 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:48 2013 GMT] +[8] [17058] [ts/1] [kerolasa] [pts/1 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:48 2013 GMT] +[7] [31545] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 20:17:21 2013 GMT] +[7] [28496] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 21:09:39 2013 GMT] diff --git a/tests/ts/utmp/txt-ipv6 b/tests/ts/utmp/txt-ipv6 new file mode 100644 index 000000000..5cce1506b --- /dev/null +++ b/tests/ts/utmp/txt-ipv6 @@ -0,0 +1,2 @@ +[7] [00010] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [Wed Aug 28 20:30:40 2013 GMT] +[8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [Wed Aug 28 20:40:50 2013 GMT] diff --git a/tests/ts/utmp/utmpdump-tobin b/tests/ts/utmp/utmpdump-tobin new file mode 100755 index 000000000..9caa8df0b --- /dev/null +++ b/tests/ts/utmp/utmpdump-tobin @@ -0,0 +1,33 @@ +#!/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="to binary" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_UTMPDUMP" + +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) + +export LANG=C +export TZ=GMT +OUTFILE=${TS_OUTDIR}/${TS_TESTNAME}.file +$TS_CMD_UTMPDUMP -r $TS_SELF/txt-b >| $OUTFILE 2>/dev/null +if diff -q $TS_SELF/wtmp-b.$BYTE_ORDER $OUTFILE; then + echo "no diff" +fi > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-tobin-ipv6 b/tests/ts/utmp/utmpdump-tobin-ipv6 new file mode 100755 index 000000000..468657455 --- /dev/null +++ b/tests/ts/utmp/utmpdump-tobin-ipv6 @@ -0,0 +1,33 @@ +#!/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="IPv6 to binary" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_UTMPDUMP" + +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) + +export LANG=C +export TZ=GMT +OUTFILE=${TS_OUTDIR}/${TS_TESTNAME}.file +$TS_CMD_UTMPDUMP -r $TS_SELF/txt-ipv6 >| $OUTFILE 2>/dev/null +if diff -q $TS_SELF/wtmp-ipv6.$BYTE_ORDER $OUTFILE; then + echo "no diff" +fi > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-totxt b/tests/ts/utmp/utmpdump-totxt new file mode 100755 index 000000000..50259110c --- /dev/null +++ b/tests/ts/utmp/utmpdump-totxt @@ -0,0 +1,29 @@ +#!/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="to text" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_UTMPDUMP" + +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) + +export LANG=C +export TZ=GMT +$TS_CMD_UTMPDUMP $TS_SELF/wtmp-b.$BYTE_ORDER >| $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-totxt-ipv6 b/tests/ts/utmp/utmpdump-totxt-ipv6 new file mode 100755 index 000000000..7ef61803f --- /dev/null +++ b/tests/ts/utmp/utmpdump-totxt-ipv6 @@ -0,0 +1,29 @@ +#!/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="IPv6 to text" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_UTMPDUMP" + +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) + +export LANG=C +export TZ=GMT +$TS_CMD_UTMPDUMP $TS_SELF/wtmp-ipv6.$BYTE_ORDER >| $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/utmp/wtmp-a.BE b/tests/ts/utmp/wtmp-a.BE Binary files differnew file mode 100644 index 000000000..5015f8eb1 --- /dev/null +++ b/tests/ts/utmp/wtmp-a.BE diff --git a/tests/ts/utmp/wtmp-a.LE b/tests/ts/utmp/wtmp-a.LE Binary files differnew file mode 100644 index 000000000..f66bb20a1 --- /dev/null +++ b/tests/ts/utmp/wtmp-a.LE diff --git a/tests/ts/utmp/wtmp-b.BE b/tests/ts/utmp/wtmp-b.BE Binary files differnew file mode 100644 index 000000000..fb09a0c71 --- /dev/null +++ b/tests/ts/utmp/wtmp-b.BE diff --git a/tests/ts/utmp/wtmp-b.LE b/tests/ts/utmp/wtmp-b.LE Binary files differnew file mode 100644 index 000000000..45d35bbb0 --- /dev/null +++ b/tests/ts/utmp/wtmp-b.LE diff --git a/tests/ts/utmp/wtmp-ipv6.BE b/tests/ts/utmp/wtmp-ipv6.BE Binary files differnew file mode 100644 index 000000000..8cf7d3965 --- /dev/null +++ b/tests/ts/utmp/wtmp-ipv6.BE diff --git a/tests/ts/utmp/wtmp-ipv6.LE b/tests/ts/utmp/wtmp-ipv6.LE Binary files differnew file mode 100644 index 000000000..342553bb9 --- /dev/null +++ b/tests/ts/utmp/wtmp-ipv6.LE |